#include <stdint.h>
Functions | |
void | at42qt1060_calibrate (void) |
Starts a re-calibration or the sensor. More... | |
uint8_t | at42qt1060_get_detect_status (void) |
Gets the touch detect status of the sensor. More... | |
void | at42qt1060_init (int32_t fcpu) |
Initialize touch sensor with default configuration values. More... | |
uint8_t | at42qt1060_read_reg (uint8_t reg_index) |
Read register data. More... | |
void | at42qt1060_register_eic_int (void(*touch_detect_callback)(void)) |
Register a interrupt handler for the EIC controller. More... | |
void | at42qt1060_register_int (void(*touch_detect_callback)(void)) |
Register a pin interrupt handler. More... | |
void | at42qt1060_reset (void) |
Performs a software reset of the touch sensor. More... | |
void | at42qt1060_set_low_power_mode (uint8_t lp_mode) |
Sets the current power mode of the device. More... | |
void | at42qt1060_write_reg (uint8_t reg_index, uint8_t data) |
Write data to a sensor register. More... | |
#define AT42QT1060_ACTIVE_LEVEL_MASK 0x1C |
#define AT42QT1060_AKS_MASK 0x19 |
#define AT42QT1060_CAL 0x80 |
#define AT42QT1060_CALIBRATE 0x0C |
#define AT42QT1060_CHIP_ID 0x00 |
#define AT42QT1060_DETECTION_MASK 0x1B |
#define AT42QT1060_DETECTION_STATUS 0x04 |
Referenced by at42qt1060_get_detect_status(), and controller_task().
#define AT42QT1060_DEVICE_MINOR_VERSION 0x00 |
#define AT42QT1060_DEVICE_VERSION 0x03 |
#define AT42QT1060_DI 0x1E |
Referenced by at42qt1060_init().
#define AT42QT1060_DRIFT_OPTION 0x0E |
#define AT42QT1060_INPUT_PORT_STATUS 0x05 |
Referenced by at42qt1060_get_detect_status(), and controller_task().
#define AT42QT1060_IO_0 0x01 |
#define AT42QT1060_IO_1 0x02 |
#define AT42QT1060_IO_2 0x04 |
#define AT42QT1060_IO_3 0x08 |
#define AT42QT1060_IO_4 0x10 |
#define AT42QT1060_IO_5 0x20 |
#define AT42QT1060_IO_6 0x40 |
#define AT42QT1060_IO_MASK 0x17 |
Referenced by at42qt1060_init().
#define AT42QT1060_KEY_0 0x01 |
#define AT42QT1060_KEY_0_NTHR 0x10 |
Referenced by at42qt1060_init().
#define AT42QT1060_KEY_0_REF_DATA_LSB 0x34 |
#define AT42QT1060_KEY_0_REF_DATA_MSB 0x35 |
#define AT42QT1060_KEY_0_SIGNAL_LSB 0x28 |
#define AT42QT1060_KEY_0_SIGNAL_MSB 0x29 |
#define AT42QT1060_KEY_1 0x02 |
#define AT42QT1060_KEY_1_NTHR 0x11 |
Referenced by at42qt1060_init().
#define AT42QT1060_KEY_1_REF_DATA_LSB 0x36 |
#define AT42QT1060_KEY_1_REF_DATA_MSB 0x37 |
#define AT42QT1060_KEY_1_SIGNAL_LSB 0x2A |
#define AT42QT1060_KEY_1_SIGNAL_MSB 0x2B |
#define AT42QT1060_KEY_2 0x04 |
#define AT42QT1060_KEY_2_NTHR 0x12 |
Referenced by at42qt1060_init().
#define AT42QT1060_KEY_2_REF_DATA_LSB 0x38 |
#define AT42QT1060_KEY_2_REF_DATA_MSB 0x39 |
#define AT42QT1060_KEY_2_SIGNAL_LSB 0x2C |
#define AT42QT1060_KEY_2_SIGNAL_MSB 0x2D |
#define AT42QT1060_KEY_3 0x08 |
#define AT42QT1060_KEY_3_NTHR 0x13 |
Referenced by at42qt1060_init().
#define AT42QT1060_KEY_3_REF_DATA_LSB 0x3A |
#define AT42QT1060_KEY_3_REF_DATA_MSB 0x3B |
#define AT42QT1060_KEY_3_SIGNAL_LSB 0x2E |
#define AT42QT1060_KEY_3_SIGNAL_MSB 0x2F |
#define AT42QT1060_KEY_4 0x10 |
#define AT42QT1060_KEY_4_NTHR 0x14 |
Referenced by at42qt1060_init().
#define AT42QT1060_KEY_4_REF_DATA_LSB 0x3C |
#define AT42QT1060_KEY_4_REF_DATA_MSB 0x3D |
#define AT42QT1060_KEY_4_SIGNAL_LSB 0x30 |
#define AT42QT1060_KEY_4_SIGNAL_MSB 0x31 |
#define AT42QT1060_KEY_5 0x20 |
#define AT42QT1060_KEY_5_NTHR 0x15 |
Referenced by at42qt1060_init().
#define AT42QT1060_KEY_5_REF_DATA_LSB 0x3E |
#define AT42QT1060_KEY_5_REF_DATA_MSB 0x3F |
#define AT42QT1060_KEY_5_SIGNAL_LSB 0x32 |
#define AT42QT1060_KEY_5_SIGNAL_MSB 0x33 |
#define AT42QT1060_KEY_MASK 0x18 |
Referenced by at42qt1060_init().
#define AT42QT1060_LP_MODE 0x16 |
Referenced by at42qt1060_init().
#define AT42QT1060_MINOR_VERSION 0x02 |
#define AT42QT1060_POS_RECALIBRATION_DELAY 0x0F |
#define AT42QT1060_PWM_LEVEL 0x1F |
#define AT42QT1060_PWM_MASK 0x1A |
#define AT42QT1060_RESET 0x0D |
#define AT42QT1060_USER_OUTPUT_BUFFER 0x1D |
#define AT42QT1060_VERSION 0x01 |
void at42qt1060_calibrate | ( | void | ) |
Starts a re-calibration or the sensor.
uint8_t at42qt1060_get_detect_status | ( | void | ) |
Gets the touch detect status of the sensor.
References AT42QT1060_DETECTION_STATUS, AT42QT1060_INPUT_PORT_STATUS, and at42qt1060_read_reg().
Referenced by at42qt1060_init().
void at42qt1060_init | ( | int32_t | fcpu | ) |
Initialize touch sensor with default configuration values.
References AT42QT1060_DETECT_INTEGRATOR_VALUE, AT42QT1060_DI, at42qt1060_get_detect_status(), AT42QT1060_IO_MASK, AT42QT1060_KEY_0_NTHR, AT42QT1060_KEY_0_NTHR_VALUE, AT42QT1060_KEY_1_NTHR, AT42QT1060_KEY_1_NTHR_VALUE, AT42QT1060_KEY_2_NTHR, AT42QT1060_KEY_2_NTHR_VALUE, AT42QT1060_KEY_3_NTHR, AT42QT1060_KEY_3_NTHR_VALUE, AT42QT1060_KEY_4_NTHR, AT42QT1060_KEY_4_NTHR_VALUE, AT42QT1060_KEY_5_NTHR, AT42QT1060_KEY_5_NTHR_VALUE, AT42QT1060_KEY_MASK, AT42QT1060_KEY_MASK_VALUE, AT42QT1060_LP_MODE, at42qt1060_read_reg(), at42qt1060_write_reg(), and cpu_hz.
Referenced by controller_init().
uint8_t at42qt1060_read_reg | ( | uint8_t | reg_index | ) |
Read register data.
reg_index | Register index |
Read register data.
reg_index | Register address. |
References twi_package_t::addr_length, AT42QT1060_TWI, AT42QT1060_TWI_ADDRESS, twi_package_t::buffer, twi_package_t::chip, cpu_delay_us(), cpu_hz, twi_package_t::length, twi_master_read(), twi_master_write(), and TWI_SUCCESS.
Referenced by at42qt1060_get_detect_status(), at42qt1060_init(), and controller_task().
void at42qt1060_register_eic_int | ( | void(*)(void) | touch_detect_callback | ) |
Register a interrupt handler for the EIC controller.
If the detect signal is on an input of the EIC controller this function can be used to register a interrupt handler for it.
touch_detect_callback | Pointer to callback function that should be called when the interrupt triggers. Keep this function as short as possible. |
void at42qt1060_register_int | ( | void(*)(void) | touch_detect_callback | ) |
Register a pin interrupt handler.
The detect signal from the touch sensor is used to generate a pin interrupt.
touch_detect_callback | Pointer to callback function that should be called when the interrupt triggers. Keep this function as short as possible. |
Register a pin interrupt handler.
References at42qt1060, at42qt1060_detect_int_handler(), AT42QT1060_DETECT_PIN, Disable_global_interrupt, Enable_global_interrupt, gpio_clear_pin_interrupt_flag(), gpio_enable_pin_interrupt(), GPIO_FALLING_EDGE, INTC_register_interrupt(), and touch_detect_callback.
void at42qt1060_reset | ( | void | ) |
Performs a software reset of the touch sensor.
void at42qt1060_set_low_power_mode | ( | uint8_t | lp_mode | ) |
Sets the current power mode of the device.
lp_mode | Determines the number of 16ms intervals between key measurements. Longer intervals between measurements -> lower power consumption but slower response A value of 0 causes the device to sleep and no measurements are performed. A value of 255 causes the device to enter "free-run" mode where measurements are continuously taken. 1 = 16ms between measurements 2 = 32ms between measurements ... |
void at42qt1060_write_reg | ( | uint8_t | reg_index, |
uint8_t | data | ||
) |
Write data to a sensor register.
reg_index | Register index number |
data | Register data |
Write data to a sensor register.
reg_index | Register address. Use macros as defined in the header file. |
data | Data that should be written to the device register. |
References twi_package_t::addr_length, AT42QT1060_TWI, AT42QT1060_TWI_ADDRESS, twi_package_t::buffer, twi_package_t::chip, twi_package_t::length, twi_master_write(), and TWI_SUCCESS.
Referenced by at42qt1060_init().