diff options
-rw-r--r-- | boards/base/FireBull-STM32F103-FB/gmouse_lld_ADS7843_board.h | 4 | ||||
-rw-r--r-- | drivers/ginput/touch/ADS7843/gmouse_lld_ADS7843.c | 19 |
2 files changed, 16 insertions, 7 deletions
diff --git a/boards/base/FireBull-STM32F103-FB/gmouse_lld_ADS7843_board.h b/boards/base/FireBull-STM32F103-FB/gmouse_lld_ADS7843_board.h index aa3a41e7..e4f30818 100644 --- a/boards/base/FireBull-STM32F103-FB/gmouse_lld_ADS7843_board.h +++ b/boards/base/FireBull-STM32F103-FB/gmouse_lld_ADS7843_board.h @@ -11,7 +11,7 @@ #define GMOUSE_ADS7843_PEN_CALIBRATE_ERROR 2 #define GMOUSE_ADS7843_PEN_CLICK_ERROR 2 #define GMOUSE_ADS7843_PEN_MOVE_ERROR 2 -#define GMOUSE_ADS7843_FINGER_CALIBRATE_ERROR 4 +#define GMOUSE_ADS7843_FINGER_CALIBRATE_ERROR 20 #define GMOUSE_ADS7843_FINGER_CLICK_ERROR 4 #define GMOUSE_ADS7843_FINGER_MOVE_ERROR 4 @@ -31,7 +31,7 @@ static bool_t init_board(GMouse* m, unsigned driverinstance) return FALSE; // Set the GPIO modes - palSetPadMode(GPIOC, 4, PAL_MODE_INPUT); + palSetPadMode(GPIOC, 4, PAL_MODE_INPUT_PULLUP); // Start the SPI peripheral spiStart(&SPID1, &spicfg); diff --git a/drivers/ginput/touch/ADS7843/gmouse_lld_ADS7843.c b/drivers/ginput/touch/ADS7843/gmouse_lld_ADS7843.c index a58ca938..72cd6f67 100644 --- a/drivers/ginput/touch/ADS7843/gmouse_lld_ADS7843.c +++ b/drivers/ginput/touch/ADS7843/gmouse_lld_ADS7843.c @@ -20,8 +20,9 @@ #define BOARD_DATA_SIZE 0
#endif
-#define CMD_X 0xD1
-#define CMD_Y 0x91
+#define CMD_X 0xD1
+#define CMD_Y 0x91
+#define CMD_ENABLE_IRQ 0x80
void read_xyz(GMouse* m, GMouseReading* pdr)
{
@@ -31,10 +32,18 @@ void read_xyz(GMouse* m, GMouseReading* pdr) pdr->buttons = 0;
if (getpin_pressed()) {
+ pdr->z = 1; // Set to Z_MAX as we are pressed
+
aquire_bus();
- pdr->x = read_value(CMD_X);
- pdr->y = read_value(CMD_Y);
- pdr->z = 1;
+
+ read_value(CMD_X); // Dummy read - disable PenIRQ
+ pdr->x = read_value(CMD_X); // Read X-Value
+
+ read_value(CMD_Y); // Dummy read - disable PenIRQ
+ pdr->y = read_value(CMD_Y); // Read Y-Value
+
+ read_value(CMD_ENABLE_IRQ); // Enable IRQ
+
release_bus();
} else {
// Don't touch x and y values here
|