From c24ec8daf2f610c24dc8e6fd49be9b7022e9405e Mon Sep 17 00:00:00 2001 From: inmarket Date: Mon, 25 Nov 2013 22:53:11 +1000 Subject: [PATCH] Update template files for the MCU touch driver. --- .../MCU/ginput_lld_mouse_board_template.h | 63 ++++++++++++++----- ...g.h => ginput_lld_mouse_config_template.h} | 2 +- 2 files changed, 47 insertions(+), 18 deletions(-) rename drivers/ginput/touch/MCU/{ginput_lld_mouse_config.h => ginput_lld_mouse_config_template.h} (95%) diff --git a/drivers/ginput/touch/MCU/ginput_lld_mouse_board_template.h b/drivers/ginput/touch/MCU/ginput_lld_mouse_board_template.h index 2ec5c10b..52af9269 100644 --- a/drivers/ginput/touch/MCU/ginput_lld_mouse_board_template.h +++ b/drivers/ginput/touch/MCU/ginput_lld_mouse_board_template.h @@ -24,26 +24,14 @@ * @notapi */ static inline void init_board(void) { - } /** - * @brief Check whether the surface is currently touched - * @return TRUE if the surface is currently touched - * - * @notapi - */ -static inline bool_t getpin_pressed(void) { - -} - -/** - * @brief Aquire the bus ready for readings + * @brief Acquire the bus ready for readings * * @notapi */ static inline void aquire_bus(void) { - } /** @@ -52,7 +40,39 @@ static inline void aquire_bus(void) { * @notapi */ static inline void release_bus(void) { +} +/** + * @brief Set up the device for a x coordinate read + * @note This is performed once followed by multiple + * x coordinate read's (which are then median filtered) + * + * @notapi + */ +static inline void setup_x(void) { +} + +/** + * @brief Set up the device for a y coordinate read + * @note This is performed once followed by multiple + * y coordinate read's (which are then median filtered) + * + * @notapi + */ +static inline void setup_y(void) { +} + +/** + * @brief Set up the device for a z coordinate (pressure) read + * @note This is performed once followed by multiple + * z coordinate read's (which are then median filtered) + * + * @notapi + */ +static inline void setup_z(void) { + palClearPad(GPIOB, GPIOB_DRIVEA); + palClearPad(GPIOB, GPIOB_DRIVEB); + chThdSleepMilliseconds(2); } /** @@ -61,18 +81,27 @@ static inline void release_bus(void) { * * @notapi */ -static inline uint16_t read_x_value(void) { - +static inline uint16_t read_x(void) { } /** - * @brief Read an y value from touch controller + * @brief Read a y value from touch controller * @return The value read from the controller * * @notapi */ -static inline uint16_t read_y_value(void) { +static inline uint16_t read_y(void) { +} +/** + * @brief Read a z value from touch controller + * @return The value read from the controller. + * @note The return value must be scaled between 0 and 100. + * Values over 80 are considered as "touch" down. + * + * @notapi + */ +static inline uint16_t read_z(void) { } #endif /* _GINPUT_LLD_MOUSE_BOARD_H */ diff --git a/drivers/ginput/touch/MCU/ginput_lld_mouse_config.h b/drivers/ginput/touch/MCU/ginput_lld_mouse_config_template.h similarity index 95% rename from drivers/ginput/touch/MCU/ginput_lld_mouse_config.h rename to drivers/ginput/touch/MCU/ginput_lld_mouse_config_template.h index 9864cb3e..0c9e9300 100644 --- a/drivers/ginput/touch/MCU/ginput_lld_mouse_config.h +++ b/drivers/ginput/touch/MCU/ginput_lld_mouse_config_template.h @@ -22,7 +22,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