Microchip® Advanced Software Framework

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TOUCH - QT60168 16-key QMatrix touch sensor

This driver offers configuration as well as checking the status of the touch sensor.

The driver uses the TWI to communicate with the sensor and GPIO as a status change input from the sensor. It is possible to add a callback function from the application and this will be executed each time a change has been detected in the sensor state.

Data Structures

struct  qt60168_key_cfg_t
 
struct  qt60168_setups_block_t
 

Macros

#define QT60168_CMD_CAL_ALL   0x03
 
#define QT60168_CMD_CAL_KEY_K   0xC0
 
#define QT60168_CMD_DATA_FOR_1_KEY   0x40
 
#define QT60168_CMD_DUMP_SETUPS   0x0D
 
#define QT60168_CMD_EEPROM_CRC   0x0E
 
#define QT60168_CMD_ENTER_SETUPS_MODE   0x01
 
#define QT60168_CMD_ERROR_FLAGS_FOR_ALL   0x0B
 
#define QT60168_CMD_FMEA_STATUS   0x0C
 
#define QT60168_CMD_FORCE_RESET   0x04
 
#define QT60168_CMD_GENERAL_STATUS   0x05
 
#define QT60168_CMD_INTERNAL_CODE_0X10   0x10
 
#define QT60168_CMD_INTERNAL_CODE_0X12   0x12
 
#define QT60168_CMD_NULL_COMMAND   0x00
 
#define QT60168_CMD_REPORT_1ST_KEY   0x06
 
#define QT60168_CMD_REPORT_ALL_KEYS   0x07
 
#define QT60168_CMD_RETURN_LAST_CMMD   0x0F
 
#define QT60168_CMD_STATUS_FOR_KEY_K   0x80
 
#define QT60168_KEY_STATUS_CAL_FAILED   0x01
 
#define QT60168_KEY_STATUS_DETECTED   0x08
 
#define QT60168_KEY_STATUS_ENABLED   0x10
 
#define QT60168_KEY_STATUS_IN_CAL   0x02
 
#define QT60168_KEY_STATUS_LOW_SIGNAL   0x04
 
#define QT60168_MAX_NUMBER_OF_KEYS   24
 
#define QT60168_REPLY_ENTER_SETUPS_MODE   0xFE
 
#define QT60168_REPLY_FORCE_RESET   0xFB
 
#define QT60168_STATUS_CALIBRATION_FAILED_MASK   0x04
 
#define QT60168_STATUS_COMM_ERROR_MASK   0x40
 
#define QT60168_STATUS_FMEA_ERROR_MASK   0x20
 
#define QT60168_STATUS_KEY_DETECTED_MASK   0x01
 
#define QT60168_STATUS_KEY_IN_CALIBRATION_MASK   0x02
 
#define QT60168_STATUS_MAIN_SYNC_ERROR_MASK   0x08
 

Functions

void qt60168_get_reply (unsigned short *data)
 Get the QT60168 reply. More...
 
void qt60168_init (U32 cpu_hz)
 Initialize the QT60168 component. More...
 
bool qt60168_is_key_pressed (U8 key)
 Test if no keys are pressed. More...
 
bool qt60168_is_no_key_pressed (void)
 Test if no keys are pressed. More...
 
int qt60168_report_all_key (void)
 Report all key status. More...
 
void qt60168_send_cmd (unsigned char cmd)
 Send a command to the QT60168. More...
 

#define QT60168_CMD_CAL_ALL   0x03

Referenced by qt60168_init().

#define QT60168_CMD_CAL_KEY_K   0xC0
#define QT60168_CMD_DATA_FOR_1_KEY   0x40
#define QT60168_CMD_DUMP_SETUPS   0x0D
#define QT60168_CMD_EEPROM_CRC   0x0E

Referenced by qt60168_init().

#define QT60168_CMD_ENTER_SETUPS_MODE   0x01

Referenced by qt60168_setup().

#define QT60168_CMD_ERROR_FLAGS_FOR_ALL   0x0B
#define QT60168_CMD_FMEA_STATUS   0x0C
#define QT60168_CMD_FORCE_RESET   0x04

Referenced by qt60168_init().

#define QT60168_CMD_GENERAL_STATUS   0x05

Referenced by qt60168_init().

#define QT60168_CMD_INTERNAL_CODE_0X10   0x10
#define QT60168_CMD_INTERNAL_CODE_0X12   0x12
#define QT60168_CMD_NULL_COMMAND   0x00

Referenced by qt60168_get_reply().

#define QT60168_CMD_REPORT_1ST_KEY   0x06
#define QT60168_CMD_REPORT_ALL_KEYS   0x07

Referenced by qt60168_report_all_key().

#define QT60168_CMD_RETURN_LAST_CMMD   0x0F
#define QT60168_CMD_STATUS_FOR_KEY_K   0x80

Referenced by qt60168_is_key_pressed().

#define QT60168_KEY_STATUS_CAL_FAILED   0x01
#define QT60168_KEY_STATUS_DETECTED   0x08

Referenced by qt60168_is_key_pressed().

#define QT60168_KEY_STATUS_ENABLED   0x10
#define QT60168_KEY_STATUS_IN_CAL   0x02
#define QT60168_KEY_STATUS_LOW_SIGNAL   0x04
#define QT60168_MAX_NUMBER_OF_KEYS   24

Referenced by qt60168_setup().

#define QT60168_REPLY_ENTER_SETUPS_MODE   0xFE

Referenced by qt60168_setup().

#define QT60168_REPLY_FORCE_RESET   0xFB

Referenced by qt60168_init().

#define QT60168_STATUS_CALIBRATION_FAILED_MASK   0x04
#define QT60168_STATUS_COMM_ERROR_MASK   0x40
#define QT60168_STATUS_FMEA_ERROR_MASK   0x20
#define QT60168_STATUS_KEY_DETECTED_MASK   0x01
#define QT60168_STATUS_KEY_IN_CALIBRATION_MASK   0x02

Referenced by qt60168_init().

#define QT60168_STATUS_MAIN_SYNC_ERROR_MASK   0x08

void qt60168_get_reply ( unsigned short *  data)
void qt60168_init ( U32  cpu_hz)
bool qt60168_is_key_pressed ( U8  key)

Test if no keys are pressed.

Parameters
keyKey id that will be tested.
Return values
trueThat key is pressed.
falseThat key is not pressed.

References QT60168_CMD_STATUS_FOR_KEY_K, qt60168_get_reply(), QT60168_KEY_STATUS_DETECTED, and qt60168_send_cmd().

bool qt60168_is_no_key_pressed ( void  )

Test if no keys are pressed.

Return values
trueNo key pressed (idle).
falseOne or more keys are pressed.

References QT60168_CMD_REPORT_1ST_KEY, qt60168_get_reply(), and qt60168_send_cmd().

int qt60168_report_all_key ( void  )

Report all key status.

Return values
intwhere : bit0 is key 0 bit1 is key 1 bit2 is key 2 ..... ... .. bit23 is key 23

References QT60168_CMD_REPORT_ALL_KEYS, qt60168_get_reply(), and qt60168_send_cmd().

void qt60168_send_cmd ( unsigned char  cmd)