TSC2003 Touch Controller Driver API Reference.
More...
|
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...
|
|
API for configuring and manipulating TSC2003 Touch Controller driver.
◆ tsc2003_cfg_setup()
This function initializes TSC2003 configuration structure to default values. Interupt pin will be set to unconnected, screen dimenstion will be set to 0, press threshold will be set to default defined values.
- Parameters
-
[out] | cfg | TSC2003 configuration object. |
- Returns
- Nothing.
◆ tsc2003_init()
This function initializes TSC2003 context object using configuration values from TSC2003 configuration object and allows touch panel driver interface object to be linked with TSC2003 driver functions.
- Note
- By default, TSC2003 stucture is initialized with calibration constants for MikroE harware, in case of different hardware tsc2003_set_calibration_data is available for seting already determined calibration constants and tsc2003_calibrate is available for determinig new calibraiton constants.
- Parameters
-
[in] | ctx | Initialized TSC2003 context structure. See tsc2003_t for more information about the context structure. |
[in] | cfg | TSC2003 configuration object. See tsc2003_cfg_t structure definition for detailed explanation. |
[out] | drv | TP driver interface object. See tp_drv_t structure definition for detailed explanation. |
- Returns
TP_OK
OK,
TP_ERR_INIT_DRV
I2C driver init error,
TP_ERR_UNSUPPORTED_PIN
Unsupported pin. See tp_err_t structure definition for detailed explanation.
◆ tsc2003_default_cfg()
Configures the device by powering the module down initially.
- Parameters
-
[in] | ctx | Initialized TSC2003 context structure. See tsc2003_t for more information about the context structure. |
- Returns
- Nothing.
◆ tsc2003_press_coordinates()
This function is necessary for interfacing with touch panel library as it's address is stored in tp_drv_t driver structure during the TSC2003 context initialization.
- Parameters
-
[in] | ctx | Initialized TSC2003 context structure. See tsc2003_t for more information about the context structure. |
[out] | touch_item | |
- Returns
- Nothing.
◆ tsc2003_press_detect()
Retrives information about press detection from TSC2003.
- Note
- This function is necessary for interfacing with touch panel library as its address is stored in tp_drv_t driver structure during the TSC2003 context initialization.
- Parameters
-
[in] | ctx | Initialized TSC2003 context structure. See tsc2003_t for more information about the context structure. |
- Returns
TP_EVENT_PRESS_NOT_DET
- Touch pressure is not detected.
TP_EVENT_PRESS_DET
- Touch pressure is detected. See tp_err_t structure definition for detailed explanation.
◆ tsc2003_process()
This function checks if touch was detected and if it was, reads and stores touch information in context structure and checks if it's touch down or up.
- Note
- This function is necessary for interfacing with touch panel library as its address is stored in tp_drv_t driver structure during the TSC2003 context initialization.
- Parameters
-
[in] | ctx | Initialized TSC2003 context structure. See tsc2003_t for more information about the context structure. |
- Returns
- Always returns TP_OK. see tp_err_t for more details.
◆ tsc2003_gesture()
Since TSC2003 does not support gestures this function is purely for interfacing with the tp library. Gesture returned from the function is always no gesture.
- Parameters
-
[in] | ctx | Initialized TSC2003 context structure. See tsc2003_t for more information about the context structure. |
- Note
- This function is necessary for interfacing with touch panel library as it's address is stored in tp_drv_t driver structure during the TSC2003 context initialization.
- Parameters
-
[out] | event | Touch panel gesture data, always TP_EVENT_GEST_NONE . See tp_event_t * definition for detailed explanation. |
- Returns
- Nothing.
◆ tsc2003_write_cmd()
void tsc2003_write_cmd |
( |
tsc2003_t * |
ctx, |
|
|
uint8_t |
reg_addr |
|
) |
| |
This function provides easy write access to the TSC2003 IC.
- Parameters
-
[in] | ctx | Initialized TSC2003 context structure. See tsc2003_t for more information about the context structure. |
[in] | reg_addr | Register address with adequate configuration. |
- Returns
- Nothing.
- Note
- Register address is defined as follows: | C3 | C2 | C1 | C0 | PD1 | PD0 | M | X |
Where:
The formatted address will be ((Cx<<4) | (PDx<<2) | (M<<1)).
◆ tsc2003_generic_read()
void tsc2003_generic_read |
( |
tsc2003_t * |
ctx, |
|
|
uint8_t |
reg_addr, |
|
|
uint8_t * |
data_buff, |
|
|
uint8_t |
len |
|
) |
| |
This function provides easy read from a TSC2003 register.
- Parameters
-
[in] | ctx | Initialized TSC2003 context structure. See tsc2003_t for more information about the context structure. |
[in] | reg_addr | Register address from which single byte will be read. |
[out] | data_buff | Buffer for returning read data from IC. |
[in] | len | Number of data to read from the IC. |
- Returns
- Nothing.
- Note
- Register address is defined as follows: | C3 | C2 | C1 | C0 | PD1 | PD0 | M | X |
Where:
The formatted address will be ((Cx<<4) | (PDx<<2) | (M<<1)).
◆ tsc2003_calibrate()
Function nees the user to touch all four corners as close to the edges as possible to find the extreme values. Function also supports holding a pen and moving it across the screen and will use the most extreme coordinates found during that move as corner coordinates, so touching a screen and draging a finger over the one of the four edges unitl touch is no longer detected will give pretty good calibration data.
- Parameters
-
[in] | ctx | Initialized TSC2003 context structure. See tsc2003_t for more information about the context structure. |
- Returns
- Nothing.
◆ tsc2003_get_calibration_data()
Function copies data that's being e used for converting raw ADC values to actual pixel coordinates.
- Parameters
-
[in] | ctx | Initialized TSC2003 context structure. See tsc2003_t for more |
[out] | cdata | Pointer to memory where calibration data will be stored. |
- Returns
- Nothing.
◆ tsc2003_set_calibration_data()
Function copies data stored in cdata
. That information will be be used for converting raw ADC values to actual pixel coordinates.
- Parameters
-
[in] | ctx | Initialized TSC2003 context structure. See tsc2003_t for more information about the context structure. |
[out] | cdata | Pointer to memory from where new calibration will be copied and set. |
- Returns
- Nothing.
◆ tsc2003_set_pressure_threshold_level()
Function copies data stored in pressure
. That information will be be used for checking if adquate pressure has been applied to the screen.
- Parameters
-
[out] | cfg | Initialized TSC2003 context structure. See tsc2003_t for more |
[in] | pressure | Structure with desired threshold levels set. See tsc2003_pressure_threshold_t for more information about the structure. |
- Returns
- Nothing.