Microchip® Advanced Software Framework

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

This is the QTouch Library for SAM4L devices that consists in one api header file(touch_api_sam4l.h) and one pre-compiled library(libsam4l-qt-gnu.a).

All projects using this library must also provide the required header file(touch_config_sam4l.h) used to configure the library.

For more information on the Qtouch Library, check www.atmel.com/qtouchlib.

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

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

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
}
 Autonomous Touch status change enum. More...
 
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_discharge_pin_options_t {
  DIS_PA02,
  DIS_PA12,
  DIS_PA23,
  DIS_PA31,
  DIS_PB03,
  DIS_PB12,
  DIS_PC05,
  DIS_PC14,
  DIS_PC23
}
 QTouch Pin options available. More...
 
enum  tag_qt_sensor_pin_options_t {
  SP_PA04,
  SP_PA27,
  SP_PB13,
  SP_PA05,
  SP_PA28,
  SP_PB14,
  SP_PA06,
  SP_PA29,
  SP_PB15,
  SP_PA07,
  SP_PA30,
  SP_PC00,
  SP_PA08,
  SP_PC01,
  SP_PA09,
  SP_PC02,
  SP_PA10,
  SP_PC03,
  SP_PA11,
  SP_PC04,
  SP_PA13,
  SP_PC06,
  SP_PA14,
  SP_PC07,
  SP_PA15,
  SP_PC08,
  SP_PA16,
  SP_PC09,
  SP_PA17,
  SP_PC10,
  SP_PA18,
  SP_PC11,
  SP_PA19,
  SP_PC12,
  SP_PA20,
  SP_PC13,
  SP_PA21,
  SP_PC15,
  SP_PA22,
  SP_PC16,
  SP_PA24,
  SP_PC17,
  SP_PA25,
  SP_PC18,
  SP_PA26,
  SP_PC19,
  SP_PB00,
  SP_PC20,
  SP_PB01,
  SP_PC21,
  SP_PB02,
  SP_PC22,
  SP_PB04,
  SP_PC24,
  SP_PB05,
  SP_PC25,
  SP_PB06,
  SP_PC26,
  SP_PB07,
  SP_PC27,
  SP_PB08,
  SP_PC28,
  SP_PB09,
  SP_PC29,
  SP_PB10,
  SP_PC30,
  SP_PB11,
  SP_PC31
}
 QTouch Pin options available. More...
 
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
}
 Sensor types available. More...
 
enum  tag_touch_acq_mode_t {
  RAW_ACQ_MODE,
  NORMAL_ACQ_MODE
}
 Touch library acquisition mode. More...
 
enum  tag_touch_lib_state_t {
  TOUCH_STATE_NULL,
  TOUCH_STATE_INIT,
  TOUCH_STATE_READY,
  TOUCH_STATE_CALIBRATE,
  TOUCH_STATE_BUSY
}
 Touch library state. More...
 
enum  tag_touch_ret_t {
  TOUCH_SUCCESS,
  TOUCH_ACQ_INCOMPLETE,
  TOUCH_INVALID_INPUT_PARAM,
  TOUCH_INVALID_LIB_STATE,
  TOUCH_INVALID_QT_CONFIG_PARAM,
  TOUCH_INVALID_RECAL_THRESHOLD,
  TOUCH_INVALID_CHANNEL_NUM,
  TOUCH_INVALID_SENSOR_TYPE,
  TOUCH_INVALID_SENSOR_ID,
  TOUCH_INVALID_DMA_PARAM,
  TOUCH_INVALID_RS_NUM,
  TOUCH_CATB_CLOCK_ERROR
}
 Touch Library error codes. More...
 

Variables

touch_measure_data_tp_qt_measure_data
 QTouch measured data pointer. More...
 
touch_qt_time_t touch_qt_time
 QTouch Library Timing info. 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...
 

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

QTouch API.

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

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

#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
Value:
((QT_NUM_CHANNELS+ 7u) / 8u) + (PRIV_QT_PAD_BYTE_SIZE))
#define QT_NUM_ROTORS_SLIDERS
QTouch number of Rotors and Sliders.
Definition: touch_config_sam4l.h:151
#define PRIV_QT_SIZE_RS
Size of QTouch Rotor Slider.
Definition: touch_api_sam4l.h:149
#define PRIV_QT_PAD_BYTE_SIZE
Size of QTouch Pad bytes.
Definition: touch_api_sam4l.h:154
#define PRIV_QT_SIZE_CHANNEL
Size of QTouch Channel.
Definition: touch_api_sam4l.h:144
#define QT_NUM_SENSORS
QTouch number of Sensors.
Definition: touch_config_sam4l.h:142
#define QT_NUM_CHANNELS
QTouch number of channels.
Definition: touch_api_sam4l.h:134
#define PRIV_QT_SIZE_SENSOR
Size of QTouch Sensor.
Definition: touch_api_sam4l.h:139

QTouch Data block size.

#define PRIV_QT_PAD_BYTE_SIZE   (36u)

Size of QTouch Pad bytes.

#define PRIV_QT_RS_TABLE_INIT   touch_qt_rs_table_init

Initialize rotor slider table.

#define PRIV_QT_SIZE_CHANNEL   (25u)

Size of QTouch Channel.

#define PRIV_QT_SIZE_RS   (13u)

Size of QTouch Rotor Slider.

#define PRIV_QT_SIZE_SENSOR   (8u)

Size of QTouch Sensor.

#define QT_NUM_CHANNELS   (QT_NUM_SENSOR_PINS_SELECTED)

QTouch number of channels.

#define TOUCH_BURST_AGAIN   (0x0100u)

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

Referenced by touch_qt_measure_complete_callback().

#define TOUCH_CHANNEL_REF_CHANGE   (0x0008u)

Change in Reference value of atleast one Touch channel.

Referenced by touch_sensors_measure().

#define TOUCH_IN_DETECT   (0x0001u)

Atleast one Touch channel is in detect.

#define TOUCH_NO_ACTIVITY   (0x0000u)

No Touch activity.

#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 touch_sensors_measure().

#define TOUCH_STATUS_CHANGE   (0x0002u)

Change in Touch status of atleast one Touch channel.

Referenced by touch_sensors_measure().

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.

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)

QTouch Pin options available.

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

Global sensor configuration info.

Touch library information type.

Touch library state.

Touch Measured data type.

QTouch configuration input.

QTouch dma type.

QTouch sensor configuration type.

QTouch pin configuration type.

QTouch register configuration type.

QTouch Library Timing info.

Touch Library error codes.

typedef uint16_t touch_time_t

Current time type.

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.

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 

QTouch Pin options available.

Enumerator
DIS_PA02 
DIS_PA12 
DIS_PA23 
DIS_PA31 
DIS_PB03 
DIS_PB12 
DIS_PC05 
DIS_PC14 
DIS_PC23 

QTouch Pin options available.

Enumerator
SP_PA04 
SP_PA27 
SP_PB13 
SP_PA05 
SP_PA28 
SP_PB14 
SP_PA06 
SP_PA29 
SP_PB15 
SP_PA07 
SP_PA30 
SP_PC00 
SP_PA08 
SP_PC01 
SP_PA09 
SP_PC02 
SP_PA10 
SP_PC03 
SP_PA11 
SP_PC04 
SP_PA13 
SP_PC06 
SP_PA14 
SP_PC07 
SP_PA15 
SP_PC08 
SP_PA16 
SP_PC09 
SP_PA17 
SP_PC10 
SP_PA18 
SP_PC11 
SP_PA19 
SP_PC12 
SP_PA20 
SP_PC13 
SP_PA21 
SP_PC15 
SP_PA22 
SP_PC16 
SP_PA24 
SP_PC17 
SP_PA25 
SP_PC18 
SP_PA26 
SP_PC19 
SP_PB00 
SP_PC20 
SP_PB01 
SP_PC21 
SP_PB02 
SP_PC22 
SP_PB04 
SP_PC24 
SP_PB05 
SP_PC25 
SP_PB06 
SP_PC26 
SP_PB07 
SP_PC27 
SP_PB08 
SP_PC28 
SP_PB09 
SP_PC29 
SP_PB10 
SP_PC30 
SP_PB11 
SP_PC31 

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_QT_CONFIG_PARAM 

Invalid QTouch config input parameter.

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_INVALID_RS_NUM 

Number of Rotor/Sliders set as 0, when trying to configure a rotor/slider.

TOUCH_CATB_CLOCK_ERROR 

CATB clock not initialized.

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.

Referenced by touch_autonomous_sensor_disable().

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.

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

Referenced by touch_autonomous_sensor_enable().

void touch_autonomous_sensor_disable ( void  )

This API is used to disable Autonomous QTouch Sensor.

Returns
touch_ret_t: QTouch Library Error status.

References touch_at_sensor_disable().

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.

Returns
touch_ret_t: QTouch Library Error status.

References touch_at_sensor_enable(), and TOUCH_SUCCESS.

void touch_event_dispatcher ( void  )

Touch Library Event Dispatcher.

Note
This API does not apply for Autonomous QTouch.

Referenced by touch_sensors_measure().

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();}.

Returns
touch_ret_t: QTouch Library Error status.

Referenced by touch_sensors_deinit().

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.

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

Referenced by touch_sensors_config().

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.

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

Returns
touch_ret_t: QTouch Library Error status.

Referenced by touch_sensors_init().

touch_ret_t touch_qt_sensors_init_with_rs_table ( touch_config_t p_touch_config,
void(*)(void)  rs_table_init 
)

This API is used to initialize the Touch Library with QTouch 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_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(*)(void)  measure_complete_callback 
)

This API can be used to start a QTouch measurement.

Parameters
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 sensor status and measured data pointer.
Returns
touch_ret_t: QTouch Library Error status.

Referenced by touch_sensors_measure().

void touch_sensors_deinit ( void  )

This API is used to deinitialize capacitive touch acquisition on QTouch Sensors.

References touch_qt_deinit().

Referenced by app_init_lowpower(), and main().

touch_ret_t touch_sensors_init ( void  )

This API is used to initialize and configure the Touch Library.

Returns
touch_ret_t: QTouch Library Error status.

This API is used to initialize and configure the Touch Library.

References tag_touch_qt_time_t::measurement_period_ms, TOUCH_MEASUREMENT_PERIOD_MS, touch_qt_sensors_calibrate(), touch_qt_sensors_init, touch_sensors_config(), and TOUCH_SUCCESS.

Referenced by event_qtouch_init(), and main().

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.

Returns
touch_ret_t: QTouch Library Error status.

This API is used to update Timing info for QTouch Library. Typical usage of this API is inside a periodic timer ISR.

References tag_touch_qt_time_t::current_time_ms, tag_touch_qt_time_t::measurement_period_ms, and tag_touch_qt_time_t::time_to_measure_touch.

Referenced by ast_per_callback().

touch_measure_data_t* p_qt_measure_data

QTouch measured data pointer.

touch_qt_time_t touch_qt_time

QTouch Library Timing info.