Olimex-STM32-LCD board files update

This commit is contained in:
Joel Bodenmann 2013-11-25 21:35:04 +01:00
parent e1c9be8263
commit cf193b3583
2 changed files with 40 additions and 13 deletions

View File

@ -39,16 +39,6 @@ static inline void init_board(void) {
adcStart(&ADCD1, NULL);
}
static inline bool_t getpin_pressed(void) {
palSetPadMode(GPIOC, 0, PAL_MODE_INPUT_PULLDOWN);
palSetPadMode(GPIOC, 1, PAL_MODE_INPUT);
palSetPadMode(GPIOC, 2, PAL_MODE_INPUT);
palSetPadMode(GPIOC, 3, PAL_MODE_OUTPUT_PUSHPULL);
palSetPad(GPIOC, 3);
return palReadPad(GPIOC, 0);
}
static inline void aquire_bus(void) {
}
@ -57,7 +47,37 @@ static inline void release_bus(void) {
}
static inline uint16_t read_x_value(void) {
static inline void setup_x(void) {
palSetPadMode(GPIOC, 0, PAL_MODE_INPUT_ANALOG);
palSetPadMode(GPIOC, 1, PAL_MODE_INPUT_ANALOG);
palSetPadMode(GPIOC, 2, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOC, 3, PAL_MODE_OUTPUT_PUSHPULL);
palSetPad(GPIOC, 2);
palClearPad(GPIOC, 3);
gfxSleepMilliseconds(1);
}
static inline void setup_y(void) {
palSetPadMode(GPIOC, 2, PAL_MODE_INPUT_ANALOG);
palSetPadMode(GPIOC, 3, PAL_MODE_INPUT_ANALOG);
palSetPadMode(GPIOC, 0, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOC, 1, PAL_MODE_OUTPUT_PUSHPULL);
palSetPad(GPIOC, 1);
palClearPad(GPIOC, 0);
gfxSleepMilliseconds(1);
}
static inline void setup_z(void) {
palSetPadMode(GPIOC, 0, PAL_MODE_INPUT_PULLDOWN);
palSetPadMode(GPIOC, 1, PAL_MODE_INPUT);
palSetPadMode(GPIOC, 2, PAL_MODE_INPUT);
palSetPadMode(GPIOC, 3, PAL_MODE_OUTPUT_PUSHPULL);
palSetPad(GPIOC, 3);
}
static inline uint16_t read_x(void) {
uint16_t val1, val2;
adcsample_t samples[ADC_NUM_CHANNELS * ADC_BUF_DEPTH];
@ -81,7 +101,7 @@ static inline uint16_t read_x_value(void) {
return ((val1+((1<<12)-val2))/4);
}
static inline uint16_t read_y_value(void) {
static inline uint16_t read_y(void) {
uint16_t val1, val2;
adcsample_t samples[ADC_NUM_CHANNELS * ADC_BUF_DEPTH];
@ -105,5 +125,12 @@ static inline uint16_t read_y_value(void) {
return ((val1+((1<<12)-val2))/4);
}
static inline uint16_t read_z(void) {
if (palReadPad(GPIOC, 0))
return 100;
else
return 0;
}
#endif /* _GINPUT_LLD_MOUSE_BOARD_H */

View File

@ -12,7 +12,7 @@
#define GINPUT_MOUSE_NEED_CALIBRATION TRUE
#define GINPUT_MOUSE_LLD_CALIBRATION_LOADSAVE FALSE
#define GINPUT_MOUSE_MAX_CALIBRATION_ERROR 12
#define GINPUT_MOUSE_READ_CYCLES 4
#define GINPUT_MOUSE_READ_CYCLES 1
#define GINPUT_MOUSE_POLL_PERIOD 25
#define GINPUT_MOUSE_MAX_CLICK_JITTER 2
#define GINPUT_MOUSE_MAX_MOVE_JITTER 2