See Quick start guide for QTouch component.
This component driver provides low-level read/write access to the configuration and data registers on a QTouch device. It has only been tested on AT42QT2160 parts, but it should be easy to add support for other QTouch devices with I2C interface.
Modules | |
Quick Start Guide(s) | |
In this section you can find a list of all Quick Start guides related to the QTouch device driver for I2C interface. | |
QT Device list support by the driver | |
Definitions for Atmel AT42QT2160 device | |
Macros | |
#define | BOARD_QT_DEVICE_ADDRESS 0 /* QTouch device address */ |
#define | BOARD_QT_TWI_INSTANCE 0 /* TWI instance */ |
Checking board configuration of the QTouch device. More... | |
Functions | |
enum status_code | qt_get_comm_ready (void) |
Check communication is ready and able to read Chip ID. More... | |
enum status_code | qt_get_status (struct qt_status *qt_status) |
Get all status from QT device. More... | |
void | qt_hardware_reset (void) |
Perform a hardware reset of the QT device. More... | |
bool | qt_is_change_line_low (void) |
Check if the CHANGE line is low level. More... | |
enum status_code | qt_read_regs (uint8_t reg_addr, uint8_t *read_buffer, uint8_t length) |
Read registers content from QT device. More... | |
enum status_code | qt_read_setup_block (struct qt_setup_block *setup_block) |
Read entire setup block from QT device. More... | |
enum status_code | qt_write_regs (uint8_t reg_addr, uint8_t *write_buffer, uint8_t length) |
Write content to QT device registers. More... | |
enum status_code | qt_write_setup_block (struct qt_setup_block *setup_block) |
Write entire setup block to QT device. More... | |
#define | QT_COMM_TIMEOUT 10000 |
Timeout for communication with QTouch device. More... | |
#define | QT_CONTINUE_RW_DELAY 50 |
Delay between two continue I2C read or write operation in microsecond. More... | |
#define BOARD_QT_DEVICE_ADDRESS 0 /* QTouch device address */ |
Referenced by qt_read_regs(), and qt_write_regs().
#define BOARD_QT_TWI_INSTANCE 0 /* TWI instance */ |
Checking board configuration of the QTouch device.
Referenced by qt_read_regs(), and qt_write_regs().
#define QT_COMM_TIMEOUT 10000 |
Timeout for communication with QTouch device.
Referenced by qt_get_comm_ready().
#define QT_CONTINUE_RW_DELAY 50 |
Delay between two continue I2C read or write operation in microsecond.
Referenced by qt_read_regs(), and qt_write_regs().
enum status_code qt_get_comm_ready | ( | void | ) |
Check communication is ready and able to read Chip ID.
STATUS_OK | If communication is ready. |
ERR_IO_ERROR | If communication failed with the device. |
ERR_UNSUPPORTED_DEV | If the device is not supported. |
References ERR_IO_ERROR, ERR_UNSUPPORTED_DEV, QT_COMM_TIMEOUT, QT_DEVICE_ID, qt_read_regs(), QT_REG_CHIP_ID, and STATUS_OK.
enum status_code qt_get_status | ( | struct qt_status * | qt_status | ) |
Get all status from QT device.
qt_status | Pointer to QT status buffer for read. |
STATUS_OK | If read successful. |
ERR_IO_ERROR | If communication failed with the device. |
References qt_read_regs(), and QT_REG_GENERAL_STATUS.
void qt_hardware_reset | ( | void | ) |
Perform a hardware reset of the QT device.
References delay_us, IOPORT_PIN_LEVEL_HIGH, IOPORT_PIN_LEVEL_LOW, and ioport_set_pin_level().
bool qt_is_change_line_low | ( | void | ) |
Check if the CHANGE line is low level.
true | The CHANGE line is low level. |
false | The CHANGE line is high level. |
References ioport_get_pin_level().
enum status_code qt_read_regs | ( | uint8_t | reg_addr, |
uint8_t * | read_buffer, | ||
uint8_t | length | ||
) |
Read registers content from QT device.
reg_addr | Start register address. |
read_buffer | Pointer to byte array for read data. |
length | Read data length. |
STATUS_OK | If read successful. |
ERR_IO_ERROR | If communication failed with the device. |
References BOARD_QT_DEVICE_ADDRESS, BOARD_QT_TWI_INSTANCE, delay_us, ERR_IO_ERROR, QT_CONTINUE_RW_DELAY, STATUS_OK, twi_master_read(), twi_master_write(), and twi_package_t.
Referenced by qt_get_comm_ready(), qt_get_status(), and qt_read_setup_block().
enum status_code qt_read_setup_block | ( | struct qt_setup_block * | setup_block | ) |
Read entire setup block from QT device.
setup_block | Pointer to setup block buffer for read. |
STATUS_OK | If read successful. |
ERR_IO_ERROR | If communication failed with the device. |
References qt_read_regs(), and QT_SETUPS_BLOCK_ADDR.
enum status_code qt_write_regs | ( | uint8_t | reg_addr, |
uint8_t * | write_buffer, | ||
uint8_t | length | ||
) |
Write content to QT device registers.
reg_addr | Start register address. |
write_buffer | Pointer to byte array for write data. |
length | Write data length. |
STATUS_OK | If write successful. |
ERR_IO_ERROR | If communication failed with the device. |
References BOARD_QT_DEVICE_ADDRESS, BOARD_QT_TWI_INSTANCE, buffer, delay_us, ERR_IO_ERROR, QT_CONTINUE_RW_DELAY, STATUS_OK, twi_master_write(), and twi_package_t.
Referenced by qt_write_setup_block().
enum status_code qt_write_setup_block | ( | struct qt_setup_block * | setup_block | ) |
Write entire setup block to QT device.
setup_block | Pointer to setup block buffer for write. |
STATUS_OK | If write successful. |
ERR_IO_ERROR | If communication failed with the device. |
References QT_SETUPS_BLOCK_ADDR, and qt_write_regs().