diff options
author | Joel Bodenmann <joel@unormal.org> | 2012-12-02 15:26:14 +0100 |
---|---|---|
committer | Joel Bodenmann <joel@unormal.org> | 2012-12-02 15:26:14 +0100 |
commit | ae7da0770bb60c4add9c06d9dda93045a003281c (patch) | |
tree | 6c67e165747e409876a211c7a23e0878810512b7 /drivers | |
parent | 24e75d96e14a668ead91797bc7cb4e7d3097b3ea (diff) | |
download | uGFX-ae7da0770bb60c4add9c06d9dda93045a003281c.tar.gz uGFX-ae7da0770bb60c4add9c06d9dda93045a003281c.tar.bz2 uGFX-ae7da0770bb60c4add9c06d9dda93045a003281c.zip |
GINPUT MCU driver update
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ginput/touch/MCU/ginput_lld_mouse_board_olimex_stm32_lcd.h | 10 | ||||
-rw-r--r-- | drivers/ginput/touch/MCU/ginput_lld_mouse_config.h | 4 | ||||
-rw-r--r-- | drivers/touchscreen/MCU/touchscreen_lld.c | 28 |
3 files changed, 21 insertions, 21 deletions
diff --git a/drivers/ginput/touch/MCU/ginput_lld_mouse_board_olimex_stm32_lcd.h b/drivers/ginput/touch/MCU/ginput_lld_mouse_board_olimex_stm32_lcd.h index 84f3416c..fa3dca7e 100644 --- a/drivers/ginput/touch/MCU/ginput_lld_mouse_board_olimex_stm32_lcd.h +++ b/drivers/ginput/touch/MCU/ginput_lld_mouse_board_olimex_stm32_lcd.h @@ -105,7 +105,7 @@ static __inline void release_bus(void) { *
* @notapi
*/
-static __inline uint16_t read_x_value(void) {
+static uint16_t read_x_value(void) {
uint16_t val1, val2;
adcsample_t samples[ADC_NUM_CHANNELS * ADC_BUF_DEPTH];
@@ -113,7 +113,7 @@ static __inline uint16_t read_x_value(void) { 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);
chThdSleepMilliseconds(1);
@@ -135,7 +135,7 @@ static __inline uint16_t read_x_value(void) { *
* @notapi
*/
-static __inline uint16_t read_y_value(void) {
+static uint16_t read_y_value(void) {
uint16_t val1, val2;
adcsample_t samples[ADC_NUM_CHANNELS * ADC_BUF_DEPTH];
@@ -143,8 +143,8 @@ static __inline uint16_t read_y_value(void) { palSetPadMode(GPIOC, 3, PAL_MODE_INPUT_ANALOG);
palSetPadMode(GPIOC, 0, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOC, 1, PAL_MODE_OUTPUT_PUSHPULL);
- return 42;
- palSetPad(GPIOC, 1);
+
+ palSetPad(GPIOC, 1);
palClearPad(GPIOC, 0);
chThdSleepMilliseconds(1);
adcConvert(&ADCD1, &adc_y_config, samples, ADC_BUF_DEPTH);
diff --git a/drivers/ginput/touch/MCU/ginput_lld_mouse_config.h b/drivers/ginput/touch/MCU/ginput_lld_mouse_config.h index e1aa15f3..4711625b 100644 --- a/drivers/ginput/touch/MCU/ginput_lld_mouse_config.h +++ b/drivers/ginput/touch/MCU/ginput_lld_mouse_config.h @@ -28,9 +28,9 @@ #define _LLD_GINPUT_MOUSE_CONFIG_H
#define GINPUT_MOUSE_EVENT_TYPE GEVENT_TOUCH
-#define GINPUT_MOUSE_NEED_CALIBRATION FALSE
+#define GINPUT_MOUSE_NEED_CALIBRATION TRUE
#define GINPUT_MOUSE_LLD_CALIBRATION_LOADSAVE FALSE
-#define GINPUT_MOUSE_MAX_CALIBRATION_ERROR -1
+#define GINPUT_MOUSE_MAX_CALIBRATION_ERROR 10
#define GINPUT_MOUSE_READ_CYCLES 4
#define GINPUT_MOUSE_POLL_PERIOD 100
#define GINPUT_MOUSE_MAX_CLICK_JITTER 4
diff --git a/drivers/touchscreen/MCU/touchscreen_lld.c b/drivers/touchscreen/MCU/touchscreen_lld.c index d34228a6..2e3c9aea 100644 --- a/drivers/touchscreen/MCU/touchscreen_lld.c +++ b/drivers/touchscreen/MCU/touchscreen_lld.c @@ -98,27 +98,27 @@ static void ts_lld_filter(void) { * @notapi
*/
uint16_t ts_lld_read_x(void) {
- uint16_t val1, val2;
- adcsample_t samples[ADC_NUM_CHANNELS * ADC_BUF_DEPTH];
+ uint16_t val1, val2;
+ adcsample_t samples[ADC_NUM_CHANNELS * ADC_BUF_DEPTH];
- palSetPadMode(ts->yd_port, ts->yd_pin, PAL_MODE_INPUT_ANALOG);
- palSetPadMode(ts->yu_port, ts->yu_pin, PAL_MODE_INPUT_ANALOG);
- palSetPadMode(ts->xl_port, ts->xl_pin, PAL_MODE_OUTPUT_PUSHPULL);
- palSetPadMode(ts->xr_port, ts->xr_pin, PAL_MODE_OUTPUT_PUSHPULL);
+ 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(ts->xl_port, ts->xl_pin);
- palClearPad(ts->xr_port, ts->xr_pin);
+ palSetPad(GPIOC, 2);
+ palClearPad(GPIOC, 3);
chThdSleepMilliseconds(1);
- adcConvert(ts->adc_driver, &adc_x_config, samples, ADC_BUF_DEPTH);
+ adcConvert(&ADCD1, &adc_x_config, samples, ADC_BUF_DEPTH);
val1 = ((samples[0] + samples[1])/2);
-
- palClearPad(ts->xl_port, ts->xl_pin);
- palSetPad(ts->xr_port, ts->xr_pin);
+
+ palClearPad(GPIOC, 2);
+ palSetPad(GPIOC, 3);
chThdSleepMilliseconds(1);
- adcConvert(ts->adc_driver, &adc_x_config, samples, ADC_BUF_DEPTH);
+ adcConvert(&ADCD1, &adc_x_config, samples, ADC_BUF_DEPTH);
val2 = ((samples[0] + samples[1])/2);
- return ((val1+((1<<12)-val2))/4);
+ return ((val1+((1<<12)-val2))/4);
}
/**
|