Microchip® Advanced Software Framework

avr477QTouch.c File Reference

AVR477QTouch buttons handling implementation.

Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.

#include "touch_api.h"
#include "Avr477QTouch.h"
#include "memorymap.h"
#include <asf.h>
#include "avr/io.h"
#include <avr/interrupt.h>

Data Structures

struct  _Button_t
 

Macros

#define DEFAULT_BURST_LENGTH   20u
 configure the individual channel burst length (Based on tuning) More...
 
#define LED_KEY_BURST_LENGTH_1   32u
 
#define LED_KEY_BURST_LENGTH_2   32u
 
#define QT_MEASUREMENT_PERIOD_MSEC   15u
 
#define ROTOR_BURST_LENGTH_10   25u
 
#define ROTOR_BURST_LENGTH_11   32u
 
#define ROTOR_BURST_LENGTH_8   40u
 
#define ROTOR_BURST_LENGTH_9   36u
 
#define ZERO_BURST_LENGTH   0u
 

Typedefs

typedef struct _Button_t Button_t
 

Functions

void appButtonsInd (BSP_TouchEvent_t event, uint8_t button, uint8_t data)
 Buttons handler. More...
 
void BSP_InitQTouch (BSP_TouchEventHandler_t handler)
 Initialize QTouch. More...
 
static void burst_len_config (void)
 
static void buzzer_init (void)
 Buzzer initialization. More...
 
static void config_sensors (void)
 Configure the sensors, assign the channel number, aks_group, hysteresis. More...
 
static void init_system (void)
 initialise host app, pins, watchdog, etc More...
 
static void init_timer_isr (void)
 configure timer ISR to fire regularly More...
 
 ISR (TIMER0_COMPA_vect)
 
static void led0_toggle (void)
 led0 Toggle More...
 
static void led1_toggle (void)
 Led1 Toggle. More...
 
static void qt_avr477_filter_cb (void)
 This function is called every time the qt measuremement is done. More...
 
static void qt_set_parameters (void)
 This will fill the default threshold values in the configuration data structure.But User can change the values of these parameters . More...
 
void touch_interrupt_call_back (void)
 
uint8_t Touch_measurement (uint8_t *button_event, uint8_t *button_state)
 Touch task handler. More...
 

Variables

uint8_t altFunc
 
static volatile uint16_t burst_flag = 0u
 
volatile uint16_t current_time_ms_touch = 0u
 
static uint16_t filter [4][8]
 
uint32_t key_touch
 
uint8_t qt_burst_lengths [4]
 
uint8_t qt_button
 
qt_touch_lib_config_data_t qt_config_data
 
uint8_t qt_event
 
uint16_t qt_measurement_period_msec = QT_MEASUREMENT_PERIOD_MSEC
 timer period in msec. More...
 
uint32_t rotor_down
 
uint32_t rotor_up
 
static volatile uint16_t status_flag = 0u
 
static volatile uint8_t time_to_measure_touch = 0u
 
uint32_t timer_int
 timer 0 compare ISR More...
 
uint8_t touchlink_flag = false
 

#define DEFAULT_BURST_LENGTH   20u

configure the individual channel burst length (Based on tuning)

Referenced by burst_len_config().

#define LED_KEY_BURST_LENGTH_1   32u

Referenced by burst_len_config().

#define LED_KEY_BURST_LENGTH_2   32u

Referenced by burst_len_config().

#define QT_MEASUREMENT_PERIOD_MSEC   15u
#define ROTOR_BURST_LENGTH_10   25u

Referenced by burst_len_config().

#define ROTOR_BURST_LENGTH_11   32u

Referenced by burst_len_config().

#define ROTOR_BURST_LENGTH_8   40u

Referenced by burst_len_config().

#define ROTOR_BURST_LENGTH_9   36u

Referenced by burst_len_config().

#define ZERO_BURST_LENGTH   0u

Referenced by burst_len_config().

typedef struct _Button_t Button_t

void appButtonsInd ( BSP_TouchEvent_t  event,
uint8_t  button,
uint8_t  data 
)

Buttons handler.

Parameters
[in]event- event
[in]button- index
[in]data- data (AKA hold time)

References qt_button, and qt_event.

Referenced by main().

ISR ( TIMER0_COMPA_vect  )
void touch_interrupt_call_back ( void  )

uint8_t altFunc
volatile uint16_t burst_flag = 0u
static

Referenced by main(), and Touch_measurement().

volatile uint16_t current_time_ms_touch = 0u
uint16_t filter[4][8]
static

Referenced by qt_avr477_filter_cb().

uint32_t key_touch

Referenced by Touch_measurement().

uint8_t qt_burst_lengths[4]
uint8_t qt_button

Referenced by appButtonsInd().

uint8_t qt_event

Referenced by appButtonsInd().

uint32_t rotor_down

Referenced by Touch_measurement().

uint32_t rotor_up

Referenced by Touch_measurement().

volatile uint16_t status_flag = 0u
static

Referenced by main(), and Touch_measurement().

volatile uint8_t time_to_measure_touch = 0u
static
uint8_t touchlink_flag = false