From eb0cc2187236fb0eac18bee536cf0d8f8cb7b7f8 Mon Sep 17 00:00:00 2001 From: inmarket Date: Mon, 13 Oct 2014 16:35:57 +1000 Subject: Tidy up MCU mouse defines --- .../Mikromedia-STM32-M4-ILI9341/gmouse_lld_MCU_board.h | 18 ++++++++---------- boards/base/Olimex-STM32-LCD/gmouse_lld_MCU_board.h | 16 +++++++--------- 2 files changed, 15 insertions(+), 19 deletions(-) (limited to 'boards') diff --git a/boards/base/Mikromedia-STM32-M4-ILI9341/gmouse_lld_MCU_board.h b/boards/base/Mikromedia-STM32-M4-ILI9341/gmouse_lld_MCU_board.h index 7624cdf3..15c00e66 100644 --- a/boards/base/Mikromedia-STM32-M4-ILI9341/gmouse_lld_MCU_board.h +++ b/boards/base/Mikromedia-STM32-M4-ILI9341/gmouse_lld_MCU_board.h @@ -8,15 +8,20 @@ #ifndef _LLD_GMOUSE_MCU_BOARD_H #define _LLD_GMOUSE_MCU_BOARD_H -// We directly define the jitter settings +// Resolution and Accuracy Settings #define GMOUSE_MCU_PEN_CALIBRATE_ERROR 8 #define GMOUSE_MCU_PEN_CLICK_ERROR 6 #define GMOUSE_MCU_PEN_MOVE_ERROR 4 #define GMOUSE_MCU_FINGER_CALIBRATE_ERROR 14 #define GMOUSE_MCU_FINGER_CLICK_ERROR 18 #define GMOUSE_MCU_FINGER_MOVE_ERROR 14 +#define GMOUSE_MCU_Z_MIN 0 +#define GMOUSE_MCU_Z_MAX 4095 +#define GMOUSE_MCU_Z_TOUCHON 3090 +#define GMOUSE_MCU_Z_TOUCHOFF 400 -// Now board specific settings... +// How much extra data to allocate at the end of the GMouse structure for the board's use +#define GMOUSE_MCU_BOARD_DATA_SIZE 0 #define ADC_NUM_CHANNELS 2 #define ADC_BUF_DEPTH 1 @@ -36,13 +41,6 @@ static const ADCConversionGroup adcgrpcfg = { ADC_SQR3_SQ2_N(ADC_CHANNEL_IN8) | ADC_SQR3_SQ1_N(ADC_CHANNEL_IN9) }; -#define BOARD_DATA_SIZE 0 // How many extra bytes to add on the end of the mouse structure for the board's use - -#define Z_MIN 0 // The minimum Z reading -#define Z_MAX 4095 // The maximum Z reading (12 bits) -#define Z_TOUCHON 3090 // Values between this and Z_MAX are definitely pressed -#define Z_TOUCHOFF 400 // Values between this and Z_MIN are definitely not pressed - static bool_t init_board(GMouse *m, unsigned driverinstance) { (void) m; @@ -71,7 +69,7 @@ static void read_xyz(GMouse *m, GMouseReading *prd) { prd->z = samples[0]; // Take a shortcut and don't read x, y if we know we are definitely not touched. - if (prd->z >= Z_TOUCHOFF) { + if (prd->z >= GMOUSE_MCU_Z_TOUCHOFF) { // Get the x reading palSetPad(GPIOB, GPIOB_DRIVEA); diff --git a/boards/base/Olimex-STM32-LCD/gmouse_lld_MCU_board.h b/boards/base/Olimex-STM32-LCD/gmouse_lld_MCU_board.h index 8f085f84..8c90946f 100644 --- a/boards/base/Olimex-STM32-LCD/gmouse_lld_MCU_board.h +++ b/boards/base/Olimex-STM32-LCD/gmouse_lld_MCU_board.h @@ -8,15 +8,20 @@ #ifndef _LLD_GMOUSE_MCU_BOARD_H #define _LLD_GMOUSE_MCU_BOARD_H -// We directly define the jitter settings +// Resolution and Accuracy Settings #define GMOUSE_MCU_PEN_CALIBRATE_ERROR 8 #define GMOUSE_MCU_PEN_CLICK_ERROR 6 #define GMOUSE_MCU_PEN_MOVE_ERROR 4 #define GMOUSE_MCU_FINGER_CALIBRATE_ERROR 14 #define GMOUSE_MCU_FINGER_CLICK_ERROR 18 #define GMOUSE_MCU_FINGER_MOVE_ERROR 14 +#define GMOUSE_MCU_Z_MIN 0 +#define GMOUSE_MCU_Z_MAX 1 +#define GMOUSE_MCU_Z_TOUCHON 1 +#define GMOUSE_MCU_Z_TOUCHOFF 0 -// Now board specific settings... +// How much extra data to allocate at the end of the GMouse structure for the board's use +#define GMOUSE_MCU_BOARD_DATA_SIZE 0 #define ADC_NUM_CHANNELS 2 #define ADC_BUF_DEPTH 1 @@ -45,13 +50,6 @@ static const ADCConversionGroup adc_x_config = { ADC_SQR3_SQ2_N(ADC_CHANNEL_IN10) | ADC_SQR3_SQ1_N(ADC_CHANNEL_IN11) }; -#define BOARD_DATA_SIZE 0 // How many extra bytes to add on the end of the mouse structure for the board's use - -#define Z_MIN 0 // The minimum Z reading -#define Z_MAX 1 // The maximum Z reading -#define Z_TOUCHON 1 // Values between this and Z_MAX are definitely pressed -#define Z_TOUCHOFF 0 // Values between this and Z_MIN are definitely not pressed - static inline void setup_z(void) { palSetPadMode(GPIOC, 0, PAL_MODE_INPUT_PULLDOWN); palSetPadMode(GPIOC, 1, PAL_MODE_INPUT); -- cgit v1.2.3