mikroSDK Reference Manual
tsc2003.h File Reference

Go to the source code of this file.

Data Structures

struct  tsc2003_calibration_data_t
 Calibration data structure. More...
 
struct  tsc2003_pressure_threshold_t
 Press intensity needed to register touch event. More...
 
struct  tsc2003_cfg_t
 TSC2003 Configuration Object. More...
 
struct  tsc2003_t
 TSC2003 Context Object. More...
 

Macros

#define configureData(c, pd, m)   ((c<<4)|(pd<<2)|(m<<1))
 Command byte representation: More...
 
#define TSC2003_I2C_SLAVE_ADDR_FIXED   (0x48)
 TSC2003 Touch Controller Fixed Slave Addreses. More...
 
#define TSC2003_I2C_SLAVE_ADDR_A0   (0x1)
 TSC2003 Touch Controller Slave Address A0. More...
 
#define TSC2003_I2C_SLAVE_ADDR_A1   (0x2)
 TSC2003 Touch Controller Slave Address A1. More...
 
#define TSC2003_I2C_SLAVE_ADDR_0   (TSC2003_I2C_SLAVE_ADDR_FIXED)
 TSC2003 Touch Controller Slave Address 0. More...
 
#define TSC2003_I2C_SLAVE_ADDR_1
 TSC2003 Touch Controller Slave Address 1. More...
 
#define TSC2003_I2C_SLAVE_ADDR_2
 TSC2003 Touch Controller Slave Address 2. More...
 
#define TSC2003_I2C_SLAVE_ADDR_3
 TSC2003 Touch Controller Slave Address 3. More...
 
#define TSC2003_I2C_SLAVE_ADDR_DEFAULT   (TSC2003_I2C_SLAVE_ADDR_3)
 TSC2003 Touch Controller Default Address. More...
 
#define TSC2003_MAP_PINS(cfg)
 This macro defines I2C pins used by the TSC2003 touch controller. More...
 

Enumerations

enum  tsc2003_bits_cfg
 TSC2003 Configuration. More...
 
enum  tsc2003_bits_pd
 TSC2003 Power Down Setting. More...
 
enum  tsc2003_bits_m
 TSC2003 Mode. More...
 

Functions

void tsc2003_cfg_setup (tsc2003_cfg_t *cfg)
 TSC2003 configuration object setup function. More...
 
tp_err_t tsc2003_init (tsc2003_t *ctx, tsc2003_cfg_t *cfg, tp_drv_t *drv)
 TSC2003 Initialization Function. More...
 
void tsc2003_default_cfg (tsc2003_t *ctx)
 TSC2003 Default Configuration Function. More...
 
void tsc2003_press_coordinates (tsc2003_t *ctx, tp_touch_item_t *touch_item)
 Copies touch information from context object to touch item object. More...
 
tp_event_t tsc2003_press_detect (tsc2003_t *ctx)
 Press detection function. More...
 
tp_err_t tsc2003_process (tsc2003_t *ctx)
 Function processing events. More...
 
void tsc2003_gesture (tsc2003_t *ctx, tp_event_t *event)
 Read gesture information. More...
 
void tsc2003_write_cmd (tsc2003_t *ctx, uint8_t reg_addr)
 Writes a generic command to the IC. More...
 
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. More...
 
void tsc2003_calibrate (tsc2003_t *ctx)
 Calibrates variables used for converting raw TSC2003 ADC values to pixel coordinates. More...
 
void tsc2003_get_calibration_data (tsc2003_t *ctx, tsc2003_calibration_data_t *cdata)
 Utility funciton used for getting a copy of current calibration data. More...
 
void tsc2003_set_calibration_data (tsc2003_t *ctx, const tsc2003_calibration_data_t *cdata)
 Utility funciton used for setting calibration data. More...
 
void tsc2003_set_pressure_threshold_level (tsc2003_cfg_t *cfg, tsc2003_pressure_threshold_t pressure)
 Utility funciton used for setting threshold levels. More...
 

Variables

const tsc2003_calibration_data_t TSC2003_CALIBRATION_DATA_DEFAULT
 Default calibration data specific for MikroE resistive tft boards. More...
 

Macro Definition Documentation

◆ configureData

#define configureData (   c,
  pd,
 
)    ((c<<4)|(pd<<2)|(m<<1))

| C3 | C2 | C1 | C0 | PD1 | PD0 | M | X |

Where:
Cx represents config bits;
PDx represents power down mode;
M represents ADC resolution;
X is not important ( Don't care );

TSC2003 Macro used to configure data byte.

TSC2003 Macro used to configure data byte.

Enumeration Type Documentation

◆ tsc2003_bits_cfg

TSC2003 Configuration, higher nibble <7:4> used for operand values .

| C3 | C2 | C1 | C0 |

Note
Shifted to higher nibble in library.
Enumerator
tsc2003_bits_cfg_measure_temp0 

Measure ambient temperature method 1.

tsc2003_bits_cfg_measure_vbat1 

Measure main battery voltage.

tsc2003_bits_cfg_measure_in1 

Measure auxiliary input 1.

tsc2003_bits_cfg_measure_temp1 

Measure ambient temperature method 2.

tsc2003_bits_cfg_measure_vbat2 

Measure secondary battery voltage.

tsc2003_bits_cfg_measure_in2 

Measure auxiliary input 2.

tsc2003_bits_cfg_measure_activate_drivers_x 

Activate X- drivers.

tsc2003_bits_cfg_measure_activate_drivers_y 

Activate Y- drivers.

tsc2003_bits_cfg_measure_activate_drivers_x_y 

Activate X-,Y+ plate drivers.

tsc2003_bits_cfg_measure_position_x 

measure X AD conversion.

tsc2003_bits_cfg_measure_position_y 

Measure Y AD conversion.

tsc2003_bits_cfg_measure_position_z1 

Measure Z1 AD conversion result.

tsc2003_bits_cfg_measure_position_z2 

measure Z2 AD conversion result.

◆ tsc2003_bits_pd

TSC2003 Power Down Setting, bits <3:2> used for values.

| PD1 | PD2 |

Note
Shifted to adequate position in library.
Enumerator
tsc2003_bits_pd_power_down_between_conversion 

Power-Down Between Conversions.

tsc2003_bits_pd_int_ref_off_adc_on 

Internal reference OFF, ADC ON.

tsc2003_bits_pd_int_ref_on_adc_off 

Internal reference ON, ADC OFF.

tsc2003_bits_pd_int_ref_on_adc_on 

Internal reference ON, ADC ON.

◆ tsc2003_bits_m

TSC2003 Mode, bit <1> used for value.

| M |

Note
Shifted to adequate position in library.
Enumerator
tsc2003_bits_m_12bit 

12-bit AD conversion mode.

tsc2003_bits_m_8bit 

8-bit AD conversion mode.

Variable Documentation

◆ TSC2003_CALIBRATION_DATA_DEFAULT

const tsc2003_calibration_data_t TSC2003_CALIBRATION_DATA_DEFAULT

Data useful for skipping calibration when working with MikroE hardware. Gives reasonable touch precision on any size resitive tft board.