90#define TSC2003_I2C_SLAVE_ADDR_FIXED (0x48)
91#define TSC2003_I2C_SLAVE_ADDR_A0 (0x1)
92#define TSC2003_I2C_SLAVE_ADDR_A1 (0x2)
93#define TSC2003_I2C_SLAVE_ADDR_0 (TSC2003_I2C_SLAVE_ADDR_FIXED)
94#define TSC2003_I2C_SLAVE_ADDR_1 (TSC2003_I2C_SLAVE_ADDR_FIXED | \
95 TSC2003_I2C_SLAVE_ADDR_A0)
96#define TSC2003_I2C_SLAVE_ADDR_2 (TSC2003_I2C_SLAVE_ADDR_FIXED | \
97 TSC2003_I2C_SLAVE_ADDR_A1)
98#define TSC2003_I2C_SLAVE_ADDR_3 (TSC2003_I2C_SLAVE_ADDR_FIXED | \
99 TSC2003_I2C_SLAVE_ADDR_A0 | \
100 TSC2003_I2C_SLAVE_ADDR_A1)
101#ifdef TSC2003_I2C_SLAVE_ADDR_DB
102#define TSC2003_I2C_SLAVE_ADDR_DEFAULT (TSC2003_I2C_SLAVE_ADDR_DB)
104#define TSC2003_I2C_SLAVE_ADDR_DEFAULT (TSC2003_I2C_SLAVE_ADDR_3)
112#define configureData(c,pd,m) ((c<<4)|(pd<<2)|(m<<1))
118#define TSC2003_MAP_PINS( cfg ) \
119 cfg.i2c_cfg.scl = CTP_SCL; \
120 cfg.i2c_cfg.sda = CTP_SDA; \
121 cfg.int_pin = CTP_INT
API for Digital input driver.
API for Digital output driver.
API for I2C master driver.
Pin and port name type definitions.
hal_pin_name_t pin_name_t
Definition drv_name.h:74
tsc2003_bits_pd
Definition tsc2003.h:162
@ tsc2003_bits_pd_int_ref_on_adc_off
Definition tsc2003.h:165
@ tsc2003_bits_pd_int_ref_on_adc_on
Definition tsc2003.h:166
@ tsc2003_bits_pd_power_down_between_conversion
Definition tsc2003.h:163
@ tsc2003_bits_pd_int_ref_off_adc_on
Definition tsc2003.h:164
tsc2003_bits_cfg
Definition tsc2003.h:134
@ tsc2003_bits_cfg_measure_activate_drivers_y
Definition tsc2003.h:142
@ tsc2003_bits_cfg_measure_position_z1
Definition tsc2003.h:146
@ tsc2003_bits_cfg_measure_in2
Definition tsc2003.h:140
@ tsc2003_bits_cfg_measure_temp0
Definition tsc2003.h:135
@ tsc2003_bits_cfg_measure_position_z2
Definition tsc2003.h:147
@ tsc2003_bits_cfg_measure_vbat1
Definition tsc2003.h:136
@ tsc2003_bits_cfg_measure_position_x
Definition tsc2003.h:144
@ tsc2003_bits_cfg_measure_activate_drivers_x
Definition tsc2003.h:141
@ tsc2003_bits_cfg_measure_temp1
Definition tsc2003.h:138
@ tsc2003_bits_cfg_measure_in1
Definition tsc2003.h:137
@ tsc2003_bits_cfg_measure_activate_drivers_x_y
Definition tsc2003.h:143
@ tsc2003_bits_cfg_measure_vbat2
Definition tsc2003.h:139
@ tsc2003_bits_cfg_measure_position_y
Definition tsc2003.h:145
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
Touch Panel Driver Interface Items.
Definition tp.h:199
Touch Item Definition.
Definition tp.h:151
Calibration data structure.
Definition tsc2003.h:191
uint16_t min_y
Definition tsc2003.h:197
uint16_t max_x
Definition tsc2003.h:195
uint16_t min_x
Definition tsc2003.h:193
TSC2003 Configuration Object.
Definition tsc2003.h:221
uint16_t height
Definition tsc2003.h:227
tsc2003_bits_pd power_down
Definition tsc2003.h:232
tsc2003_bits_m resolution
Definition tsc2003.h:231
uint16_t width
Definition tsc2003.h:226
pin_name_t int_pin
Definition tsc2003.h:222
uint8_t addr_sel
Definition tsc2003.h:229
i2c_master_config_t i2c_cfg
Definition tsc2003.h:224
Press intensity needed to register touch event.
Definition tsc2003.h:205
uint16_t tsc2003_pressure_threshold_upper
Definition tsc2003.h:207
uint16_t tsc2003_pressure_threshold_lower
Definition tsc2003.h:206
TSC2003 Context Object.
Definition tsc2003.h:245
tsc2003_pressure_threshold_t pressure_threshold_level
Definition tsc2003.h:263
digital_in_t int_pin
Definition tsc2003.h:246
tp_event_t gesture
Definition tsc2003.h:255
i2c_master_t i2c
Definition tsc2003.h:248
tsc2003_bits_m resolution
Definition tsc2003.h:259
bool pen_down
Definition tsc2003.h:257
uint16_t height
Definition tsc2003.h:251
tsc2003_bits_pd power_down
Definition tsc2003.h:260
uint16_t width
Definition tsc2003.h:250
tp_event_t press_det
Definition tsc2003.h:253
tp_touch_item_t touch
Definition tsc2003.h:254
tp_event_t
Touch Panel Event Code Definition.
Definition tp.h:81
tp_err_t
Touch Panel Error Code Definition.
Definition tp.h:65
const tsc2003_calibration_data_t TSC2003_CALIBRATION_DATA_DEFAULT
Default calibration data specific for MikroE resistive tft boards.
tp_err_t tsc2003_process(tsc2003_t *ctx)
Function processing events.
tsc2003_bits_m
Definition tsc2003.h:181
@ tsc2003_bits_m_8bit
Definition tsc2003.h:183
@ tsc2003_bits_m_12bit
Definition tsc2003.h:182
tp_event_t tsc2003_press_detect(tsc2003_t *ctx)
Press detection function.
void tsc2003_press_coordinates(tsc2003_t *ctx, tp_touch_item_t *touch_item)
Copies touch information from context object to touch item object.
void tsc2003_cfg_setup(tsc2003_cfg_t *cfg)
TSC2003 configuration object setup function.
void tsc2003_get_calibration_data(tsc2003_t *ctx, tsc2003_calibration_data_t *cdata)
Utility funciton used for getting a copy of current calibration data.
void tsc2003_gesture(tsc2003_t *ctx, tp_event_t *event)
Read gesture information.
void tsc2003_set_pressure_threshold_level(tsc2003_cfg_t *cfg, tsc2003_pressure_threshold_t pressure)
Utility funciton used for setting threshold levels.
void tsc2003_write_cmd(tsc2003_t *ctx, uint8_t reg_addr)
Writes a generic command to the IC.
void tsc2003_set_calibration_data(tsc2003_t *ctx, const tsc2003_calibration_data_t *cdata)
Utility funciton used for setting calibration data.
void tsc2003_calibrate(tsc2003_t *ctx)
Calibrates variables used for converting raw TSC2003 ADC values to pixel coordinates.
void tsc2003_default_cfg(tsc2003_t *ctx)
TSC2003 Default Configuration Function.
void tsc2003_generic_read(tsc2003_t *ctx, uint8_t reg_addr, uint8_t *data_buff, uint8_t len)
Reads a number of bytes from a register.
tp_err_t tsc2003_init(tsc2003_t *ctx, tsc2003_cfg_t *cfg, tp_drv_t *drv)
TSC2003 Initialization Function.