Microchip® Advanced Software Framework

thirdparty/qtouch/devspecific/uc3/uc3l0/include/touch_api_at32uc3l.h File Reference

This file contains the AT32UC3L QTouch Libary API interface for QMatrix, QTouch and Autonomous Touch method using the Capacitive Touch (CAT) module.

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

#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include "touch_config_at32uc3l.h"

Data Structures

struct  tag_sensor_t
 
struct  tag_touch_at_config_t
 
struct  tag_touch_at_param_t
 
struct  tag_touch_at_pin_t
 
struct  tag_touch_at_reg_t
 
struct  tag_touch_at_status_t
 
struct  tag_touch_config_t
 
struct  tag_touch_filter_data_t
 
struct  tag_touch_general_config_t
 
struct  tag_touch_global_param_t
 
struct  tag_touch_info_t
 
struct  tag_touch_measure_data_t
 
struct  tag_touch_qm_config_t
 
struct  tag_touch_qm_dma_t
 
struct  tag_touch_qm_param_t
 
struct  tag_touch_qm_pin_t
 
struct  tag_touch_qm_reg_t
 
struct  tag_touch_qt_config_t
 
struct  tag_touch_qt_param_t
 
struct  tag_touch_qt_pin_t
 
struct  tag_touch_qt_reg_t
 

Macros

#define PRIV_QT_RS_TABLE_INIT   NULL
 Initialize rotor slider table. More...
 
QTouch Library Acquisition Status bitfields.

Enable QDebug interface

#define TOUCH_NO_ACTIVITY   (0x0000u)
 
#define TOUCH_IN_DETECT   (0x0001u)
 
#define TOUCH_STATUS_CHANGE   (0x0002u)
 
#define TOUCH_ROTOR_SLIDER_POS_CHANGE   (0x0004u)
 
#define TOUCH_CHANNEL_REF_CHANGE   (0x0008u)
 
#define TOUCH_BURST_AGAIN   (0x0100u)
 
#define TOUCH_RESOLVE_CAL   (0x0200u)
 
#define TOUCH_RESOLVE_FILTERIN   (0x0400u)
 
#define TOUCH_RESOLVE_DI   (0x0800u)
 
#define TOUCH_RESOLVE_POS_RECAL   (0x1000u)
 
QTouch method Acquisition Sensor Groups.
#define TOUCH_QT_GRP_A   (0u)
 
#define TOUCH_QT_GRP_B   (1u)
 

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
 
typedef uint8_t channel_t
 
typedef enum
tag_general_pin_options_t 
general_pin_options_t
 
typedef enum tag_hysteresis_t hysteresis_t
 A sensor detection hysteresis value. More...
 
typedef enum tag_qt_pin_options_t qt_pin_options_t
 
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
 
typedef struct tag_sensor_t sensor_t
 
typedef enum tag_sensor_type_t sensor_type_t
 
typedef uint8_t threshold_t
 
typedef enum tag_touch_acq_mode_t touch_acq_mode_t
 
typedef uint16_t touch_acq_status_t
 
typedef struct
tag_touch_at_config_t 
touch_at_config_t
 
typedef struct tag_touch_at_param_t touch_at_param_t
 
typedef struct tag_touch_at_pin_t touch_at_pin_t
 
typedef struct tag_touch_at_reg_t touch_at_reg_t
 
typedef struct
tag_touch_at_status_t 
touch_at_status
 
typedef uint8_t touch_bl_t
 
typedef struct tag_touch_config_t touch_config_t
 
typedef int16_t touch_delta_t
 
typedef struct
tag_touch_filter_data_t 
touch_filter_data_t
 
typedef struct
tag_touch_general_config_t 
touch_general_config_t
 
typedef struct
tag_touch_global_param_t 
touch_global_param_t
 
typedef struct tag_touch_info_t touch_info_t
 
typedef enum tag_touch_lib_state_t touch_lib_state_t
 
typedef struct
tag_touch_measure_data_t 
touch_measure_data_t
 
typedef struct
tag_touch_qm_config_t 
touch_qm_config_t
 
typedef struct tag_touch_qm_dma_t touch_qm_dma_t
 
typedef struct tag_touch_qm_param_t touch_qm_param_t
 
typedef struct tag_touch_qm_pin_t touch_qm_pin_t
 
typedef struct tag_touch_qm_reg_t touch_qm_reg_t
 
typedef struct
tag_touch_qt_config_t 
touch_qt_config_t
 
typedef uint8_t touch_qt_dma_t
 
typedef uint8_t touch_qt_grp_t
 
typedef struct tag_touch_qt_param_t touch_qt_param_t
 
typedef struct tag_touch_qt_pin_t touch_qt_pin_t
 
typedef struct tag_touch_qt_reg_t touch_qt_reg_t
 
typedef enum tag_touch_ret_t touch_ret_t
 
typedef uint16_t touch_time_t
 
typedef enum tag_x_pin_options_t x_pin_options_t
 
typedef enum tag_y_pin_options_t y_pin_options_t
 

Enumerations

enum  tag_aks_group_t {
  NO_AKS_GROUP,
  AKS_GROUP_1,
  AKS_GROUP_2,
  AKS_GROUP_3,
  AKS_GROUP_4,
  AKS_GROUP_5,
  AKS_GROUP_6,
  AKS_GROUP_7,
  MAX_AKS_GROUP,
  NO_AKS_GROUP,
  AKS_GROUP_1,
  AKS_GROUP_2,
  AKS_GROUP_3,
  AKS_GROUP_4,
  AKS_GROUP_5,
  AKS_GROUP_6,
  AKS_GROUP_7,
  MAX_AKS_GROUP
}
 Which AKS group, if any, a sensor is in. More...
 
enum  tag_at_status_change_t {
  OUT_OF_TOUCH,
  IN_TOUCH,
  OUT_OF_TOUCH,
  IN_TOUCH
}
 
enum  tag_general_pin_options_t {
  USE_NO_PIN = 0u,
  USE_PIN_PA12_AS_SMP,
  USE_PIN_PA13_AS_SMP,
  USE_PIN_PA14_AS_SMP,
  USE_PIN_PA17_AS_SMP,
  USE_PIN_PA21_AS_SMP,
  USE_PIN_PA22_AS_SMP,
  USE_PIN_PA17_AS_DIS,
  USE_PIN_PB11_AS_VDIV,
  USE_PIN_PA15_AS_SYNC,
  USE_PIN_PA18_AS_SYNC,
  USE_PIN_PA19_AS_SYNC,
  USE_PIN_PB08_AS_SYNC,
  USE_PIN_PB12_AS_SYNC,
  USE_NO_PIN = 0u,
  USE_PIN_PA12_AS_SMP,
  USE_PIN_PA13_AS_SMP,
  USE_PIN_PA14_AS_SMP,
  USE_PIN_PA17_AS_SMP,
  USE_PIN_PA21_AS_SMP,
  USE_PIN_PA22_AS_SMP,
  USE_PIN_PA17_AS_DIS,
  USE_PIN_PB11_AS_VDIV,
  USE_PIN_PA15_AS_SYNC,
  USE_PIN_PA18_AS_SYNC,
  USE_PIN_PA19_AS_SYNC,
  USE_PIN_PB08_AS_SYNC,
  USE_PIN_PB12_AS_SYNC
}
 
enum  tag_hysteresis_t {
  HYST_50,
  HYST_25,
  HYST_12_5,
  HYST_6_25,
  MAX_HYST,
  HYST_50,
  HYST_25,
  HYST_12_5,
  HYST_6_25,
  MAX_HYST
}
 A sensor detection hysteresis value. More...
 
enum  tag_qt_pin_options_t {
  SP0,
  SP1,
  SP2,
  SP3,
  SP4,
  SP5,
  SP6,
  SP7,
  SP8,
  SP9,
  SP10,
  SP11,
  SP12,
  SP13,
  SP14,
  SP15,
  SP16,
  SP0,
  SP1,
  SP2,
  SP3,
  SP4,
  SP5,
  SP6,
  SP7,
  SP8,
  SP9,
  SP10,
  SP11,
  SP12,
  SP13,
  SP14,
  SP15,
  SP16
}
 
enum  tag_recal_threshold_t {
  RECAL_100,
  RECAL_50,
  RECAL_25,
  RECAL_12_5,
  RECAL_6_25,
  MAX_RECAL,
  RECAL_100,
  RECAL_50,
  RECAL_25,
  RECAL_12_5,
  RECAL_6_25,
  MAX_RECAL
}
 A sensor recalibration threshold. More...
 
enum  tag_resolution_t {
  RES_1_BIT,
  RES_2_BIT,
  RES_3_BIT,
  RES_4_BIT,
  RES_5_BIT,
  RES_6_BIT,
  RES_7_BIT,
  RES_8_BIT,
  MAX_RES,
  RES_1_BIT,
  RES_2_BIT,
  RES_3_BIT,
  RES_4_BIT,
  RES_5_BIT,
  RES_6_BIT,
  RES_7_BIT,
  RES_8_BIT,
  MAX_RES
}
 For rotors and sliders, the resolution of the reported angle or position. More...
 
enum  tag_sensor_type_t {
  SENSOR_TYPE_UNASSIGNED,
  SENSOR_TYPE_KEY,
  SENSOR_TYPE_ROTOR,
  SENSOR_TYPE_SLIDER,
  MAX_SENSOR_TYPE,
  SENSOR_TYPE_UNASSIGNED,
  SENSOR_TYPE_KEY,
  SENSOR_TYPE_ROTOR,
  SENSOR_TYPE_SLIDER,
  MAX_SENSOR_TYPE
}
 
enum  tag_touch_acq_mode_t {
  RAW_ACQ_MODE,
  NORMAL_ACQ_MODE,
  RAW_ACQ_MODE,
  NORMAL_ACQ_MODE
}
 
enum  tag_touch_lib_state_t {
  TOUCH_STATE_NULL,
  TOUCH_STATE_INIT,
  TOUCH_STATE_READY,
  TOUCH_STATE_CALIBRATE,
  TOUCH_STATE_BUSY,
  TOUCH_STATE_NULL,
  TOUCH_STATE_INIT,
  TOUCH_STATE_READY,
  TOUCH_STATE_CALIBRATE,
  TOUCH_STATE_BUSY
}
 
enum  tag_touch_ret_t {
  TOUCH_SUCCESS,
  TOUCH_ACQ_INCOMPLETE,
  TOUCH_INVALID_INPUT_PARAM,
  TOUCH_INVALID_LIB_STATE,
  TOUCH_INVALID_QM_CONFIG_PARAM,
  TOUCH_INVALID_AT_CONFIG_PARAM,
  TOUCH_INVALID_QT_CONFIG_PARAM,
  TOUCH_INVALID_GENERAL_CONFIG_PARAM,
  TOUCH_INVALID_QM_NUM_X_LINES,
  TOUCH_INVALID_QM_NUM_Y_LINES,
  TOUCH_INVALID_QM_NUM_SENSORS,
  TOUCH_INVALID_MAXDEV_VALUE,
  TOUCH_INVALID_RECAL_THRESHOLD,
  TOUCH_INVALID_CHANNEL_NUM,
  TOUCH_INVALID_SENSOR_TYPE,
  TOUCH_INVALID_SENSOR_ID,
  TOUCH_INVALID_DMA_PARAM,
  TOUCH_FAILURE_ANALOG_COMP,
  TOUCH_INVALID_RS_NUM,
  TOUCH_SUCCESS,
  TOUCH_ACQ_INCOMPLETE,
  TOUCH_INVALID_INPUT_PARAM,
  TOUCH_INVALID_LIB_STATE,
  TOUCH_INVALID_QM_CONFIG_PARAM,
  TOUCH_INVALID_AT_CONFIG_PARAM,
  TOUCH_INVALID_QT_CONFIG_PARAM,
  TOUCH_INVALID_GENERAL_CONFIG_PARAM,
  TOUCH_INVALID_QM_NUM_X_LINES,
  TOUCH_INVALID_QM_NUM_Y_LINES,
  TOUCH_INVALID_QM_NUM_SENSORS,
  TOUCH_INVALID_MAXDEV_VALUE,
  TOUCH_INVALID_RECAL_THRESHOLD,
  TOUCH_INVALID_CHANNEL_NUM,
  TOUCH_INVALID_SENSOR_TYPE,
  TOUCH_INVALID_SENSOR_ID,
  TOUCH_INVALID_DMA_PARAM,
  TOUCH_FAILURE_ANALOG_COMP,
  TOUCH_INVALID_RS_NUM
}
 
enum  tag_x_pin_options_t {
  X0,
  X1,
  X2,
  X3,
  X4,
  X5,
  X6,
  X7,
  X8,
  X9,
  X10,
  X11,
  X12,
  X13,
  X14,
  X15,
  X16,
  X17,
  X0,
  X1,
  X2,
  X3,
  X4,
  X5,
  X6,
  X7,
  X8,
  X9,
  X10,
  X11,
  X12,
  X13,
  X14,
  X15,
  X16,
  X17
}
 
enum  tag_y_pin_options_t {
  Y0_YK0,
  Y1_YK1,
  Y2_YK2,
  Y3_YK3,
  Y4_YK4,
  Y5_YK5,
  Y6_YK6,
  Y7_YK7,
  Y0_YK0,
  Y1_YK1,
  Y2_YK2,
  Y3_YK3,
  Y4_YK4,
  Y5_YK5,
  Y6_YK6,
  Y7_YK7
}
 

Functions

Autonomous QTouch API.
touch_ret_t touch_at_sensor_init (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_update_config (touch_at_param_t *p_at_param)
 This API is used to update the register configuration information of the Autonomous Touch sensor. More...
 
touch_ret_t touch_at_sensor_get_config (touch_at_param_t *p_at_param)
 This API is used to read back the register configuration information of the Autonomous Touch sensor. More...
 
touch_ret_t touch_at_sensor_enable (void(*touch_at_status_change_interrupt_callback)(touch_at_status *p_at_status))
 Enable the Autonomous Touch sensor to start Touch measurement. 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...
 
Common API.
void touch_event_dispatcher (void)
 Touch Library Event Dispatcher. Common to QTouch Group A, QTouch Group B or QMatrix Acquisition methods. More...
 
void touch_deinit (void)
 This API can be used to deinitialize the touch library. Once this API is called, both the QMatrix method and Autonomous Touch method acquisition is stopped and the CAT hardware module is disabled. More...
 
QTouch Library internal use functions.
void touch_qm_rs_table_init (void)
 This Touch Library ISR must be registered to the Interrupt Controller module when using the GCC Compiler. More...
 
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...
 
void touch_qta_table_init (void)
 This is an extern function of the Touch Library. This function is NOT to be used by the user. More...
 
void touch_qtb_table_init (void)
 This is an extern function of the Touch Library. This function is NOT to be used by the user. More...
 

QMatrix API.

#define touch_qm_sensors_init(x)
 touch_ret_t touch_qm_sensors_init( touch_config_t *p_touch_config); More...
 
touch_ret_t touch_qm_sensors_init_with_rs_table (touch_config_t *p_touch_config,(void))
 This API is used to initialize the Touch Library with QMatrix pin, register and sensor configuration provided by the user. More...
 
touch_ret_t touch_qm_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, uint8_t position_hysteresis, 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_qm_sensor_update_config (sensor_id_t sensor_id, touch_qm_param_t *p_touch_sensor_param)
 This API can be used to set the sensor configuration parameters. More...
 
touch_ret_t touch_qm_sensor_get_config (sensor_id_t sensor_id, touch_qm_param_t *p_touch_sensor_param)
 This API can be used to read back the sensor configuration parameters information is being seeked. More...
 
touch_ret_t touch_qm_channel_update_burstlen (channel_t channel_id, touch_bl_t qm_burst_length)
 This API can be used to update the burst length of a give input channel. More...
 
touch_ret_t touch_qm_update_global_param (touch_global_param_t *p_global_param)
 This API can be used to update the global parameter of QMatrix method. More...
 
touch_ret_t touch_qm_get_global_param (touch_global_param_t *p_global_param)
 This API can be used to read back the global parameter of QMatrix method. More...
 
touch_ret_t touch_qm_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_qm_sensors_start_acquisition (touch_time_t current_time_ms, touch_qm_dma_t *p_qm_dma, touch_acq_mode_t qm_acq_mode, void(*measure_complete_callback)(touch_measure_data_t *p_measure_data))
 This API can be used to start a QMatrix Touch measurement. More...
 
touch_ret_t touch_qm_get_libinfo (touch_info_t *p_touch_info)
 This API can be used to get the Touch Library configuration information for QMatrix Touch acquisition method. More...
 
touch_ret_t touch_qm_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...
 

QTouch Group A/Group B API.

#define touch_qt_sensors_init(x, y)
 touch_ret_t touch_qt_sensors_init( touch_qt_grp_t touch_qt_grp, touch_config_t *p_touch_config); More...
 
touch_ret_t touch_qt_sensors_init_with_rs_table (touch_qt_grp_t touch_qt_grp, touch_config_t *p_touch_config,(void),(void))
 This API is used to initialize the Touch Library with QTouch Group A or QTouch Group B pin, register and sensor configuration provided by the user. More...
 
touch_ret_t touch_qt_sensor_config (touch_qt_grp_t touch_qt_grp, 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_sensor_update_config (touch_qt_grp_t touch_qt_grp, sensor_id_t sensor_id, touch_qt_param_t *p_touch_sensor_param)
 This API can be used to set the sensor configuration parameters. More...
 
touch_ret_t touch_qt_sensor_get_config (touch_qt_grp_t touch_qt_grp, sensor_id_t sensor_id, touch_qt_param_t *p_touch_sensor_param)
 This API can be used to read back the sensor configuration parameters. More...
 
touch_ret_t touch_qt_update_global_param (touch_qt_grp_t touch_qt_grp, touch_global_param_t *p_global_param)
 This API can be used to update the global parameter of QTouch method. More...
 
touch_ret_t touch_qt_get_global_param (touch_qt_grp_t touch_qt_grp, touch_global_param_t *p_global_param)
 This API can be used to read back the global parameter of QTouch method. More...
 
touch_ret_t touch_qt_sensors_calibrate (touch_qt_grp_t touch_qt_grp)
 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_qt_grp_t touch_qt_grp, touch_time_t current_time_ms, touch_qt_dma_t qt_dma_ch, touch_acq_mode_t qt_acq_mode, void(*measure_complete_callback)(touch_measure_data_t *p_measure_data))
 This API can be used to start a QTouch Group A or QTouch Group B Touch measurement. More...
 
touch_ret_t touch_qt_get_libinfo (touch_qt_grp_t touch_qt_grp, touch_info_t *p_touch_info)
 This API can be used to get the Touch Library configuration information for QTouch Group A or Group B acquisition method. More...
 
touch_ret_t touch_qt_sensor_get_delta (touch_qt_grp_t touch_qt_grp, 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...
 
touch_ret_t touch_qt_sensor_disable (touch_qt_grp_t touch_qt_grp, sensor_id_t sensor_id)
 This API can be used disable acquisition on a given Touch Sensor. More...
 
touch_ret_t touch_qt_sensor_reenable (touch_qt_grp_t touch_qt_grp, sensor_id_t sensor_id)
 This API can be used re-enable acquisition on a disabled Touch Sensor. More...