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.
#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 |
void qt60168_get_reply |
( |
unsigned short * |
data | ) |
|
Get the QT60168 reply.
- Parameters
-
References QT60168_CMD_NULL_COMMAND, QT60168_SPI, QT60168_SPI_NCPS, 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.
- Parameters
-
cpu_hz | The CPU frequency in hertz. |
References cpu_hz, qt60168_setups_block_t::crc, 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(), qt60168_setups_block, and QT60168_STATUS_KEY_IN_CALIBRATION_MASK.
Referenced by ui_buttons_enable().
bool qt60168_is_key_pressed |
( |
U8 |
key | ) |
|
bool qt60168_is_no_key_pressed |
( |
void |
| ) |
|
int qt60168_report_all_key |
( |
void |
| ) |
|
void qt60168_send_cmd |
( |
unsigned char |
cmd | ) |
|