Microchip® Advanced Software Framework

at42qt1060.c File Reference
#include "board.h"
#include "gpio.h"
#include "conf_at42qt1060.h"
#include "at42qt1060.h"
#include "intc.h"
#include "cycle_counter.h"
#include "twim.h"

Functions

void at42qt1060_detect_int_handler (void)
 Interrupt handler for the pin interrupt-. More...
 
uint8_t at42qt1060_get_detect_status (void)
 Gets the touch detect status of the sensor. More...
 
uint8_t at42qt1060_get_status (void)
 
void at42qt1060_init (int32_t fcpu)
 Initialize touch sensor with default configuration values. More...
 
uint8_t at42qt1060_read_reg (uint8_t reg_index)
 Read device register content. More...
 
void at42qt1060_register_int (void(*touch_detect_callback)(void))
 Register a normal pin interrupt for the touch event. More...
 
void at42qt1060_write_reg (uint8_t reg_index, uint8_t data)
 Write device register content. More...
 

Variables

struct {
   void(*   touch_detect_callback )(void)
 
at42qt1060
 Local driver data. More...
 
static uint32_t cpu_hz
 

void at42qt1060_detect_int_handler ( void  )

Interrupt handler for the pin interrupt-.

References at42qt1060, AT42QT1060_DETECT_PIN, gpio_clear_pin_interrupt_flag(), and gpio_get_pin_interrupt_flag().

Referenced by at42qt1060_register_int().

uint8_t at42qt1060_get_detect_status ( void  )

Gets the touch detect status of the sensor.

Returns
Register content of the touch detect register.

References AT42QT1060_DETECTION_STATUS, AT42QT1060_INPUT_PORT_STATUS, and at42qt1060_read_reg().

Referenced by at42qt1060_init().

uint8_t at42qt1060_read_reg ( uint8_t  reg_index)

Read device register content.

Read register data.

Parameters
reg_indexRegister address.
Returns
Register content.

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_int ( void(*)(void)  touch_detect_callback)
void at42qt1060_write_reg ( uint8_t  reg_index,
uint8_t  data 
)

Write device register content.

Write data to a sensor register.

Parameters
reg_indexRegister address. Use macros as defined in the header file.
dataData 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().

struct { ... } at42qt1060
Initial value:
=
{
.touch_detect_callback = NULL
}
#define NULL
Definition: btypes.h:108

Local driver data.

Referenced by at42qt1060_detect_int_handler(), and at42qt1060_register_int().

uint32_t cpu_hz
static
void(* touch_detect_callback)(void)