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 |
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 |
Referenced by qt60168_is_no_key_pressed().
#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 | ) |
Get the QT60168 reply.
*data | The data to read |
References QT60168_CMD_NULL_COMMAND, qt60168_wait_cmd_received(), spi_read(), spi_selectChip(), spi_unselectChip(), and spi_write().
Referenced by qt60168_init(), qt60168_is_key_pressed(), qt60168_is_no_key_pressed(), qt60168_report_all_key(), and qt60168_setup().
void qt60168_init | ( | U32 | cpu_hz | ) |
Initialize the QT60168 component.
cpu_hz | The CPU frequency in hertz. |
References cpu_hz, g_cpu_hz, QT60168_CMD_CAL_ALL, QT60168_CMD_EEPROM_CRC, QT60168_CMD_FORCE_RESET, QT60168_CMD_GENERAL_STATUS, qt60168_get_reply(), QT60168_REPLY_FORCE_RESET, qt60168_send_cmd(), qt60168_setup(), and QT60168_STATUS_KEY_IN_CALIBRATION_MASK.
Test if no keys are pressed.
key | Key id that will be tested. |
true | That key is pressed. |
false | That 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.
true | No key pressed (idle). |
false | One 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.
int | where : 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 | ) |
Send a command to the QT60168.
cmd | Command |
References qt60168_wait_cmd_received(), spi_selectChip(), spi_unselectChip(), and spi_write().
Referenced by qt60168_init(), qt60168_is_key_pressed(), qt60168_is_no_key_pressed(), qt60168_report_all_key(), and qt60168_setup().