This file contains the SAM4L QTouch Libary API interface for QMatrix, QTouch and Autonomous Touch method using the Capacitive Touch (CATB) module.
Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.
#include <exceptions.h>
#include <compiler.h>
#include <status_codes.h>
#include <parts.h>
#include "touch_config_sam4l.h"
Data Structures | |
struct | tag_sensor_t |
Sensor structure for storing sensor related information. More... | |
struct | tag_touch_at_config_t |
Autonomous Touch configuration input. More... | |
struct | tag_touch_at_pin_t |
Autonomous Touch pin configuration type. More... | |
struct | tag_touch_at_reg_t |
Autonomous Touch register configuration type. More... | |
struct | tag_touch_at_status_t |
Autonomous QTouch status type. More... | |
struct | tag_touch_config_t |
Touch Input Configuration type. More... | |
struct | tag_touch_filter_data_t |
Touch Filter Callback data type. More... | |
struct | tag_touch_global_param_t |
Global sensor configuration info. More... | |
struct | tag_touch_info_t |
Touch library information type. More... | |
struct | tag_touch_measure_data_t |
Touch Measured data type. More... | |
struct | tag_touch_qt_config_t |
QTouch configuration input. More... | |
struct | tag_touch_qt_dma_t |
QTouch dma type. More... | |
struct | tag_touch_qt_param_t |
QTouch sensor configuration type. More... | |
struct | tag_touch_qt_pin_t |
QTouch pin configuration type. More... | |
struct | tag_touch_qt_reg_t |
QTouch register configuration type. More... | |
struct | tag_touch_qt_time_t |
QTouch Library Timing info. More... | |
Macros | |
#define | GET_QT_ROTOR_SLIDER_POSITION(ROTOR_SLIDER_NUMBER) p_qt_measure_data->p_rotor_slider_values[ROTOR_SLIDER_NUMBER] |
#define | GET_QT_SENSOR_STATE(SENSOR_NUMBER) p_qt_measure_data->p_sensor_states[(SENSOR_NUMBER/8)] & (1 << (SENSOR_NUMBER % 8)) |
#define | PRIV_QT_DATA_BLK_SIZE |
QTouch Data block size. More... | |
#define | PRIV_QT_PAD_BYTE_SIZE (36u) |
Size of QTouch Pad bytes. More... | |
#define | PRIV_QT_RS_TABLE_INIT NULL |
Initialize rotor slider table. More... | |
#define | PRIV_QT_SIZE_CHANNEL (25u) |
Size of QTouch Channel. More... | |
#define | PRIV_QT_SIZE_RS (13u) |
Size of QTouch Rotor Slider. More... | |
#define | PRIV_QT_SIZE_SENSOR (8u) |
Size of QTouch Sensor. More... | |
#define | QT_NUM_CHANNELS (QT_NUM_SENSOR_PINS_SELECTED) |
QTouch number of channels. More... | |
QTouch Library Acquisition Status bitfields. | |
#define | TOUCH_NO_ACTIVITY (0x0000u) |
No Touch activity. More... | |
#define | TOUCH_IN_DETECT (0x0001u) |
Atleast one Touch channel is in detect. More... | |
#define | TOUCH_STATUS_CHANGE (0x0002u) |
Change in Touch status of atleast one Touch channel. More... | |
#define | TOUCH_ROTOR_SLIDER_POS_CHANGE (0x0004u) |
Change in Rotor or Slider position of atleast one rotor or slider. More... | |
#define | TOUCH_CHANNEL_REF_CHANGE (0x0008u) |
Change in Reference value of atleast one Touch channel. More... | |
#define | TOUCH_BURST_AGAIN (0x0100u) |
Indicates that reburst is required to resolve Filtering or Calibration state. More... | |
#define | TOUCH_RESOLVE_CAL (0x0200u) |
Indicates that reburst is needed to resolve Calibration. More... | |
#define | TOUCH_RESOLVE_FILTERIN (0x0400u) |
Indicates that reburst is needed to resolve Filtering. More... | |
#define | TOUCH_RESOLVE_DI (0x0800u) |
Indicates that reburst is needed to resolve Detect Integration. More... | |
#define | TOUCH_RESOLVE_POS_RECAL (0x1000u) |
Indicates that reburst is needed to resolve Recalibration. More... | |
Typedefs | |
typedef enum tag_aks_group_t | aks_group_t |
Which AKS group, if any, a sensor is in. More... | |
typedef enum tag_at_status_change_t | at_status_change_t |
Autonomous Touch status change enum. More... | |
typedef uint8_t | channel_t |
Sensor start and end channel type of a Sensor. Channel number starts with value 0. More... | |
typedef enum tag_hysteresis_t | hysteresis_t |
A sensor detection hysteresis value. More... | |
typedef enum tag_qt_discharge_pin_options_t | qt_discharge_pin_options_t |
QTouch Pin options available. More... | |
typedef enum tag_qt_sensor_pin_options_t | qt_sensor_pin_options_t |
QTouch Pin options available. More... | |
typedef enum tag_recal_threshold_t | recal_threshold_t |
A sensor recalibration threshold. More... | |
typedef enum tag_resolution_t | resolution_t |
For rotors and sliders, the resolution of the reported angle or position. More... | |
typedef uint8_t | sensor_id_t |
Sensor number type. More... | |
typedef struct tag_sensor_t | sensor_t |
Sensor structure for storing sensor related information. More... | |
typedef enum tag_sensor_type_t | sensor_type_t |
Sensor types available. More... | |
typedef uint8_t | threshold_t |
An unsigned 8-bit number setting a sensor detection threshold. More... | |
typedef enum tag_touch_acq_mode_t | touch_acq_mode_t |
Touch library acquisition mode. More... | |
typedef uint16_t | touch_acq_status_t |
Status of Touch measurement. More... | |
typedef struct tag_touch_at_config_t | touch_at_config_t |
Autonomous Touch configuration input. More... | |
typedef struct tag_touch_at_pin_t | touch_at_pin_t |
Autonomous Touch pin configuration type. More... | |
typedef struct tag_touch_at_reg_t | touch_at_reg_t |
Autonomous Touch register configuration type. More... | |
typedef struct tag_touch_at_status_t | touch_at_status |
Autonomous QTouch status type. More... | |
typedef uint8_t | touch_bl_t |
QMatrix individual sensor burst length type. More... | |
typedef struct tag_touch_config_t | touch_config_t |
Touch Input Configuration type. More... | |
typedef int16_t | touch_delta_t |
Touch sensor delta value type. More... | |
typedef struct tag_touch_filter_data_t | touch_filter_data_t |
Touch Filter Callback data type. More... | |
typedef struct tag_touch_global_param_t | touch_global_param_t |
Global sensor configuration info. More... | |
typedef struct tag_touch_info_t | touch_info_t |
Touch library information type. More... | |
typedef enum tag_touch_lib_state_t | touch_lib_state_t |
Touch library state. More... | |
typedef struct tag_touch_measure_data_t | touch_measure_data_t |
Touch Measured data type. More... | |
typedef struct tag_touch_qt_config_t | touch_qt_config_t |
QTouch configuration input. More... | |
typedef struct tag_touch_qt_dma_t | touch_qt_dma_t |
QTouch dma type. More... | |
typedef struct tag_touch_qt_param_t | touch_qt_param_t |
QTouch sensor configuration type. More... | |
typedef struct tag_touch_qt_pin_t | touch_qt_pin_t |
QTouch pin configuration type. More... | |
typedef struct tag_touch_qt_reg_t | touch_qt_reg_t |
QTouch register configuration type. More... | |
typedef struct tag_touch_qt_time_t | touch_qt_time_t |
QTouch Library Timing info. More... | |
typedef enum tag_touch_ret_t | touch_ret_t |
Touch Library error codes. More... | |
typedef uint16_t | touch_time_t |
Current time type. More... | |
Functions | |
QTouch Helper API. | |
touch_ret_t | touch_sensors_init (void) |
This API is used to initialize and configure the Touch Library. 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_deinit (void) |
This API is used to deinitialize capacitive touch acquisition on QTouch Sensors. More... | |
void | touch_sensors_update_time (void) |
This API is used to update Timing info for QTouch Library. Typical usage of this API is inside a periodic timer ISR. 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... | |
void | touch_autonomous_sensor_disable (void) |
This API is used to disable Autonomous QTouch Sensor. More... | |
Autonomous QTouch API. | |
touch_ret_t | touch_at_sensor_enable (touch_config_t *p_touch_config) |
This API is used to initialize the Touch Library with Autonomous Touch pin and register configuration provided by the user. More... | |
touch_ret_t | touch_at_sensor_disable (void) |
Stop the Autonomous Touch sensor from doing Touch measurement. More... | |
touch_ret_t | touch_at_get_libinfo (touch_info_t *p_touch_info) |
This API can be used to read back Autonomous Touch configuration and status information in addition to the Touch Library version. More... | |
QTouch Library internal use functions. | |
void | touch_qt_rs_table_init (void) |
This is an extern function of the Touch Library. This function is NOT to be used by the user. More... | |
Variables | |
touch_measure_data_t * | p_qt_measure_data |
QTouch measured data pointer. More... | |
touch_qt_time_t | touch_qt_time |
QTouch Library Timing info. More... | |
QTouch API. | |
#define | touch_qt_sensors_init(y) touch_qt_sensors_init_with_rs_table( (y), PRIV_QT_RS_TABLE_INIT ); |
touch_ret_t touch_qt_sensors_init( touch_config_t *p_touch_config); More... | |
touch_ret_t | touch_qt_sensors_init_with_rs_table (touch_config_t *p_touch_config, void(*rs_table_init)(void)) |
This API is used to initialize the Touch Library with QTouch pin, register and sensor configuration provided by the user. More... | |
touch_ret_t | touch_qt_sensor_config (sensor_type_t sensor_type, channel_t from_channel, channel_t to_channel, aks_group_t aks_group, threshold_t detect_threshold, hysteresis_t detect_hysteresis, resolution_t position_resolution, sensor_id_t *p_sensor_id) |
This API can be used to configure a sensor of type key, rotor or slider. More... | |
touch_ret_t | touch_qt_sensors_calibrate (void) |
This API is used to calibrate the sensors for the first time before starting a Touch measurement. This API can also be used to force calibration of sensors when any of the Touch sensor parameters are changed during runtime. More... | |
touch_ret_t | touch_qt_sensors_start_acquisition (touch_time_t current_time_ms, touch_qt_dma_t qt_dma_ch, touch_acq_mode_t qt_acq_mode, void(*measure_complete_callback)(void)) |
This API can be used to start a QTouch measurement. More... | |
touch_ret_t | touch_qt_get_libinfo (touch_info_t *p_touch_info) |
This API can be used to get the Touch Library configuration information for QTouch acquisition method. More... | |
touch_ret_t | touch_qt_sensor_get_delta (sensor_id_t sensor_id, touch_delta_t *p_delta) |
This API can be used retrieve the delta value corresponding to a given sensor. More... | |
void | touch_event_dispatcher (void) |
Touch Library Event Dispatcher. More... | |
void | touch_qt_deinit (void) |
This API can be used to deinitialize the touch library. Once this API is called, capacitive touch acquisition is stopped and the CATB hardware module is disabled. Before calling this API, use touch_qt_get_libinfo(&touch_info) and ensure that the library state is TOUCH_STATE_READY. if (touch_info.tlib_state == TOUCH_STATE_READY) { touch_sensors_deinit();}. More... | |