Microchip® Advanced Software Framework

touch.c File Reference
#include "touch_api_sam4l.h"

Macros

#define TOUCH_MEASUREMENT_PERIOD_MS   (32u)
 Includes for Touch Library. More...
 

Functions

static void touch_at_status_change_interrupt_callback (touch_at_status *p_at_status)
 Autonomous QTouch Group status change callback function example prototype. More...
 
void touch_autonomous_sensor_disable (void)
 This API is used to disable Autonomous QTouch Sensor. More...
 
touch_ret_t touch_autonomous_sensor_enable (void)
 This API is used to enable Autonomous QTouch Sensor that can be used to Wakeup the CPU from Deep-Sleep modes. More...
 
static void touch_qt_measure_complete_callback (void)
 QTouch Library measure complete callback function example prototype. More...
 
static touch_ret_t touch_sensors_config (void)
 configure keys, rotors and sliders. More...
 
void touch_sensors_deinit (void)
 This API is used to deinitialize capacitive touch acquisition on QTouch Sensors. More...
 
touch_ret_t touch_sensors_init (void)
 Example application entry function. More...
 
touch_ret_t touch_sensors_measure (void)
 This API is used to perform a Single Capacitance measurement using the QTouch Library. More...
 
void touch_sensors_update_time (void)
 QTouch Library time update function. Note: This function is called in an ISR. More...
 

Variables

static touch_at_config_t at_config
 Autonomous QTouch Configuration structure provided as input to Touch Library. More...
 
volatile int8_t autonomous_qtouch_in_touch = 0
 Flag set by touch_at_status_change_interrupt_callback() function when a fresh Touch status is available. More...
 
touch_measure_data_tp_qt_measure_data = NULL
 QTouch measured data pointer. More...
 
static touch_qt_config_t qt_config
 QTouch Library Configuration structure provided as input to Touch Library. More...
 
static uint8_t qt_data_blk [PRIV_QT_DATA_BLK_SIZE]
 QTouch Library Data block provided as input to Touch library. More...
 
static uint8_t sensor_pins [QT_NUM_SENSOR_PINS_SELECTED]
 QTouch Library Sensor Pins Info. More...
 
touch_config_t touch_config
 Touch Library input configuration structure. More...
 
touch_qt_time_t touch_qt_time
 QTouch Library Timing info. More...
 

#define TOUCH_MEASUREMENT_PERIOD_MS   (32u)

Includes for Touch Library.

This macro indicates how often a new touch measurement must be done.

Referenced by touch_sensors_init().

void touch_at_status_change_interrupt_callback ( touch_at_status p_at_status)
static

Autonomous QTouch Group status change callback function example prototype.

Autonomous QTouch status change interrupt callback function. This callback function is called by the Touch library in the CAT Autonomous QTouch status change Interrupt context, each time there is a status change in the Autonomous Touch sensor.

Parameters
p_at_status,:Autonomous QTouch status. p_at_status->status_change: Autonomous QTouch status change.
Note
1. CAUTION - This callback function is called in the CAT Autonomous QTouch Status change INTERRUPT SERVICE ROUTINE by the Touch Library.
  1. The Autonomous QTouch Status change callback is called both for an IN_TOUCH status change and an OUT_OF_TOUCH status change.

References autonomous_qtouch_in_touch, IN_TOUCH, and tag_touch_at_status_t::status_change.

void touch_qt_measure_complete_callback ( void  )
static

QTouch Library measure complete callback function example prototype.

QTouch Library measure complete callback function.

This function is called by the library when the touch measurement process for QTouch Library sensors is completed.

Note
A touch_qt_measure_complete_callback() call signifies that fresh values of touch status, rotor/slider position, measured signals, references and Sensor data is available. The QTouch Library measured data can be accessed using the p_measure_data pointer.

References tag_touch_measure_data_t::acq_status, tag_touch_qt_time_t::measurement_done_touch, and TOUCH_BURST_AGAIN.

Referenced by touch_sensors_measure().

touch_ret_t touch_sensors_config ( void  )
static

configure keys, rotors and sliders.

Example configuration for touch keys, rotors and sliders.

Return values
TOUCH_SUCCESSConfiguration setting successful.
TOUCH_INVALID_xxInvalid input configuration setting.

References HYST_6_25, NO_AKS_GROUP, RES_1_BIT, RES_8_BIT, SENSOR_TYPE_KEY, SENSOR_TYPE_SLIDER, touch_qt_sensor_config(), and TOUCH_SUCCESS.

Referenced by touch_sensors_init().

touch_at_config_t at_config
static
Initial value:
= {
{
},
{
0,
0x004u,
0x800u,
},
}
#define AT_CHARGET
CATB Charge time.
Definition: touch_config_sam4l.h:351
#define AT_REPEAT
CATB Repeat measurements.
Definition: touch_config_sam4l.h:358
#define AT_DISCHARGET
CATB Discharge time.
Definition: touch_config_sam4l.h:344
#define AT_DISCHARGE_PIN_SELECTED
Autonomous QTouch Discharge pin selected.
Definition: touch_config_sam4l.h:322
#define AT_DI
QTouch Sensor detect integration (DI) limit.
Definition: touch_config_sam4l.h:370
#define AT_THRESHOLD
Definition: touch_config_sam4l.h:365
#define AT_SP_SELECTED
Autonomous QTouch Sensor Pin selected.
Definition: touch_config_sam4l.h:315
#define AT_SPREAD
Enable/Disable Spread Spectrum based acquisition.
Definition: touch_config_sam4l.h:363
#define AT_CLOCK_SEL
CATB Clock Acquisition Clock Source Select 0: The RC oscillator is selected as acquisition clock and ...
Definition: touch_config_sam4l.h:337
static void touch_at_status_change_interrupt_callback(touch_at_status *p_at_status)
Autonomous QTouch Group status change callback function example prototype.
Definition: touch.c:399

Autonomous QTouch Configuration structure provided as input to Touch Library.

Note: Use the touch_config_sam4l.h configuration header file to fill in the elements of this structure. DO NOT modify any of the input values directly in this structure.

volatile int8_t autonomous_qtouch_in_touch = 0

Flag set by touch_at_status_change_interrupt_callback() function when a fresh Touch status is available.

Referenced by touch_at_status_change_interrupt_callback().

touch_qt_config_t qt_config
static

QTouch Library Configuration structure provided as input to Touch Library.

Note: Use the touch_config_sam4l.h configuration header file to fill in the elements of this structure. DO NOT modify any of the input values directly in this structure.

uint8_t qt_data_blk[PRIV_QT_DATA_BLK_SIZE]
static

QTouch Library Data block provided as input to Touch library.

uint8_t sensor_pins[QT_NUM_SENSOR_PINS_SELECTED]
static
Initial value:
=
{
}
#define QT_SENSOR_PINS_SELECTED
QTouch Sensor pins's selected.
Definition: touch_config_sam4l.h:104

QTouch Library Sensor Pins Info.

touch_config_t touch_config
Initial value:
= {
}
static touch_qt_config_t qt_config
QTouch Library Configuration structure provided as input to Touch Library.
Definition: touch.c:89
static touch_at_config_t at_config
Autonomous QTouch Configuration structure provided as input to Touch Library.
Definition: touch.c:134

Touch Library input configuration structure.