This file contains the AT32UC3L-EK demonstration application that interfaces with QTouchStudio and controls the LEDs with the touch sensors.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
#include "board.h"
#include "conf_clock.h"
#include "tc.h"
#include "intc.h"
#include "gpio.h"
#include "delay.h"
#include "power_clocks_lib.h"
#include "touch_api_at32uc3l.h"
#include "qdebug.h"
#include "demo.h"
Macros | |
#define | DEMO_INIT_NB_AUTOMATIC_CHANGES 5 |
Number of automatic LEDs intensity changes done at the beginning of the demo. More... | |
#define | EXAMPLE_DFLL_COARSE_FDFLL96 (150u) |
#define | EXAMPLE_DFLL_FINE_FDFLL96 (65u) |
#define | EXAMPLE_MEASUREMENT_PERIOD_MS (25u) /* The timing information for timer to fire periodically to measure touch. */ |
#define | EXAMPLE_RC_VALUE (6000u) /* configure timer for 1ms tick. */ |
#define | EXAMPLE_TC (&AVR32_TC0) |
#define | EXAMPLE_TC_CHANNEL (0u) |
#define | EXAMPLE_TC_IRQ (AVR32_TC0_IRQ0) |
#define | EXAMPLE_TC_IRQ_GROUP (AVR32_TC0_IRQ_GROUP) |
Functions | |
static touch_ret_t | config_uc3lek_touch_sensors (void) |
static unsigned long | init_clock (unsigned long cpuclk_hz) |
static void | init_system (void) |
static void | init_timer (void) |
int | main (void) |
static void | tc_irq (void) |
static void | touch_qm_measure_complete_callback (touch_measure_data_t *p_measure_data) |
Variables | |
volatile uint16_t | current_time_ms_touch = 0u |
static touch_general_config_t | general_config |
uint16_t | measurement_period_ms = EXAMPLE_MEASUREMENT_PERIOD_MS |
Touch Measurement period in milliseconds. More... | |
touch_measure_data_t * | p_qm_measure_data = NULL |
QMatrix measured data pointer. More... | |
const uint8_t | qm_burst_length [QM_NUM_CHANNELS] |
static touch_qm_config_t | qm_config |
static uint8_t | qm_data_blk [PRIV_QM_DATA_BLK_SIZE] |
volatile uint8_t | qm_measurement_done_touch = 0u |
Flag set by touch_qm_measure_complete_callback() function when a fresh Touch status is available. More... | |
volatile uint8_t | time_to_measure_touch = 0u |
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 DEMO_INIT_NB_AUTOMATIC_CHANGES 5 |
Number of automatic LEDs intensity changes done at the beginning of the demo.
Referenced by main().
#define EXAMPLE_DFLL_COARSE_FDFLL96 (150u) |
Referenced by local_start_highfreq_clock().
#define EXAMPLE_DFLL_FINE_FDFLL96 (65u) |
Referenced by local_start_highfreq_clock().
#define EXAMPLE_MEASUREMENT_PERIOD_MS (25u) /* The timing information for timer to fire periodically to measure touch. */ |
#define EXAMPLE_RC_VALUE (6000u) /* configure timer for 1ms tick. */ |
Referenced by init_timer().
#define EXAMPLE_TC (&AVR32_TC0) |
Referenced by init_timer(), and tc_irq().
#define EXAMPLE_TC_CHANNEL (0u) |
Referenced by init_timer(), and tc_irq().
#define EXAMPLE_TC_IRQ (AVR32_TC0_IRQ0) |
Referenced by main().
#define EXAMPLE_TC_IRQ_GROUP (AVR32_TC0_IRQ_GROUP) |
|
static |
References HYST_6_25, NO_AKS_GROUP, RES_1_BIT, RES_8_BIT, SENSOR_TYPE_KEY, SENSOR_TYPE_ROTOR, touch_qm_sensor_config(), and TOUCH_SUCCESS.
Referenced by main().
|
static |
References pcl_configure_clocks(), pcl_dfll_freq_param, QM_GCLK_CAT_DIV, scif_gc_enable(), scif_gc_setup(), and SCIF_GCCTRL_DFLL0.
Referenced by init_system().
|
static |
References EXAMPLE_CPUCLK_HZ, and init_clock().
Referenced by main().
|
static |
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 | ) |
References tag_touch_measure_data_t::acq_status, config_uc3lek_touch_sensors(), current_time_ms_touch, delay_ms, demo_automatic_ledshow_play(), DEMO_INIT_NB_AUTOMATIC_CHANGES, demo_init_pwma(), Disable_global_interrupt, tag_touch_qm_dma_t::dma_ch1, tag_touch_qm_dma_t::dma_ch2, Enable_global_interrupt, EXAMPLE_TC_IRQ, gpio_clr_gpio_pin(), gpio_tgl_gpio_pin(), init_system(), init_timer(), INTC_init_interrupts(), INTC_register_interrupt(), NORMAL_ACQ_MODE, tag_touch_measure_data_t::p_rotor_slider_values, tag_touch_measure_data_t::p_sensor_states, process_qtouchlib_data(), QDebug_Init(), QDebug_ProcessCommands(), QDebug_SendData(), qm_dma, QM_DMA_CHANNEL_0, QM_DMA_CHANNEL_1, qm_measurement_done_touch, SLEEP, tc_irq(), time_to_measure_touch, TOUCH_ACQ_INCOMPLETE, touch_event_dispatcher(), TOUCH_NO_ACTIVITY, touch_qm_measure_complete_callback(), touch_qm_sensors_calibrate(), touch_qm_sensors_init, touch_qm_sensors_start_acquisition(), and TOUCH_SUCCESS.
|
static |
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 |
References qm_measurement_done_touch.
Referenced by main().
volatile uint16_t current_time_ms_touch = 0u |
|
static |
|
static |
uint16_t measurement_period_ms = EXAMPLE_MEASUREMENT_PERIOD_MS |
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_qm_measure_data = NULL |
QMatrix measured data pointer.
|
static |
Referenced by init_clock().
const uint8_t qm_burst_length[QM_NUM_CHANNELS] |
|
static |
|
static |
volatile uint8_t qm_measurement_done_touch = 0u |
Flag set by touch_qm_measure_complete_callback() function when a fresh Touch status is available.
volatile uint8_t time_to_measure_touch = 0u |
touch_config_t touch_config |