Microchip® Advanced Software Framework

thirdparty/qtouch/devspecific/sam0/samd/examples/example_selfcap/qtouch/touch.c File Reference

This file contains the SAMD QTouch library initialization, sensor configuration and measurement routines.

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

#include <asf.h>
#include "touch_api_SAMD.h"

Macros

#define DEF_SELFCAP_CAL_SEQ1_COUNT   8
 Includes for Touch Library. More...
 
#define DEF_SELFCAP_CAL_SEQ2_COUNT   4
 
#define DEF_SELFCAP_CC_CAL_CLK_PRESCALE   PRSC_DIV_SEL_8
 
#define DEF_SELFCAP_CC_CAL_SENSE_RESISTOR   RSEL_VAL_100
 
#define DEF_SELFCAP_QUICK_REBURST_ENABLE   1u
 
#define PTC_APBC_BITMASK   (1u << 19u)
 

Functions

void touch_configure_ptc_clock (void)
 Initialize and enable PTC clock. More...
 
void touch_selfcap_measure_complete_callback (void)
 Self Cap measure complete callback function example prototype. More...
 
static touch_ret_t touch_sensors_config (void)
 configure keys, rotors and sliders. 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 Touch Library. More...
 

Variables

touch_measure_data_tp_mutlcap_measure_data = NULL
 Mutual Cap sensors measured data pointer. More...
 
touch_measure_data_tp_selfcap_measure_data = NULL
 Self Cap sensors measured data pointer. More...
 
static touch_selfcap_config_t selfcap_config
 Self Cap Configuration structure provided as input to Touch Library. More...
 
static uint8_t selfcap_data_blk [PRIV_SELFCAP_DATA_BLK_SIZE]
 Self Cap sensors data block provided as input to Touch library. More...
 
freq_hop_sel_t selfcap_freq_hops [3u] = {DEF_SELFCAP_HOP_FREQS}
 
gain_t selfcap_gain_per_node [DEF_SELFCAP_NUM_CHANNELS] = {DEF_SELFCAP_GAIN_PER_NODE}
 
uint16_t selfcap_y_nodes [DEF_SELFCAP_NUM_CHANNELS] = {DEF_SELFCAP_LINES}
 Self Cap sensors Pins Info. More...
 
touch_config_t touch_config
 Touch Library input configuration structure. More...
 
touch_time_t touch_time
 

#define DEF_SELFCAP_CAL_SEQ1_COUNT   8

Includes for Touch Library.

#define DEF_SELFCAP_CAL_SEQ2_COUNT   4
#define DEF_SELFCAP_CC_CAL_CLK_PRESCALE   PRSC_DIV_SEL_8
#define DEF_SELFCAP_CC_CAL_SENSE_RESISTOR   RSEL_VAL_100
#define DEF_SELFCAP_QUICK_REBURST_ENABLE   1u
#define PTC_APBC_BITMASK   (1u << 19u)

void touch_selfcap_measure_complete_callback ( void  )

Self Cap measure complete callback function example prototype.

Self Cap measure complete callback function.

This function is called by the library when the touch measurement process for Self Cap sensors is completed.

Parameters
p_measure_dataBase address of touch_measure_data_t instance.
Note
A touch_selfcap_measure_complete_callback() call signifies that fresh values of touch status, rotor/slider position, measured signals, references and Sensor data is available. The Self Cap measured data can be accessed using the p_measure_data pointer.

References tag_touch_measure_data_t::acq_status, tag_touch_measure_data_t::measurement_done_touch, TOUCH_BURST_AGAIN, TOUCH_CHANNEL_REF_CHANGE, TOUCH_ROTOR_SLIDER_POS_CHANGE, and TOUCH_STATUS_CHANGE.

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 CHANNEL_0, CHANNEL_1, CHANNEL_2, CHANNEL_4, CHANNEL_5, CHANNEL_7, HYST_6_25, NO_AKS_GROUP, RES_8_BIT, SENSOR_TYPE_KEY, SENSOR_TYPE_ROTOR, SENSOR_TYPE_SLIDER, touch_selfcap_sensor_config(), and TOUCH_SUCCESS.

Referenced by touch_sensors_init().

touch_selfcap_config_t selfcap_config
static

Self Cap Configuration structure provided as input to Touch Library.

Note: Use the touch.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 selfcap_data_blk[PRIV_SELFCAP_DATA_BLK_SIZE]
static

Self Cap sensors data block provided as input to Touch library.

freq_hop_sel_t selfcap_freq_hops[3u] = {DEF_SELFCAP_HOP_FREQS}
gain_t selfcap_gain_per_node[DEF_SELFCAP_NUM_CHANNELS] = {DEF_SELFCAP_GAIN_PER_NODE}
uint16_t selfcap_y_nodes[DEF_SELFCAP_NUM_CHANNELS] = {DEF_SELFCAP_LINES}

Self Cap sensors Pins Info.

touch_config_t touch_config
Initial value:
= {
DEF_TOUCH_PTC_ISR_LVL,
}
#define NULL
Definition: def.h:47
static touch_selfcap_config_t selfcap_config
Self Cap Configuration structure provided as input to Touch Library.
Definition: thirdparty/qtouch/devspecific/sam0/samd/examples/example_selfcap/qtouch/touch.c:129

Touch Library input configuration structure.