mikroSDK Reference Manual
|
STMPE811 Touch Controller Driver API Reference. More...
Functions list | |
void | stmpe811_cfg_setup (stmpe811_cfg_t *cfg) |
STMPE811 configuration object setup function. More... | |
tp_err_t | stmpe811_init (stmpe811_t *ctx, stmpe811_cfg_t *cfg, tp_drv_t *drv) |
STMPE811 Initialization Function. More... | |
void | stmpe811_default_cfg (stmpe811_t *ctx) |
STMPE811 Default Configuration Function. More... | |
void | stmpe811_press_coordinates (stmpe811_t *ctx, tp_touch_item_t *touch_item) |
Copies touch information from context object to touch item object. More... | |
tp_event_t | stmpe811_press_detect (stmpe811_t *ctx) |
Press detection function. More... | |
tp_err_t | stmpe811_process (stmpe811_t *ctx) |
Function processing events. More... | |
void | stmpe811_gesture (stmpe811_t *ctx, tp_event_t *event) |
Read gesture information. More... | |
uint8_t | stmpe811_generic_read_byte (stmpe811_t *ctx, uint8_t reg_addr) |
Reads a single byte from a register. More... | |
void | stmpe811_generic_write_byte (stmpe811_t *ctx, uint8_t reg_addr, uint8_t val) |
Writes a single byte to a register. More... | |
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. More... | |
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. More... | |
void | stmpe811_calibrate (stmpe811_t *ctx) |
Calibrates variables used for converting raw stmpe811 ADC values to pixel coordinates. More... | |
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. More... | |
void | stmpe811_read_xyz_raw (stmpe811_t *ctx, uint16_t *x, uint16_t *y, uint16_t *z) |
Utility funciton used for calibration. More... | |
void | stmpe811_get_calibration_data (stmpe811_t *ctx, stmpe811_calibration_data_t *cdata) |
Utility funciton used for getting a copy of current calibration data. More... | |
void | stmpe811_set_calibration_data (stmpe811_t *ctx, const stmpe811_calibration_data_t *cdata) |
Utility funciton used for setting calibration data. More... | |
API for configuring and manipulating STMPE811 Touch Controller driver.
void stmpe811_cfg_setup | ( | stmpe811_cfg_t * | cfg | ) |
This function initializes STMPE811 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 0 and
[out] | cfg | STMPE811 configuration object. |
tp_err_t stmpe811_init | ( | stmpe811_t * | ctx, |
stmpe811_cfg_t * | cfg, | ||
tp_drv_t * | drv | ||
) |
This function initializes STMPE811 context object using configuration values from STMPE811 configuration object and allows touch panel driver interface object to be linked with STMPE811 driver functions.
[in] | ctx | Initialized STMPE811 context structure. See stmpe811_t for more information about the context structure. |
[in] | cfg | STMPE811 configuration object. See stmpe811_cfg_t structure definition for detailed explanation. |
[out] | drv | TP driver interface object. See tp_drv_t structure definition for detailed explanation. |
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. void stmpe811_default_cfg | ( | stmpe811_t * | ctx | ) |
Configures the device according to http://www.bdtic.com/download/ST/AN2807.pdf
[in] | ctx | Initialized STMPE811 context structure. See stmpe811_t for more information about the context structure. |
void stmpe811_press_coordinates | ( | stmpe811_t * | ctx, |
tp_touch_item_t * | touch_item | ||
) |
This function is necessary for interfacing with touch panel library as it's address is stored in tp_drv_t driver structure during the STMPE811 context initialization.
[in] | ctx | Initialized STMPE811 context structure. See stmpe811_t for more information about the context structure. |
[out] | touch_item |
tp_event_t stmpe811_press_detect | ( | stmpe811_t * | ctx | ) |
Retrives information about press detection from STMPE811.
[in] | ctx | Initialized STMPE811 context structure. See stmpe811_t for more information about the context structure. |
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. tp_err_t stmpe811_process | ( | stmpe811_t * | ctx | ) |
This function check if touch was detected and if it was reads and stores touch information in context structure and checks if it's touch down, up or move.
[in] | ctx | Initialized STMPE811 context structure. See stmpe811_t for more information about the context structure. |
void stmpe811_gesture | ( | stmpe811_t * | ctx, |
tp_event_t * | event | ||
) |
Since STMPE811 does not support gestures this function is purely for interfacing with the tp library. Gesture returned from the function is always no gesture.
[in] | ctx | Initialized STMPE811 context structure. See stmpe811_t for more information about the context structure. |
[out] | event | Touch panel gesture data, always TP_EVENT_GEST_NONE. See tp_event_t * definition for detailed explanation. |
uint8_t stmpe811_generic_read_byte | ( | stmpe811_t * | ctx, |
uint8_t | reg_addr | ||
) |
This function provides easy single byte read to a STMPE811 register since most of the registers are only 1 byte in size.
[in] | ctx | Initialized STMPE811 context structure. See stmpe811_t for more information about the context structure. |
[in] | reg_addr | Register address from which single byte will be read. See STMPE811 Registers for more information about register addresses. |
void stmpe811_generic_write_byte | ( | stmpe811_t * | ctx, |
uint8_t | reg_addr, | ||
uint8_t | val | ||
) |
This function provides easy single byte write to a STMPE811 register since most of the registers are only 1 byte in size.
[in] | ctx | Initialized STMPE811 context structure. See stmpe811_t for more information about the context structure. |
[in] | reg_addr | Register address where single byte will be written. See STMPE811 Registers for more information about register addresses. |
[in] | val | Value that will be written to register address. |
void stmpe811_generic_read | ( | stmpe811_t * | ctx, |
uint8_t | reg_addr, | ||
uint8_t * | buff, | ||
uint8_t | len | ||
) |
This function provides ability to read desired nubmer of bytes from a STMPE811 register. Usefull for the small amout of registers that are larger than one byte in size, such as TSC_DATA_XYZ and windowing parameters registers.
[in] | ctx | Initialized STMPE811 context structure. See stmpe811_t for more information about the context structure. |
[in] | reg_addr | Register address from where reading will start. |
[out] | buff | Buffer where read data will be stored. |
[in] | len | Length of data to be read. |
void stmpe811_generic_write | ( | stmpe811_t * | ctx, |
uint8_t | reg_addr, | ||
uint8_t * | buff, | ||
uint8_t | len | ||
) |
This function provides ability to read desired nubmer of bytes to a STMPE811 register. Usefull for the small amout of registers that are larger than one byte in size, such as TSC_DATA_XYZ and windowing parameters registers.
[in] | ctx | Initialized STMPE811 context structure. See stmpe811_t for more information about the context structure. |
[in] | reg_addr | Register address from where writing will start. |
[in] | buff | Data that will be written to register address. |
[in] | len | Length of data to be written. |
void stmpe811_calibrate | ( | stmpe811_t * | ctx | ) |
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.
[in] | ctx | Initialized STMPE811 context structure. See stmpe811_t for more information about the context structure. |
void stmpe811_read_xyz | ( | stmpe811_t * | ctx, |
uint16_t * | x, | ||
uint16_t * | y, | ||
uint16_t * | z | ||
) |
Reads coordinate date and converts x and y to appropriate pixel coordinates then clears the FIFO coordinate memory.
[in] | ctx | Initialized STMPE811 context structure. See stmpe811_t for more |
[out] | x | Pointer to memory where pixel x coordinate will be stored. |
[out] | y | Pointer to memory where pixel y coordinate will be stored. |
[out] | z | Pointer to memory where z value will be stored. |
void stmpe811_read_xyz_raw | ( | stmpe811_t * | ctx, |
uint16_t * | x, | ||
uint16_t * | y, | ||
uint16_t * | z | ||
) |
reads raw adc values of x,y and z without mapping them to screen coordinates then clears the FIFO coordinate memory.
[in] | ctx | Initialized STMPE811 context structure. See stmpe811_t for more |
[out] | x | Pointer to memory where raw x coordinate will be stored. |
[out] | y | Pointer to memory where raw y coordinate will be stored. |
[out] | z | Pointer to memory where z value will be stored. |
void stmpe811_get_calibration_data | ( | stmpe811_t * | ctx, |
stmpe811_calibration_data_t * | cdata | ||
) |
Function copies data that's being e used for converting raw ADC values to actual pixel coordinates.
[in] | ctx | Initialized STMPE811 context structure. See stmpe811_t for more |
[out] | cdata | Pointer to memory where calibration data will be stored. |
void stmpe811_set_calibration_data | ( | stmpe811_t * | ctx, |
const stmpe811_calibration_data_t * | cdata | ||
) |
Function copies data stored in data
. That information will be be used for converting raw ADC values to actual pixel coordinates.
[in] | ctx | Initialized STMPE811 context structure. See stmpe811_t for more |
[out] | cdata | Pointer to memory from where new calibration will be copied and set. |