Microchip® Advanced Software Framework

qtouch_example.c File Reference

Qtouch example for SAM.

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

#include "asf.h"
#include "conf_example.h"

Macros

#define GET_ROTOR_SLIDER_POSITION(ROTOR_SLIDER_NUMBER)   qt_measure_data.qt_touch_status.rotor_slider_values[ROTOR_SLIDER_NUMBER]
 
#define GET_SENSOR_STATE(SENSOR_NUMBER)   (qt_measure_data.qt_touch_status.sensor_states[(SENSOR_NUMBER/8)] & (1 << (SENSOR_NUMBER % 8)))
 
#define QTOUCH_LIB_COMPILER_MASK   0x01
 Qtouch library compiler type mask. More...
 
#define QTOUCH_LIB_COMPILER_OFFSET   2
 Qtouch library compiler type offset: GCC / IAR. More...
 
#define QTOUCH_LIB_KEY_ONLY_MASK   0x01
 Qtouch library supports keys only mask. More...
 
#define QTOUCH_LIB_KEY_ONLY_OFFSET   10
 Qtouch library supports keys only offset. More...
 
#define QTOUCH_LIB_MAX_CHANNEL_MASK   0x7F
 Qtouch library maximum channels mask. More...
 
#define QTOUCH_LIB_MAX_CHANNEL_OFFSET   3
 Qtouch library maximum channels offset. More...
 
#define QTOUCH_LIB_ROTOR_NUM_MASK   0x1F
 Qtouch library maximum rotors/silders mask. More...
 
#define QTOUCH_LIB_ROTOR_NUM_OFFSET   11
 Qtouch library maximum rotors/silders offset. More...
 
#define QTOUCH_LIB_TPYE_MASK   0x01
 Qtouch library type: Qtouch / QMatrix. More...
 
#define STRING_EOL   "\r"
 
#define STRING_HEADER
 

Functions

static void config_sensors (void)
 Configure the sensors. More...
 
static void configure_console (void)
 Configure UART console. More...
 
static void init_system (void)
 initialise pins, watchdog, etc. More...
 
static void init_timer_isr (void)
 Configure timer ISR to fire regularly. More...
 
int main (void)
 Main code entry point. 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 SysTick_Handler (void)
 Handler for Sytem Tick interrupt. More...
 
static void trace_library_info (void)
 Display information about library used. More...
 

Variables

static volatile uint16_t current_time_ms_touch = 0u
 
uint16_t qt_measurement_period_msec = 25u
 timer period in msec. More...
 
static volatile uint8_t time_to_measure_touch = 0u
 

#define GET_ROTOR_SLIDER_POSITION (   ROTOR_SLIDER_NUMBER)    qt_measure_data.qt_touch_status.rotor_slider_values[ROTOR_SLIDER_NUMBER]

Referenced by main().

#define GET_SENSOR_STATE (   SENSOR_NUMBER)    (qt_measure_data.qt_touch_status.sensor_states[(SENSOR_NUMBER/8)] & (1 << (SENSOR_NUMBER % 8)))

Referenced by main().

#define QTOUCH_LIB_COMPILER_MASK   0x01

Qtouch library compiler type mask.

Referenced by trace_library_info().

#define QTOUCH_LIB_COMPILER_OFFSET   2

Qtouch library compiler type offset: GCC / IAR.

Referenced by trace_library_info().

#define QTOUCH_LIB_KEY_ONLY_MASK   0x01

Qtouch library supports keys only mask.

Referenced by trace_library_info().

#define QTOUCH_LIB_KEY_ONLY_OFFSET   10

Qtouch library supports keys only offset.

Referenced by trace_library_info().

#define QTOUCH_LIB_MAX_CHANNEL_MASK   0x7F

Qtouch library maximum channels mask.

Referenced by trace_library_info().

#define QTOUCH_LIB_MAX_CHANNEL_OFFSET   3

Qtouch library maximum channels offset.

Referenced by trace_library_info().

#define QTOUCH_LIB_ROTOR_NUM_MASK   0x1F

Qtouch library maximum rotors/silders mask.

Referenced by trace_library_info().

#define QTOUCH_LIB_ROTOR_NUM_OFFSET   11

Qtouch library maximum rotors/silders offset.

Referenced by trace_library_info().

#define QTOUCH_LIB_TPYE_MASK   0x01

Qtouch library type: Qtouch / QMatrix.

Referenced by trace_library_info().

#define STRING_EOL   "\r"
#define STRING_HEADER
Value:
"-- Qtouch Project --\r\n" \
"-- "BOARD_NAME" --\r\n" \
"-- Compiled: "__DATE__" "__TIME__" --"STRING_EOL
#define BOARD_NAME
Definition: inc/app_init.h:140
#define STRING_EOL
Definition: qtouch_example.c:117

Referenced by init_system().

static void config_sensors ( void  )
static

Configure the sensors.

References AKS_GROUP_1, HYST_6_25, qt_enable_key(), and RES_8_BIT.

Referenced by main().

static void configure_console ( void  )
static
static void init_system ( void  )
static

initialise pins, watchdog, etc.

References configure_console(), pmc_enable_periph_clk(), STRING_HEADER, sysclk_init(), and wdt_disable().

Referenced by main().

static void init_timer_isr ( void  )
static

Configure timer ISR to fire regularly.

Configure Timer Counter 0 to generate an interrupt every 25ms.

References qt_measurement_period_msec, and sysclk_get_cpu_hz().

Referenced by main().

void SysTick_Handler ( void  )

Handler for Sytem Tick interrupt.

References current_time_ms_touch, qt_measurement_period_msec, and time_to_measure_touch.

volatile uint16_t current_time_ms_touch = 0u
static
volatile uint8_t time_to_measure_touch = 0u
static