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().
void appButtonsInd | ( | BSP_TouchEvent_t | event, |
uint8_t | button, | ||
uint8_t | data | ||
) |
void BSP_InitQTouch | ( | BSP_TouchEventHandler_t | handler | ) |
Initialize QTouch.
References burst_len_config(), buzzer_init(), config_sensors(), cpu_irq_enable, init_system(), init_timer_isr(), qt_avr477_filter_cb(), qt_filter_callback, qt_init_sensing, qt_reset_sensing(), and qt_set_parameters().
Referenced by main().
|
static |
ISR | ( | TIMER0_COMPA_vect | ) |
References timer_int, and touch_interrupt_call_back().
void touch_interrupt_call_back | ( | void | ) |
References current_time_ms_touch, qt_measurement_period_msec, and time_to_measure_touch.
Referenced by ISR().
uint8_t Touch_measurement | ( | uint8_t * | button_event, |
uint8_t * | button_state | ||
) |
Touch task handler.
References tag_memory_map_t::body, burst_flag, BUTTON_NO_EVENT, BUTTON_PRESSED_EVENT, BUTTON_RELEASED_EVENT, tag_qt_touch_lib_measure_data_t::channel_signals, current_time_ms_touch, INVALID_KEY, KEY_ROT_CCW, KEY_ROT_CW, KEY_SW09, KEY_SW10, KEY_SW11, KEY_SW12, KEY_SW13, KEY_SW14, KEY_SW15, KEY_SW16, KEY_SW17, key_touch, led0_toggle(), led1_toggle(), memory_map, qt_measure_data, qt_measure_sensors(), tag_qt_touch_lib_measure_data_t::qt_touch_status, QTLIB_BURST_AGAIN, rotor_down, rotor_up, tag_qt_touch_status_t::sensor_states, tag_memory_map_body_t::sensor_status, status_flag, time_to_measure_touch, and tag_memory_map_body_t::wheel_position.
Referenced by app_task(), and main().
uint8_t altFunc |
|
static |
Referenced by main(), and Touch_measurement().
volatile uint16_t current_time_ms_touch = 0u |
Referenced by app_task(), ISR(), main(), touch_interrupt_call_back(), and Touch_measurement().
|
static |
Referenced by qt_avr477_filter_cb().
uint32_t key_touch |
Referenced by Touch_measurement().
uint8_t qt_burst_lengths[4] |
Referenced by burst_len_config(), and read_settings_from_eeprom().
uint8_t qt_button |
Referenced by appButtonsInd().
qt_touch_lib_config_data_t qt_config_data |
uint8_t qt_event |
Referenced by appButtonsInd().
uint32_t rotor_down |
Referenced by Touch_measurement().
uint32_t rotor_up |
Referenced by Touch_measurement().
|
static |
Referenced by main(), and Touch_measurement().
|
static |
Referenced by touch_interrupt_call_back(), and Touch_measurement().
uint8_t touchlink_flag = false |