73#define STMPE811_I2C_SLAVE_ADDR_0 (0x82 >> 1)
74#define STMPE811_I2C_SLAVE_ADDR_1 (0x88 >> 1)
81#define STMPE811_MAP_PINS( cfg ) \
82 cfg.i2c_cfg.scl = CTP_SCL; \
83 cfg.i2c_cfg.sda = CTP_SDA; \
89#define STMPE811_REG_ADDR_CHIP_ID ((uint8_t)0x00)
90#define STMPE811_REG_ADDR_ID_VER ((uint8_t)0x02)
91#define STMPE811_REG_ADDR_SYS_CTRL1 ((uint8_t)0x03)
92#define STMPE811_REG_ADDR_SYS_CTRL2 ((uint8_t)0x04)
93#define STMPE811_REG_ADDR_SPI_CFG ((uint8_t)0x08)
94#define STMPE811_REG_ADDR_INT_CTRL ((uint8_t)0x09)
95#define STMPE811_REG_ADDR_INT_EN ((uint8_t)0x0A)
96#define STMPE811_REG_ADDR_INT_STA ((uint8_t)0x0B)
97#define STMPE811_REG_ADDR_GPIO_EN ((uint8_t)0x0C)
98#define STMPE811_REG_ADDR_GPIO_INT_STA ((uint8_t)0x0D)
99#define STMPE811_REG_ADDR_ADC_INT_EN ((uint8_t)0x0E)
100#define STMPE811_REG_ADDR_ADC_INT_STA ((uint8_t)0x0F)
101#define STMPE811_REG_ADDR_GPIO_SET_PIN ((uint8_t)0x10)
102#define STMPE811_REG_ADDR_GPIO_CLR_PIN ((uint8_t)0x11)
103#define STMPE811_REG_ADDR_GPIO_MP_STA ((uint8_t)0x12)
104#define STMPE811_REG_ADDR_GPIO_DIR ((uint8_t)0x13)
105#define STMPE811_REG_ADDR_GPIO_ED ((uint8_t)0x14)
106#define STMPE811_REG_ADDR_GPIO_RE ((uint8_t)0x15)
107#define STMPE811_REG_ADDR_GPIO_FE ((uint8_t)0x16)
108#define STMPE811_REG_ADDR_GPIO_AF ((uint8_t)0x17)
109#define STMPE811_REG_ADDR_ADC_CTRL1 ((uint8_t)0x20)
110#define STMPE811_REG_ADDR_ADC_CTRL2 ((uint8_t)0x21)
111#define STMPE811_REG_ADDR_ADC_CAPT ((uint8_t)0x22)
112#define STMPE811_REG_ADDR_ADC_DATA_CH0 ((uint8_t)0x30)
113#define STMPE811_REG_ADDR_ADC_DATA_CH1 ((uint8_t)0x32)
114#define STMPE811_REG_ADDR_ADC_DATA_CH2 ((uint8_t)0x34)
115#define STMPE811_REG_ADDR_ADC_DATA_CH3 ((uint8_t)0x36)
116#define STMPE811_REG_ADDR_ADC_DATA_CH4 ((uint8_t)0x38)
117#define STMPE811_REG_ADDR_ADC_DATA_CH5 ((uint8_t)0x3A)
118#define STMPE811_REG_ADDR_ADC_DATA_CH6 ((uint8_t)0x3C)
119#define STMPE811_REG_ADDR_ADC_DATA_CH7 ((uint8_t)0x3E)
120#define STMPE811_REG_ADDR_TSC_CTRL ((uint8_t)0x40)
121#define STMPE811_REG_ADDR_TSC_CFG ((uint8_t)0x41)
122#define STMPE811_REG_ADDR_WDW_TR_X ((uint8_t)0x42)
123#define STMPE811_REG_ADDR_WDW_TR_Y ((uint8_t)0x44)
124#define STMPE811_REG_ADDR_WDW_BL_X ((uint8_t)0x46)
125#define STMPE811_REG_ADDR_WDW_BL_Y ((uint8_t)0x48)
126#define STMPE811_REG_ADDR_FIFO_TH ((uint8_t)0x4A)
127#define STMPE811_REG_ADDR_FIFO_STA ((uint8_t)0x4B)
128#define STMPE811_REG_ADDR_FIFO_SIZE ((uint8_t)0x4C)
129#define STMPE811_REG_ADDR_TSC_DATA_X ((uint8_t)0x4D)
130#define STMPE811_REG_ADDR_TSC_DATA_Y ((uint8_t)0x4F)
131#define STMPE811_REG_ADDR_TSC_DATA_Z ((uint8_t)0x51)
132#define STMPE811_REG_ADDR_TSC_DATA_XYZ ((uint8_t)0x52)
133#define STMPE811_REG_ADDR_TSC_FRACTION_Z ((uint8_t)0x56)
134#define STMPE811_REG_ADDR_TSC_DATA ((uint8_t)0x57)
135#define STMPE811_REG_ADDR_TSC_I_DRIVE ((uint8_t)0x58)
136#define STMPE811_REG_ADDR_TSC_SHIELD ((uint8_t)0x59)
137#define STMPE811_REG_ADDR_TEMP_CTRL ((uint8_t)0x60)
138#define STMPE811_REG_ADDR_TEMP_DATA ((uint8_t)0x61)
139#define STMPE811_REG_ADDR_TEMP_TH ((uint8_t)0x62)
146#define STMPE811_FIFO_STA_START ((uint8_t)( 0 ))
147#define STMPE811_FIFO_STA_RESET ((uint8_t)( 1 ))
148#define STMPE811_FIFO_TH_TRIG_BIT ((uint8_t)( 1 << 4 ))
149#define STMPE811_FIFO_EMPTY_BIT ((uint8_t)( 1 << 5 ))
150#define STMPE811_FIFO_FULL_BIT ((uint8_t)( 1 << 6 ))
151#define STMPE811_FIFO_OFLOW_BIT ((uint8_t)( 1 << 7 ))
159#define STMPE811_TSC_CTRL_ENABLE ((uint8_t)( 1 ))
160#define STMPE811_TSC_CTRL_OP_MOD_XYZ ((uint8_t)( 0 ))
161#define STMPE811_TSC_CTRL_OP_MOD_XY ((uint8_t)( 1 << 1 ))
162#define STMPE811_TSC_CTRL_OP_MOD_X ((uint8_t)( 2 << 1 ))
163#define STMPE811_TSC_CTRL_OP_MOD_Y ((uint8_t)( 3 << 1 ))
164#define STMPE811_TSC_CTRL_OP_MOD_Z ((uint8_t)( 4 << 1 ))
165#define STMPE811_TSC_CTRL_STA_BIT ((uint8_t)( 1 << 7 ))
173#define STMPE811_INT_CTRL_GLOBAL_INT_BIT ((uint8_t)( 1 ))
174#define STMPE811_INT_CTRL_INT_TYPE_BIT ((uint8_t)( 1 << 1 ))
175#define STMPE811_INT_CTRL_INT_POLARITY_BIT ((uint8_t)( 1 << 2 ))
183#define STMPE811_SYS_CTRL2_ADC_OFF_BIT ((uint8_t)( 1 ))
184#define STMPE811_SYS_CTRL2_TSC_OFF_BIT ((uint8_t)( 1 << 1 ))
185#define STMPE811_SYS_CTRL2_GPIO_OFF_BIT ((uint8_t)( 1 << 2 ))
186#define STMPE811_SYS_CTRL2_TS_OFF_BIT ((uint8_t)( 1 << 3 ))
194#define STMPE811_INT_GPIO ((uint8_t)( 1 << 7 ))
195#define STMPE811_INT_ADC ((uint8_t)( 1 << 6 ))
196#define STMPE811_INT_TEMP_SENS ((uint8_t)( 1 << 5 ))
197#define STMPE811_INT_FIFO_EMPTY ((uint8_t)( 1 << 4 ))
198#define STMPE811_INT_FIFO_FULL ((uint8_t)( 1 << 3 ))
199#define STMPE811_INT_FIFO_OFLOW ((uint8_t)( 1 << 2 ))
200#define STMPE811_INT_FIFO_TH ((uint8_t)( 1 << 1 ))
201#define STMPE811_INT_TOUCH_DET ((uint8_t)( 1 ))
202#define STMPE811_INT_ALL ((uint8_t)( 0xff ))
210#define STMPE811_ADC_CTRL2_ADC_FREQ_1_625_MHz ((uint8_t)( 0 ))
211#define STMPE811_ADC_CTRL2_ADC_FREQ_3_25_MHz ((uint8_t)( 1 ))
212#define STMPE811_ADC_CTRL2_ADC_FREQ_6_5_MHz ((uint8_t)( 2 ))
213#define STMPE811_ADC_CTRL2_ADC_FREQ_6_5_MHz_ALT ((uint8_t)( 3 ))
221#define STMPE811_ADC_CTRL1_SAMPLE_TIME_36 ((uint8_t)( 0 ))
222#define STMPE811_ADC_CTRL1_SAMPLE_TIME_44 ((uint8_t)( 1 << 4 ))
223#define STMPE811_ADC_CTRL1_SAMPLE_TIME_56 ((uint8_t)( 2 << 4 ))
224#define STMPE811_ADC_CTRL1_SAMPLE_TIME_64 ((uint8_t)( 3 << 4 ))
225#define STMPE811_ADC_CTRL1_SAMPLE_TIME_80 ((uint8_t)( 4 << 4 ))
226#define STMPE811_ADC_CTRL1_SAMPLE_TIME_96 ((uint8_t)( 5 << 4 ))
227#define STMPE811_ADC_CTRL1_SAMPLE_TIME_124 ((uint8_t)( 6 << 4 ))
228#define STMPE811_ADC_CTRL1_MOD_12B ((uint8_t)( 1 << 3 ))
229#define STMPE811_ADC_CTRL1_REF_SEL_EXTERNAL ((uint8_t)( 1 << 1 ))
230#define STMPE811_ADC_CTRL1_REF_SEL_INTERNAL ((uint8_t)( 0 ))
238#define STMPE811_TSC_CFG_SETTLING_10us ((uint8_t)( 0 ))
239#define STMPE811_TSC_CFG_SETTLING_100us ((uint8_t)( 1 ))
240#define STMPE811_TSC_CFG_SETTLING_500us ((uint8_t)( 2 ))
241#define STMPE811_TSC_CFG_SETTLING_1ms ((uint8_t)( 3 ))
242#define STMPE811_TSC_CFG_SETTLING_5ms ((uint8_t)( 4 ))
243#define STMPE811_TSC_CFG_SETTLING_10ms ((uint8_t)( 5 ))
244#define STMPE811_TSC_CFG_SETTLING_50ms ((uint8_t)( 6 ))
245#define STMPE811_TSC_CFG_SETTLING_100ms ((uint8_t)( 7 ))
246#define STMPE811_TSC_CFG_TOUCH_DET_DELAY_10us ((uint8_t)( 0 ))
247#define STMPE811_TSC_CFG_TOUCH_DET_DELAY_100us ((uint8_t)( 1 << 3 ))
248#define STMPE811_TSC_CFG_TOUCH_DET_DELAY_500us ((uint8_t)( 2 << 3 ))
249#define STMPE811_TSC_CFG_TOUCH_DET_DELAY_1ms ((uint8_t)( 3 << 3 ))
250#define STMPE811_TSC_CFG_TOUCH_DET_DELAY_5ms ((uint8_t)( 4 << 3 ))
251#define STMPE811_TSC_CFG_TOUCH_DET_DELAY_10ms ((uint8_t)( 5 << 3 ))
252#define STMPE811_TSC_CFG_TOUCH_DET_DELAY_50ms ((uint8_t)( 6 << 3 ))
253#define STMPE811_TSC_CFG_TOUCH_DET_DELAY_100ms ((uint8_t)( 7 << 3 ))
254#define STMPE811_TSC_CFG_AVE_CTRL_1_SAMPLE ((uint8_t)( 0 ))
255#define STMPE811_TSC_CFG_AVE_CTRL_2_SAMPLES ((uint8_t)( 1 << 6 ))
256#define STMPE811_TSC_CFG_AVE_CTRL_4_SAMPLES ((uint8_t)( 2 << 6 ))
257#define STMPE811_TSC_CFG_AVE_CTRL_8_SAMPLES ((uint8_t)( 3 << 6 ))
API for Digital input driver.
API for I2C master driver.
Pin and port name type definitions.
hal_pin_name_t pin_name_t
Definition drv_name.h:74
void stmpe811_gesture(stmpe811_t *ctx, tp_event_t *event)
Read gesture information.
void stmpe811_press_coordinates(stmpe811_t *ctx, tp_touch_item_t *touch_item)
Copies touch information from context object to touch item object.
uint8_t stmpe811_generic_read_byte(stmpe811_t *ctx, uint8_t reg_addr)
Reads a single byte from a register.
void stmpe811_set_calibration_data(stmpe811_t *ctx, const stmpe811_calibration_data_t *cdata)
Utility funciton used for setting calibration data.
void stmpe811_calibrate(stmpe811_t *ctx)
Calibrates variables used for converting raw stmpe811 ADC values to pixel coordinates.
void stmpe811_generic_read(stmpe811_t *ctx, uint8_t reg_addr, uint8_t *buff, uint8_t len)
Reads desired number of bytes from register to a buffer.
const stmpe811_calibration_data_t STMPE811_DEFAULT_CALIBRATION_DATA
Default calibration data specific for MikroE resistive tft boards.
tp_err_t stmpe811_init(stmpe811_t *ctx, stmpe811_cfg_t *cfg, tp_drv_t *drv)
STMPE811 Initialization Function.
void stmpe811_get_calibration_data(stmpe811_t *ctx, stmpe811_calibration_data_t *cdata)
Utility funciton used for getting a copy of current calibration data.
void stmpe811_default_cfg(stmpe811_t *ctx)
STMPE811 Default Configuration Function.
void stmpe811_read_xyz_raw(stmpe811_t *ctx, uint16_t *x, uint16_t *y, uint16_t *z)
Utility funciton used for calibration.
void stmpe811_cfg_setup(stmpe811_cfg_t *cfg)
STMPE811 configuration object setup function.
tp_err_t stmpe811_process(stmpe811_t *ctx)
Function processing events.
void stmpe811_generic_write_byte(stmpe811_t *ctx, uint8_t reg_addr, uint8_t val)
Writes a single byte to a register.
void stmpe811_read_xyz(stmpe811_t *ctx, uint16_t *x, uint16_t *y, uint16_t *z)
Reads x & y coordinate values to x, y, z addresses.
tp_event_t stmpe811_press_detect(stmpe811_t *ctx)
Press detection function.
void stmpe811_generic_write(stmpe811_t *ctx, uint8_t reg_addr, uint8_t *buff, uint8_t len)
Writes desired number of bytes from buffer to a register.
Digital input driver context structure, consisted of the following fields :
Definition drv_digital_in.h:73
I2C Master initialization configuration structure, consisted of the following fields :
Definition drv_i2c_master.h:97
I2C Master driver context structure, consisted of the following fields :
Definition drv_i2c_master.h:121
Calibration data structure.
Definition stmpe811.h:264
uint16_t min_y
Definition stmpe811.h:270
uint16_t max_x
Definition stmpe811.h:268
uint16_t min_x
Definition stmpe811.h:266
STMPE811 Configuration Object.
Definition stmpe811.h:286
uint16_t height
Definition stmpe811.h:292
uint16_t width
Definition stmpe811.h:291
pin_name_t int_pin
Definition stmpe811.h:287
i2c_master_config_t i2c_cfg
Definition stmpe811.h:289
uint8_t press_threshold
Definition stmpe811.h:296
uint8_t addr_sel
Definition stmpe811.h:294
STMPE811 Context Object.
Definition stmpe811.h:306
tp_touch_item_t touch
Definition stmpe811.h:312
uint16_t height
Definition stmpe811.h:318
uint16_t width
Definition stmpe811.h:317
tp_event_t gesture
Definition stmpe811.h:313
digital_in_t int_pin
Definition stmpe811.h:309
bool pen_down
Definition stmpe811.h:315
uint8_t press_threshold
Definition stmpe811.h:320
i2c_master_t i2c
Definition stmpe811.h:307
tp_event_t press_det
Definition stmpe811.h:311
Touch Panel Driver Interface Items.
Definition tp.h:199
Touch Item Definition.
Definition tp.h:151
tp_event_t
Touch Panel Event Code Definition.
Definition tp.h:81
tp_err_t
Touch Panel Error Code Definition.
Definition tp.h:65