#include "compiler.h"
#include "board.h"
#include "power_clocks_lib.h"
#include "gpio.h"
#include "tc.h"
#include "intc.h"
#include "touch_api_at32uc3l.h"
Macros | |
Example Timer configuration settings. | |
Includes for Clock and Timer. Includes for Touch Library. | |
#define | EXAMPLE_TC (&AVR32_TC0) |
timer number. More... | |
#define | EXAMPLE_TC_IRQ_GROUP (AVR32_TC0_IRQ_GROUP) |
timer irq group. More... | |
#define | EXAMPLE_TC_IRQ (AVR32_TC0_IRQ0) |
timer irq. More... | |
#define | EXAMPLE_TC_CHANNEL (0u) |
timer channel. More... | |
#define | EXAMPLE_RC_VALUE (6000u) |
set RC value for 1ms tick. More... | |
Example Clock configuration settings. | |
Note: The QDebug protocol USART clock settings are available in qdebug/Serial.h. When modifying the EXAMPLE_CPUCLK_HZ clock, care must be taken to modify the TARGET_PBA_FREQ_HZ and TARGET_CPU_FREQ_HZ defines in the Serial.h file for the QDebug protocol to work correctly. | |
#define | EXAMPLE_TARGET_DFLL_FREQ_HZ (96000000) |
DFLL target frequency, in Hz. More... | |
#define | EXAMPLE_TARGET_MCUCLK_FREQ_HZ (48000000) |
MCU clock target frequency, in Hz. More... | |
#define | EXAMPLE_TARGET_PBACLK_FREQ_HZ (48000000) |
PBA clock target frequency, in Hz. More... | |
#define | EXAMPLE_TARGET_PBBCLK_FREQ_HZ (48000000) |
PBA clock target frequency, in Hz. More... | |
Functions | |
static touch_ret_t | config_qt_grp_a_touch_sensors (void) |
configure keys, rotors and sliders. More... | |
static unsigned long | init_clock (void) |
Initialize clock. More... | |
static void | init_system (void) |
Initialize host app, pins, watchdog, clock etc. More... | |
static void | init_timer (void) |
Configure timer to fire ISR regularly. More... | |
int | main (void) |
Example application entry function. More... | |
static void | tc_irq (void) |
Timer compare ISR. More... | |
static void | touch_qta_measure_complete_callback (touch_measure_data_t *p_measure_data) |
timer ISR More... | |
Variables | |
volatile uint16_t | current_time_ms_touch = 0u |
Current time, set by timer ISR. More... | |
static touch_general_config_t | general_config |
General configuration options common to QMatrix, QTouch A/B and Autonomous Touch provided as input to Touch library. More... | |
uint16_t | measurement_period_ms = 25u |
Touch Measurement period in milliseconds. More... | |
touch_measure_data_t * | p_qta_measure_data = NULL |
QTouch Group A measure data structure pointer. More... | |
static touch_qt_config_t | qta_config |
QTouch Group A Configuration structure provided as input to Touch Library. More... | |
static uint8_t | qta_data_blk [PRIV_QTA_DATA_BLK_SIZE] |
QTouch Group A Data block provided as input to Touch library. More... | |
volatile uint8_t | qta_measurement_done_touch = 0u |
Flag set by touch_qta_measure_complete_callback() function when a fresh Touch status is available. More... | |
volatile uint8_t | time_to_measure_touch = 0u |
Flag set by timer ISR when it's time to measure touch. More... | |
touch_config_t | touch_config |
Touch Library input configuration structure. More... | |
Parameters to pcl_configure_clocks(). | |
static scif_gclk_opt_t | gc_dfllif_ref_opt = { SCIF_GCCTRL_SLOWCLOCK, 0, false } |
static pcl_freq_param_t | pcl_dfll_freq_param |
#define EXAMPLE_RC_VALUE (6000u) |
set RC value for 1ms tick.
Referenced by init_timer().
#define EXAMPLE_TARGET_DFLL_FREQ_HZ (96000000) |
DFLL target frequency, in Hz.
#define EXAMPLE_TARGET_MCUCLK_FREQ_HZ (48000000) |
MCU clock target frequency, in Hz.
#define EXAMPLE_TARGET_PBACLK_FREQ_HZ (48000000) |
PBA clock target frequency, in Hz.
#define EXAMPLE_TARGET_PBBCLK_FREQ_HZ (48000000) |
PBA clock target frequency, in Hz.
#define EXAMPLE_TC (&AVR32_TC0) |
timer number.
Referenced by init_timer(), and tc_irq().
#define EXAMPLE_TC_CHANNEL (0u) |
timer channel.
Referenced by init_timer(), and tc_irq().
#define EXAMPLE_TC_IRQ (AVR32_TC0_IRQ0) |
timer irq.
Referenced by main().
#define EXAMPLE_TC_IRQ_GROUP (AVR32_TC0_IRQ_GROUP) |
timer irq group.
|
static |
configure keys, rotors and sliders.
Example configuration for touch keys, rotors and sliders.
TOUCH_SUCCESS | Configuration setting successful. |
TOUCH_INVALID_xx | Invalid input configuration setting. |
References HYST_6_25, NO_AKS_GROUP, RES_1_BIT, RES_8_BIT, SENSOR_TYPE_KEY, SENSOR_TYPE_ROTOR, SENSOR_TYPE_SLIDER, TOUCH_QT_GRP_A, touch_qt_sensor_config(), and TOUCH_SUCCESS.
Referenced by main().
|
static |
Initialize clock.
Initialize Clock.
References pcl_configure_clocks(), and pcl_dfll_freq_param.
Referenced by init_system().
|
static |
Initialize host app, pins, watchdog, clock etc.
Initialize host clock, pins, watchdog, etc.
References init_clock().
Referenced by main().
|
static |
Configure timer to fire ISR regularly.
Configure timer ISR to fire regularly.
References tc_waveform_opt_t::channel, tc_interrupt_t::etrgs, EXAMPLE_RC_VALUE, EXAMPLE_TC, EXAMPLE_TC_CHANNEL, TC_CLOCK_SOURCE_TC3, tc_configure_interrupts(), TC_EVT_EFFECT_NOOP, tc_init_waveform(), TC_SEL_NO_EDGE, tc_start(), TC_WAVEFORM_SEL_UP_MODE_RC_TRIGGER, and tc_write_rc().
Referenced by main().
int main | ( | void | ) |
Example application entry function.
References tag_touch_measure_data_t::acq_status, config_qt_grp_a_touch_sensors(), current_time_ms_touch, Disable_global_interrupt, Enable_global_interrupt, EXAMPLE_TC_IRQ, init_system(), init_timer(), INTC_init_interrupts(), INTC_register_interrupt(), NORMAL_ACQ_MODE, QDebug_Init(), QDebug_ProcessCommands(), QDebug_SendData(), QTA_DMA_CHANNEL_0, qta_measurement_done_touch, tc_irq(), time_to_measure_touch, TOUCH_ACQ_INCOMPLETE, touch_event_dispatcher(), TOUCH_QT_GRP_A, touch_qt_sensors_calibrate(), touch_qt_sensors_init, touch_qt_sensors_start_acquisition(), touch_qta_measure_complete_callback(), and TOUCH_SUCCESS.
|
static |
Timer compare ISR.
References current_time_ms_touch, EXAMPLE_TC, EXAMPLE_TC_CHANNEL, measurement_period_ms, tc_read_sr(), and time_to_measure_touch.
Referenced by main().
|
static |
timer ISR
QTouch Group A measure complete callback function.
QTouch Group A measure complete callback function example prototype.
This function is called by the library when the touch measurement process for QTouch Group A sensors is completed.
p_measure_data | Base address of touch_measure_data_t instance. |
References qta_measurement_done_touch, and UNUSED.
Referenced by main().
volatile uint16_t current_time_ms_touch = 0u |
Current time, set by timer ISR.
|
static |
|
static |
General configuration options common to QMatrix, QTouch A/B and Autonomous Touch provided as input to Touch library.
Note: Use the touch_config_at32uc3l.h configuration header file to fill in the elements of this structure. DO NOT modify any of the input values directly in this structure.
uint16_t measurement_period_ms = 25u |
Touch Measurement period in milliseconds.
This variable determines how often a new touch measurement must be done. Default value: Every 25 milliseconds.
touch_measure_data_t* p_qta_measure_data = NULL |
QTouch Group A measure data structure pointer.
|
static |
Referenced by init_clock().
|
static |
QTouch Group A Configuration structure provided as input to Touch Library.
Note: Use the touch_config_at32uc3l.h configuration header file to fill in the elements of this structure. DO NOT modify any of the input values directly in this structure.
|
static |
QTouch Group A Data block provided as input to Touch library.
volatile uint8_t qta_measurement_done_touch = 0u |
Flag set by touch_qta_measure_complete_callback() function when a fresh Touch status is available.
Referenced by main(), and touch_qta_measure_complete_callback().
volatile uint8_t time_to_measure_touch = 0u |
Flag set by timer ISR when it's time to measure touch.
touch_config_t touch_config |
Touch Library input configuration structure.