Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
QTouch Library

for AVR UC3 L0

This is the QTouch Library for ARV UC3 L0 devices that consists in one api header file(touch_api_at32uc3l.h) and one pre-compiled library(libuc3l-qtouch-gnu.a). All projects using this library must also provide the required header file(touch_config_at32uc3l.h) used to configure the library. For more information on the Qtouch Library, check www.atmel.com/qtouchlib.

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 _DEBUG_INTERFACE_
 
#define PRIV_QT_RS_TABLE_INIT   NULL
 Initialize rotor slider table. 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
 
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
}
 Which AKS group, if any, a sensor is in. More...
 
enum  tag_at_status_change_t {
  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
}
 
enum  tag_hysteresis_t {
  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
}
 
enum  tag_recal_threshold_t {
  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
}
 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
}
 
enum  tag_touch_acq_mode_t {
  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
}
 
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
}
 
enum  tag_x_pin_options_t {
  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
}
 

QTouch Library Acquisition Status bitfields.

#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)
 

QMatrix API.

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...
 
#define touch_qm_sensors_init(x)
 touch_ret_t touch_qm_sensors_init( touch_config_t *p_touch_config); More...
 

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...
 

QTouch Group A/Group B API.

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...
 
#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...
 

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...
 

#define _DEBUG_INTERFACE_

Enable QDebug interface

#define PRIV_QT_RS_TABLE_INIT   NULL

Initialize rotor slider table.

#define TOUCH_BURST_AGAIN   (0x0100u)

Indicates that reburst is required to resolve Filtering or Calibration state.

#define TOUCH_CHANNEL_REF_CHANGE   (0x0008u)

Change in Reference value of atleast one Touch channel.

Referenced by QDebug_SendData().

#define TOUCH_IN_DETECT   (0x0001u)

Atleast one Touch channel is in detect.

#define TOUCH_NO_ACTIVITY   (0x0000u)

No Touch activity.

#define touch_qm_sensors_init (   x)
Value:
PRIV_QM_RS_TABLE_INIT )
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 ...

touch_ret_t touch_qm_sensors_init( touch_config_t *p_touch_config);

#define TOUCH_QT_GRP_A   (0u)

QTouch Group A.

#define TOUCH_QT_GRP_B   (1u)

QTouch Group B.

#define touch_qt_sensors_init (   x,
 
)
Value:
((x) == TOUCH_QT_GRP_A) ?\
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...
#define TOUCH_QT_GRP_A
Definition: touch_api_at32uc3l.h:135
#define PRIV_QT_RS_TABLE_INIT
Initialize rotor slider table.
Definition: touch_api_at32uc3l.h:378
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...
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...

touch_ret_t touch_qt_sensors_init( touch_qt_grp_t touch_qt_grp, touch_config_t *p_touch_config);

#define TOUCH_RESOLVE_CAL   (0x0200u)

Indicates that reburst is needed to resolve Calibration.

#define TOUCH_RESOLVE_DI   (0x0800u)

Indicates that reburst is needed to resolve Detect Integration.

#define TOUCH_RESOLVE_FILTERIN   (0x0400u)

Indicates that reburst is needed to resolve Filtering.

#define TOUCH_RESOLVE_POS_RECAL   (0x1000u)

Indicates that reburst is needed to resolve Recalibration.

#define TOUCH_ROTOR_SLIDER_POS_CHANGE   (0x0004u)

Change in Rotor or Slider position of atleast one rotor or slider.

Referenced by QDebug_SendData().

#define TOUCH_STATUS_CHANGE   (0x0002u)

Change in Touch status of atleast one Touch channel.

Referenced by QDebug_SendData().

Which AKS group, if any, a sensor is in.

NO_AKS_GROUP = sensor is not in an AKS group, and cannot be suppressed. AKS_GROUP_x = sensor is in AKS group x.

Autonomous Touch status change enum.

typedef uint8_t channel_t

Sensor start and end channel type of a Sensor. Channel number starts with value 0.

Options for SMP, DIS, VDIV and SYNC pins.

A sensor detection hysteresis value.

This is expressed as a percentage of the sensor detection threshold. HYST_x = hysteresis value is x% of detection threshold value (rounded down). NB: a minimum value of 2 is used.

Example: if detection threshold = 20, then: HYST_50 = 10 (50% of 20) HYST_25 = 5 (25% of 20) HYST_12_5 = 2 (12.5% of 20) HYST_6_25 = 2 (6.25% of 20 = 1, but value is hardlimited to 2)

Autonomous QTouch, QTouch Group A and QTouch Group B Pin options available.

A sensor recalibration threshold.

This is expressed as a percentage of the sensor detection threshold. RECAL_x = recalibration threshold is x% of detection threshold value (rounded down). NB: a minimum value of 4 is used.

Example: if detection threshold = 40, then: RECAL_100 = 40 (100% of 40) RECAL_50 = 20 (50% of 40) RECAL_25 = 10 (25% of 40) RECAL_12_5 = 5 (12.5% of 40) RECAL_6_25 = 4 (6.25% of 40 = 2, but value is hardlimited to 4)

For rotors and sliders, the resolution of the reported angle or position.

RES_x_BIT = rotor/slider reports x-bit values.

Example: if slider resolution is RES_7_BIT, then reported positions are in the range 0..127.

typedef uint8_t sensor_id_t

Sensor number type.

typedef struct tag_sensor_t sensor_t

Sensor structure for storing sensor related information.

Sensor types available.

typedef uint8_t threshold_t

An unsigned 8-bit number setting a sensor detection threshold.

Touch library acquisition mode.

typedef uint16_t touch_acq_status_t

Status of Touch measurement.

Autonomous Touch configuration input.

Autonomous Touch sensor param type.

Autonomous Touch pin configuration type.

Autonomous Touch register configuration type.

Autonomous QTouch status type.

typedef uint8_t touch_bl_t

QMatrix individual sensor burst length type.

Touch Input Configuration type.

typedef int16_t touch_delta_t

Touch sensor delta value type.

Touch Filter Callback data type.

Touch General configuration input common to QMatrix, QTouch and Autonomous Touch.

Global sensor configuration info.

Touch library information type.

Touch library state.

Touch Measured data type.

QMatrix configuration input.

QMatrix dma type.

QMatrix sensor configuration type.

QMatrix pin configuration type.

QMatrix register configuration type.

QTouch Group A/Group B configuration input.

typedef uint8_t touch_qt_dma_t

QTouch Group A/ Group B DMA channel type.

typedef uint8_t touch_qt_grp_t

QTouch Group type. Used to identify TOUCH_QT_GRP_A or TOUCH_QT_GRP_B.

QTouch Group A/Group B sensor configuration type.

QTouch Group A/Group B pin configuration type.

QTouch Group A/Group B register configuration type.

Touch Library error codes.

typedef uint16_t touch_time_t

Current time type.

QMatrix Sensor pair types available.

QMatrix Y Pin options available.

Which AKS group, if any, a sensor is in.

NO_AKS_GROUP = sensor is not in an AKS group, and cannot be suppressed. AKS_GROUP_x = sensor is in AKS group x.

Enumerator
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 

Autonomous Touch status change enum.

Enumerator
OUT_OF_TOUCH 

Autonomous Touch Status has changed to Out of Touch.

IN_TOUCH 

Autonomous Touch Status has changed to In Touch.

Options for SMP, DIS, VDIV and SYNC pins.

Enumerator
USE_NO_PIN 
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 

A sensor detection hysteresis value.

This is expressed as a percentage of the sensor detection threshold. HYST_x = hysteresis value is x% of detection threshold value (rounded down). NB: a minimum value of 2 is used.

Example: if detection threshold = 20, then: HYST_50 = 10 (50% of 20) HYST_25 = 5 (25% of 20) HYST_12_5 = 2 (12.5% of 20) HYST_6_25 = 2 (6.25% of 20 = 1, but value is hardlimited to 2)

Enumerator
HYST_50 
HYST_25 
HYST_12_5 
HYST_6_25 
MAX_HYST 

Autonomous QTouch, QTouch Group A and QTouch Group B Pin options available.

Enumerator
SP0 
SP1 
SP2 
SP3 
SP4 
SP5 
SP6 
SP7 
SP8 
SP9 
SP10 
SP11 
SP12 
SP13 
SP14 
SP15 
SP16 

A sensor recalibration threshold.

This is expressed as a percentage of the sensor detection threshold. RECAL_x = recalibration threshold is x% of detection threshold value (rounded down). NB: a minimum value of 4 is used.

Example: if detection threshold = 40, then: RECAL_100 = 40 (100% of 40) RECAL_50 = 20 (50% of 40) RECAL_25 = 10 (25% of 40) RECAL_12_5 = 5 (12.5% of 40) RECAL_6_25 = 4 (6.25% of 40 = 2, but value is hardlimited to 4)

Enumerator
RECAL_100 
RECAL_50 
RECAL_25 
RECAL_12_5 
RECAL_6_25 
MAX_RECAL 

For rotors and sliders, the resolution of the reported angle or position.

RES_x_BIT = rotor/slider reports x-bit values.

Example: if slider resolution is RES_7_BIT, then reported positions are in the range 0..127.

Enumerator
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 

Sensor types available.

Enumerator
SENSOR_TYPE_UNASSIGNED 
SENSOR_TYPE_KEY 
SENSOR_TYPE_ROTOR 
SENSOR_TYPE_SLIDER 
MAX_SENSOR_TYPE 

Touch library acquisition mode.

Enumerator
RAW_ACQ_MODE 

When Raw acquisition mode is used, the measure_complete_callback

function is called immediately once a fresh value of Signals are

available. In this mode, the Touch Library does not do any

processing on the Signals. So, the References, Sensor states or

Rotor/Slider position values are not updated in this mode.

NORMAL_ACQ_MODE 

When Nomal acquisition mode is used, the measure_complete_callback

function is called only after the Touch Library completes processing

of the Signal values obtained. The References, Sensor states and

Rotor/Slider position values are updated in this mode.

Touch library state.

Enumerator
TOUCH_STATE_NULL 
TOUCH_STATE_INIT 
TOUCH_STATE_READY 
TOUCH_STATE_CALIBRATE 
TOUCH_STATE_BUSY 

Touch Library error codes.

Enumerator
TOUCH_SUCCESS 

Successful completion of operation.

TOUCH_ACQ_INCOMPLETE 

Touch Library is busy with pending previous Touch measurement.

TOUCH_INVALID_INPUT_PARAM 

Invalid input parameter.

TOUCH_INVALID_LIB_STATE 

Operation not allowed in the current Touch Library state.

TOUCH_INVALID_QM_CONFIG_PARAM 

Invalid QMatrix config input parameter.

TOUCH_INVALID_AT_CONFIG_PARAM 

Invalid Autonomous Touch config input parameter.

TOUCH_INVALID_QT_CONFIG_PARAM 

Invalid QTouch config input parameter.

TOUCH_INVALID_GENERAL_CONFIG_PARAM 

Invalid General config input parameter.

TOUCH_INVALID_QM_NUM_X_LINES 

Mismatch between number of X lines specified as QM_NUM_X_LINES

and number of X lines enabled in QMatrix pin configuration

touch_qm_pin_t x_lines.

TOUCH_INVALID_QM_NUM_Y_LINES 

Mismatch between number of Y lines specified as QM_NUM_Y_LINES

and number of Y lines enabled in QMatrix pin configuration

touch_qm_pin_t y_yk_lines.

TOUCH_INVALID_QM_NUM_SENSORS 

Number of Sensors specified is greater than

(Number of X Lines * Number of Y Lines)

TOUCH_INVALID_MAXDEV_VALUE 

Spread spectrum MAXDEV value should not exceed (2*DIV + 1).

TOUCH_INVALID_RECAL_THRESHOLD 

Invalid Recalibration threshold input value.

TOUCH_INVALID_CHANNEL_NUM 

Channel number parameter exceeded total number of channels configured.

TOUCH_INVALID_SENSOR_TYPE 

Invalid sensor type. Sensor type can NOT be SENSOR_TYPE_UNASSIGNED.

TOUCH_INVALID_SENSOR_ID 

Invalid Sensor number parameter.

TOUCH_INVALID_DMA_PARAM 

DMA Channel numbers are out of range.

TOUCH_FAILURE_ANALOG_COMP 

Analog comparator configuration error. Analog comparator output is not ready.

or Analog comparator has been Enabled before calling the QTouch Library.

TOUCH_INVALID_RS_NUM 

Number of Rotor/Sliders set as 0,

when trying to configure a rotor/slider.

QMatrix Sensor pair types available.

Enumerator
X0 
X1 
X2 
X3 
X4 
X5 
X6 
X7 
X8 

Note: X8 pin must NOT be used as X Line and it is recommended to be used as ACREFN pin for QMatrix.

X9 
X10 
X11 
X12 
X13 
X14 
X15 
X16 
X17 

QMatrix Y Pin options available.

Enumerator
Y0_YK0 
Y1_YK1 
Y2_YK2 
Y3_YK3 
Y4_YK4 
Y5_YK5 
Y6_YK6 
Y7_YK7 

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.

Returns
touch_ret_t: QTouch Library Error status.
touch_ret_t touch_at_sensor_disable ( void  )

Stop the Autonomous Touch sensor from doing Touch measurement.

Returns
touch_ret_t: QTouch Library Error status.
touch_ret_t touch_at_sensor_enable ( void(*)(touch_at_status *p_at_status)  touch_at_status_change_interrupt_callback)

Enable the Autonomous Touch sensor to start Touch measurement.

Parameters
touch_at_status_change_interrupt_callback,:Autonomous Touch Status Change Callback function. p_at_status: Autonomous Touch status change.
Returns
touch_ret_t: QTouch Library Error status.

Referenced by touch_api_init().

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.

Parameters
p_at_param,:Autonomous Touch sensor configuration paramter updated by the Touch Library.
Returns
touch_ret_t: QTouch Library Error status.
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.

Parameters
p_touch_config,:Pointer to Touch configuration structure.
Returns
touch_ret_t: QTouch Library Error status.

Referenced by touch_api_init().

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.

Parameters
p_at_param,:Autonomous Touch sensor configuration paramter input to the Touch Library.
Returns
touch_ret_t: QTouch Library Error status.
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.

Note
In an application if the user would like to call touch_qm_sensors_init() or the touch_at_sensor_init() API more than once, then the touch_deinit() API must be called before calling the touch_qm_sensors_init() or the touch_at_sensor_init() the second time. Also, incase any of the Touch API return an error, the the user must call the touch_deinit() API before calling the touch_qm_sensors_init() or the touch_at_sensor_init() API.
Returns
touch_ret_t: QTouch Library Error status.
void touch_event_dispatcher ( void  )

Touch Library Event Dispatcher. Common to QTouch Group A, QTouch Group B or QMatrix Acquisition methods.

Note
This API does not apply for Autonomous QTouch.
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.

Parameters
channel_id,:The channel id of the Touch sensor for which burst length is to be updated.
qm_burst_length,:The burst length value.
Returns
touch_ret_t: QTouch Library Error status.
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.

Parameters
p_global_param,:The pointer to readback the QMatrix global sensor configuration.
Returns
touch_ret_t: QTouch Library Error status.
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.

Parameters
p_touch_info,:Pointer to the Touch info data structure that will be updated by the Touch Library.
Returns
touch_ret_t: QTouch Library Error status.
void touch_qm_rs_table_init ( void  )

This Touch Library ISR must be registered to the Interrupt Controller module when using the GCC Compiler.

This is an extern function of the Touch Library. This function is NOT to be used by the user.

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.

Parameters
sensor_type,:can be of type key, rotor or slider.
from_channel,:the first channel in the slider sensor.
to_channel,:the last channel in the slider sensor.
aks_group,:which AKS group (if any) the sensor is in.
detect_threshold,:the sensor detection threshold.
detect_hysteresis,:the sensor detection hysteresis value.
position_resolution,:the resolution of the reported position value.
position_hysteresis,:the hysteresis of the reported position value.
p_sensor_id,:The sensor id value of the configured sensor is updated by the Touch Library.
Note
Range of position_hysteresis value is from 0 to 7.
Returns
touch_ret_t: QTouch Library Error status.
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.

Parameters
sensor_id,:The sensor id for which configuration parameter.
p_touch_sensor_param,:The touch sensor parameter structure that will be updated by the Touch Library.
Returns
touch_ret_t: QTouch Library Error status.
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.

Parameters
sensor_id,:The sensor id for which delta value is being seeked.
p_delta,:Pointer to the delta variable to be updated by the Touch Library.
Returns
touch_ret_t: QTouch Library Error status.
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.

Parameters
sensor_id,:The sensor id for which configuration parameter information is being set.
p_touch_sensor_param,:The touch sensor parameter structure that will be used by the Touch Library to update.
Returns
touch_ret_t: QTouch Library Error status.
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.

Returns
touch_ret_t: QTouch Library Error status.
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.

Parameters
p_touch_config,:Pointer to Touch configuration structure.
Returns
touch_ret_t: QTouch Library Error status.
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(*)(touch_measure_data_t *p_measure_data)  measure_complete_callback 
)

This API can be used to start a QMatrix Touch measurement.

Parameters
current_time_ms,:Current time in millisecond.
p_qm_dma,:Pointer to the dma channels to be used for Touch measurement.
qm_acq_mode,:Specify whether Raw acquisition mode or Normal acquisition mode is be used.
measure_complete_callback,:This callback function is called by the Touch Library once the QMatrix Touch measurement is complete. This callback function provides pointers related to the measured touch data and touch status. p_measure_data: QMatrix sensor status and measured data pointer.
Returns
touch_ret_t: QTouch Library Error status.
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.

Parameters
p_global_param,:The pointer to QMatrix global sensor configuration.
Returns
touch_ret_t: QTouch Library Error status.
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.

Parameters
touch_qt_grp,:Choose QTouch Group A or Group B.
p_global_param,:The pointer to readback the QTouch Group A or QTouch Group B global sensor configuration.
Returns
touch_ret_t: QTouch Library Error status.
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.

Parameters
touch_qt_grp,:Choose QTouch Group A or Group B.
p_touch_info,:Pointer to the Touch info data structure that will be updated by the Touch Library.
Returns
touch_ret_t: QTouch Library Error status.
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.

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.

Parameters
touch_qt_grp,:Choose QTouch Group A or Group B.
sensor_type,:can be of type key, rotor or slider.
from_channel,:the first channel in the slider sensor.
to_channel,:the last channel in the slider sensor.
aks_group,:which AKS group (if any) the sensor is in.
detect_threshold,:the sensor detection threshold.
detect_hysteresis,:the sensor detection hysteresis value.
position_resolution,:the resolution of the reported position value.
p_sensor_id,:The sensor id value of the configured sensor is updated by the Touch Library.
Note
Range of position_hysteresis value is from 0 to 7.
Returns
touch_ret_t: QTouch Library Error status.
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.

Parameters
touch_qt_grp,:Choose QTouch Group A or Group B.
sensor_id,:The Sensor number for which acquisition is disabled.
Returns
touch_ret_t: QTouch Library Error status.
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.

Parameters
touch_qt_grp,:Choose QTouch Group A or Group B.
sensor_id,:The sensor id for which configuration parameter information is being seeked.
p_touch_sensor_param,:The touch sensor parameter structure that will be updated by the Touch Library.
Returns
touch_ret_t: QTouch Library Error status.
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.

Parameters
touch_qt_grp,:Choose QTouch Group A or Group B.
sensor_id,:The sensor id for which delta value is being seeked.
p_delta,:Pointer to the delta variable to be updated by the Touch Library.
Returns
touch_ret_t: QTouch Library Error status.
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.

Parameters
touch_qt_grp,:Choose QTouch Group A or Group B.
sensor_id,:The Sensor number for which acquisition is disabled.
Note
The touch_qt_sensor_config() API enables acquisition on a given Sensor by default. This API is only used to re-enable acquisition on a sensor that is disabled using the touch_qt_disable_sensor() API.
Returns
touch_ret_t: QTouch Library Error status.
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.

Parameters
touch_qt_grp,:Choose QTouch Group A or Group B.
sensor_id,:The sensor id for which configuration parameter information is being set.
p_touch_sensor_param,:The touch sensor parameter structure that will be used by the Touch Library to update.
Returns
touch_ret_t: QTouch Library Error status.
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.

Parameters
touch_qt_grp,:Choose QTouch Group A or Group B.
Returns
touch_ret_t: QTouch Library Error status.
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.

Parameters
touch_qt_grp,:Choose QTouch Group A or Group B.
p_touch_config,:Pointer to Touch configuration structure.
Returns
touch_ret_t: QTouch Library Error status.
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(*)(touch_measure_data_t *p_measure_data)  measure_complete_callback 
)

This API can be used to start a QTouch Group A or QTouch Group B Touch measurement.

Parameters
touch_qt_grp,:Choose QTouch Group A or Group B.
current_time_ms,:Current time in millisecond.
qt_dma_ch,:The dma channel to be used for Touch measurement.
qt_acq_mode,:Specify whether Raw acquisition mode or Normal acquisition mode is be used.
measure_complete_callback,:This callback function is called by the Touch Library once the QMatrix Touch measurement is complete. This callback function provides pointers related to the measured touch data and touch status. p_measure_data: QTouch Group A or Group B sensor status and measured data pointer.
Returns
touch_ret_t: QTouch Library Error status.
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.

Parameters
touch_qt_grp,:Choose QTouch Group A or Group B.
p_global_param,:The pointer to QTouch Group A or QTouch Group B global sensor configuration.
Returns
touch_ret_t: QTouch Library Error status.
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.

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.