Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
QTouch Library for AVR & AVR32 devices

This is the QTouch Library for AVR and AVR32 devices that consists of one api header file(touch_api.h) and respective pre-compiled libraries.

All projects using these libraries must also provide the required header file(touch_qt_config.h) used to configure the library. For more information on the Qtouch Library, check www.atmel.com/qtouchlib.

Modules

 

Data Structures

struct  qt_lib_sig_info_t
 This will be used to get the library information from the library. More...
 
struct  tag_qt_touch_lib_config_data_t
 post processing configuration data that is received from the debug interface. More...
 
struct  tag_qt_touch_lib_measure_data_t
 measured touch data that is sent for the debugging and fine tunning. More...
 
struct  tag_qt_touch_status_t
 The state of the library sensors. More...
 
struct  tag_sensor_t
 

Macros

#define BURST_FUNC_NAME   BURST_JOIN( _STATIC_PORT_PIN_CONF_, QTOUCH_SNS_PORT_COUNT, INTRABURST_1, INTRABURST_2, _POWER_OPTIMIZATION_, QTOUCH_PIN_CONF )
 Build pointer to correct burst function. More...
 
#define BURST_JOIN(static_flag, num_ports, intra1, intra2, pow_opt, qtouch_pin_conf)   JOIN4( static_flag, num_ports, intra1, intra2, pow_opt, qtouch_pin_conf )
 
#define CALCULATE_MASKS   calc_masks
 This part of the code below is used for library selection. More...
 
#define CONCAT(A, B, C)   JOIN1( A, B, C )
 
#define DEF_QT_DI   4u
 Initialization values for the Qtouch library parameters. More...
 
#define DEF_QT_DRIFT_HOLD_TIME   20 /* 4s */
 Sensor drift hold time. More...
 
#define DEF_QT_MAX_ON_DURATION   0 /* disabled */
 Sensor maximum on duration. More...
 
#define DEF_QT_NEG_DRIFT_RATE   20 /* 4s per LSB */
 Sensor negative drift rate. More...
 
#define DEF_QT_POS_DRIFT_RATE   5 /* 1s per LSB */
 Sensor positive drift rate. More...
 
#define DEF_QT_POS_RECAL_DELAY   3u
 Positive recalibration delay. More...
 
#define DEF_QT_RECAL_THRESHOLD   RECAL_50 /* recal threshold = 50% of detect */
 Sensor recalibration threshold. More...
 
#define JOIN(x, y)   x ## y
 WARNING! Do not edit below this line. More...
 
#define JOIN1(A, B, C)   A ## B ## C
 
#define JOIN4(a, b, c, d, e, f)   burst_ ## a ## _ ## b ## _ ## c ## d ## _ ## e ##_ ## f
 Macros for string concatenation. More...
 
#define qt_init_sensing()   qt_init_sensing_with_burst( BURST_FUNC_NAME ,CALCULATE_MASKS)
 initialise touch sensing. More...
 
#define QT_MAX_NUM_ROTORS_SLIDERS   0
 
#define QT_NUM_SENSOR_STATE_BYTES   ( ( QT_NUM_CHANNELS + 7u ) / 8u )
 The number of bytes required to report the maximum possible number of sensors. More...
 
#define QTLIB_BURST_AGAIN   (uint16_t) 0x0100
 indicating that reburst is needed to resolve in FILTERIN or FILTEROUT or RECALIBRATE state. More...
 
#define QTLIB_CHANNEL_REF_CHANGE   (uint16_t) 0x0008
 indicating that at least one reference value has changed since last call to measure_sensors. More...
 
#define QTLIB_IN_DETECT   (uint16_t) 0x0001
 indicating that at least one sensor is in detect. More...
 
#define QTLIB_NO_ACTIVITY   (uint16_t) 0x0000
 Status flags used with debug. More...
 
#define QTLIB_RESOLVE_CAL   (uint16_t) 0x0200
 indicating that reburst is needed to resolve in CALIBRATION. More...
 
#define QTLIB_RESOLVE_DI   (uint16_t) 0x0800
 indicating that reburst is needed to resolve in RECAL. More...
 
#define QTLIB_RESOLVE_FILTERIN   (uint16_t) 0x0400
 indicating that reburst is needed to resolve in FILTERING. More...
 
#define QTLIB_RESOLVE_POS_RECAL   (uint16_t) 0x1000
 indicating that reburst is needed to resolve in RECAL. More...
 
#define QTLIB_ROTOR_SLIDER_POS_CHANGE   (uint16_t) 0x0004
 indicating that at least one rotor slider has changed position since last call to measure_sensors. More...
 
#define QTLIB_STATUS_CHANGE   (uint16_t) 0x0002
 indicating that at least one sensor haschanged ON/OFF state since last call to measure_sensors. More...
 
#define REG(REGISTER, SIDE)   JOIN( REGISTER, SIDE )
 Macro to build register writes for controlling ports. More...
 
#define SNS1   SNS
 
#define SNSK1   SNSK
 
#define TICKS_PER_MS   500u
 QTouch libraries are supplied built with a range of charge times. More...
 
#define TOUCH_DATA_T   uint8_t
 

Typedefs

typedef enum tag_aks_group_t aks_group_t
 Which AKS group, if any, a sensor is in. More...
 
typedef enum tag_channel_t channel_t
 The channel(s) in a sensor. More...
 
typedef enum tag_hysteresis_t hysteresis_t
 A sensor detection hysteresis value. More...
 
typedef struct qt_lib_sig_info_t qt_lib_siginfo_t
 This will be used to get the library information from the library. More...
 
typedef struct
tag_qt_touch_lib_config_data_t 
qt_touch_lib_config_data_t
 post processing configuration data that is received from the debug interface. More...
 
typedef struct
tag_qt_touch_lib_measure_data_t 
qt_touch_lib_measure_data_t
 measured touch data that is sent for the debugging and fine tunning. More...
 
typedef struct
tag_qt_touch_status_t 
qt_touch_status_t
 The state of the library sensors. 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 struct tag_sensor_t sensor_t
 
typedef enum tag_sensor_type_t sensor_type_t
 Options for the sensor types available. More...
 
typedef uint8_t threshold_t
 QMATRIX Start. 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
}
 Which AKS group, if any, a sensor is in. More...
 
enum  tag_channel_t
 The channel(s) in a sensor. More...
 
enum  tag_hysteresis_t {
  HYST_50,
  HYST_25,
  HYST_12_5,
  HYST_6_25
}
 A sensor detection hysteresis value. More...
 
enum  tag_recal_threshold_t {
  RECAL_100 = 0,
  RECAL_50,
  RECAL_25,
  RECAL_12_5,
  RECAL_6_25
}
 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
}
 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
}
 Options for the sensor types available. More...
 

Functions

void BURST_FUNC_NAME (TOUCH_DATA_T mask_index)
 Burst function prototype. The code itself is stored in the touch library. More...
 
void calc_masks (void)
 
void qt_calibrate_sensing (void)
 calibrate touch sensing. More...
 
void qt_enable_key (channel_t channel, aks_group_t aks_group, threshold_t detect_threshold, hysteresis_t detect_hysteresis)
 enable a key sensor. More...
 
void qt_get_library_sig (qt_lib_siginfo_t *lib_sig_ptr)
 Get the library signature. More...
 
int16_t qt_get_sensor_delta (uint8_t sensor)
 get the current delta on the specified sensor. More...
 
void qt_init_sensing_with_burst (void(*burst_function)(TOUCH_DATA_T mask_index), void(*calculate_masks)(void))
 
uint16_t qt_measure_sensors (uint16_t current_time_ms)
 measure touch sensors. More...
 
void qt_reset_sensing (void)
 reset touch sensing. More...
 

Variables

void(* burst_proc )(TOUCH_DATA_T mask_index)
 Function pointer used for bursting. More...
 
uint16_t tag_qt_touch_lib_measure_data_t::channel_references [QT_NUM_CHANNELS]
 reference signal for each channel. More...
 
uint16_t tag_qt_touch_lib_measure_data_t::channel_signals [QT_NUM_CHANNELS]
 measured signal on each channel. More...
 
uint8_t tag_sensor_t::from_channel
 sensor from and to channels keys: from channel = to channel rotors/sliders run between the from and to channels NB: only need to_channel for keys in rotors/sliders build More...
 
uint8_t tag_sensor_t::general_counter
 general purpose ctr: used for calibration, drifting, etc. More...
 
uint16_t qt_lib_sig_info_t::lib_sig_hword
 
uint16_t qt_lib_sig_info_t::lib_sig_lword
 
uint16_t lib_status_flags
 variable holding the status flags. More...
 
uint16_t qt_lib_sig_info_t::library_version
 
uint8_t tag_sensor_t::ndil_counter
 DI ctr. More...
 
qt_touch_lib_config_data_t qt_config_data
 This configuration data structure parameters if needs to be changed will be changed in the qt_set_parameters function. More...
 
uint8_t tag_qt_touch_lib_config_data_t::qt_di
 Sensor detect integration (DI) limit. More...
 
uint8_t tag_qt_touch_lib_config_data_t::qt_drift_hold_time
 Sensor drift hold time. More...
 
void(* qt_filter_callback )(void)
 This function is called after the library has made capacitive measurements, but before it has processed them. The user can use this hook to apply filter functions to the measured signal values. More...
 
uint8_t tag_qt_touch_lib_config_data_t::qt_max_on_duration
 Sensor maximum on duration. More...
 
qt_touch_lib_measure_data_t qt_measure_data
 measurement data. More...
 
uint16_t qt_measurement_period_msec
 timer period in msec. More...
 
uint8_t tag_qt_touch_lib_config_data_t::qt_neg_drift_rate
 Sensor negative drift rate. More...
 
uint8_t tag_qt_touch_lib_config_data_t::qt_pos_drift_rate
 Sensor positive drift rate. More...
 
uint8_t tag_qt_touch_lib_config_data_t::qt_pos_recal_delay
 Positive recalibration delay. More...
 
recal_threshold_t tag_qt_touch_lib_config_data_t::qt_recal_threshold
 Sensor recalibration threshold. More...
 
qt_touch_status_t tag_qt_touch_lib_measure_data_t::qt_touch_status
 state of sensors. More...
 
uint8_t tag_qt_touch_status_t::rotor_slider_values [QT_MAX_NUM_ROTORS_SLIDERS]
 Rotor angles or slider positions. More...
 
uint8_t tag_qt_touch_status_t::sensor_states [QT_NUM_SENSOR_STATE_BYTES]
 The state (on/off) of the library sensors. More...
 
sensor_t sensors [QT_NUM_CHANNELS]
 the library sensors. More...
 
uint8_t tag_sensor_t::state
 sensor state (calibrating, on, ...). More...
 
uint8_t tag_sensor_t::threshold
 sensor detection threshold. More...
 
uint8_t tag_sensor_t::type_aks_pos_hyst
 sensor type, AKS group, positive recal flag, and hysteresis value bits 7..6: sensor type: 00: key 01: rotor 10: slider 11: reserved bits 5..3: AKS group (0..7): 0 = no AKS group bit 2 : positive recal flag bits 1..0: hysteresis More...
 

#define BURST_FUNC_NAME   BURST_JOIN( _STATIC_PORT_PIN_CONF_, QTOUCH_SNS_PORT_COUNT, INTRABURST_1, INTRABURST_2, _POWER_OPTIMIZATION_, QTOUCH_PIN_CONF )

Build pointer to correct burst function.

#define BURST_JOIN (   static_flag,
  num_ports,
  intra1,
  intra2,
  pow_opt,
  qtouch_pin_conf 
)    JOIN4( static_flag, num_ports, intra1, intra2, pow_opt, qtouch_pin_conf )
#define CALCULATE_MASKS   calc_masks

This part of the code below is used for library selection.

This code will not be documented.

#define CONCAT (   A,
  B,
 
)    JOIN1( A, B, C )
#define DEF_QT_DI   4u

Initialization values for the Qtouch library parameters.

Sensor detect integration (DI) limit. Default value: 4.

Referenced by qt_set_parameters().

#define DEF_QT_DRIFT_HOLD_TIME   20 /* 4s */

Sensor drift hold time.

Units: 200ms Default value: 20 (hold off drifting for 4 seconds after leaving detect).

Referenced by qt_set_parameters().

#define DEF_QT_MAX_ON_DURATION   0 /* disabled */

Sensor maximum on duration.

Units: 200ms (e.g., 150 = recalibrate after 30s). 0 = no recalibration. Default value: 0 (recalibration disabled).

Referenced by qt_set_parameters().

#define DEF_QT_NEG_DRIFT_RATE   20 /* 4s per LSB */

Sensor negative drift rate.

Units: 200ms Default value: 20 (4 seconds per LSB).

Referenced by qt_set_parameters().

#define DEF_QT_POS_DRIFT_RATE   5 /* 1s per LSB */

Sensor positive drift rate.

Units: 200ms Default value: 5 (1 second per LSB).

Referenced by qt_set_parameters().

#define DEF_QT_POS_RECAL_DELAY   3u

Positive recalibration delay.

Default: 3

Referenced by qt_set_parameters().

#define DEF_QT_RECAL_THRESHOLD   RECAL_50 /* recal threshold = 50% of detect */

Sensor recalibration threshold.

Default: RECAL_50 (recalibration threshold = 50% of detection threshold).

Referenced by qt_set_parameters().

#define JOIN (   x,
 
)    x ## y

WARNING! Do not edit below this line.

WARNING! Do not edit below this line. Utility macro for expanding port registers.

#define JOIN1 (   A,
  B,
 
)    A ## B ## C
#define JOIN4 (   a,
  b,
  c,
  d,
  e,
 
)    burst_ ## a ## _ ## b ## _ ## c ## d ## _ ## e ##_ ## f

Macros for string concatenation.

#define qt_init_sensing ( )    qt_init_sensing_with_burst( BURST_FUNC_NAME ,CALCULATE_MASKS)

initialise touch sensing.

Note
Any sensors required must be enabled (using qt_enable_xxx()) before calling this function.

This function calculates internal library variables and configures the touch channels, and must be called before qt_measure_sensors().

Referenced by demo_qt_init(), and main().

#define QT_MAX_NUM_ROTORS_SLIDERS   0
#define QT_NUM_SENSOR_STATE_BYTES   ( ( QT_NUM_CHANNELS + 7u ) / 8u )

The number of bytes required to report the maximum possible number of sensors.

#define QTLIB_BURST_AGAIN   (uint16_t) 0x0100

indicating that reburst is needed to resolve in FILTERIN or FILTEROUT or RECALIBRATE state.

Referenced by demo_qtouch_event_handler(), and main().

#define QTLIB_CHANNEL_REF_CHANGE   (uint16_t) 0x0008

indicating that at least one reference value has changed since last call to measure_sensors.

#define QTLIB_IN_DETECT   (uint16_t) 0x0001

indicating that at least one sensor is in detect.

#define QTLIB_NO_ACTIVITY   (uint16_t) 0x0000

Status flags used with debug.

indicating no activity.

#define QTLIB_RESOLVE_CAL   (uint16_t) 0x0200

indicating that reburst is needed to resolve in CALIBRATION.

#define QTLIB_RESOLVE_DI   (uint16_t) 0x0800

indicating that reburst is needed to resolve in RECAL.

#define QTLIB_RESOLVE_FILTERIN   (uint16_t) 0x0400

indicating that reburst is needed to resolve in FILTERING.

#define QTLIB_RESOLVE_POS_RECAL   (uint16_t) 0x1000

indicating that reburst is needed to resolve in RECAL.

#define QTLIB_ROTOR_SLIDER_POS_CHANGE   (uint16_t) 0x0004

indicating that at least one rotor slider has changed position since last call to measure_sensors.

#define QTLIB_STATUS_CHANGE   (uint16_t) 0x0002

indicating that at least one sensor haschanged ON/OFF state since last call to measure_sensors.

#define REG (   REGISTER,
  SIDE 
)    JOIN( REGISTER, SIDE )

Macro to build register writes for controlling ports.

The intermediate JOIN macro is required for correct expansion of the args.

#define SNS1   SNS
#define SNSK1   SNSK
#define TICKS_PER_MS   500u

QTouch libraries are supplied built with a range of charge times.

Charge time is the duration in which charge is transferred from the AVR onto the measurement capacitor. Shorter charge times result in faster measurements, but may be too fast to completely transfer charge onto the measurement capacitor.

The range of charge times lets the user choose a suitable version for the clock rate their chip is running at.

To make capacitive measurements, a charge time on the order of 0.25us to 2.5us is typically required. The following table shows the charge times corresponding to a range of clock speeds.

Clock speed (MHz) Cycle time (us) Suitable charge times


1 1 1~2 cycles (1us to 2us) 2 0.5 1~5 cycles (0.5us to 2.5us) 4 0.25 1~10 cycles (0.25us to 2.5us) 8 0.125 2~10 cycles (0.25us to 1.25us) 10 0.1 3~25 cycles (0.3us to 2.5us) 16 0.0625 4~25 cycles (0.25us to 1.5625s) 20 0.05 5~50 cycles (0.25us to 2.5us) Error Checking For the User Configuration Options Starts here._QMATRIX_ Error Checking For the User Configuration Options ends here. Total ticks per msec. TICKS_PER_MS = (CLK_FREQ/TIMER_PRESCALER)*(1/1000)

#define TOUCH_DATA_T   uint8_t

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.

typedef enum tag_channel_t channel_t

The channel(s) in a sensor.

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)

This will be used to get the library information from the library.

post processing configuration data that is received from the debug interface.

measured touch data that is sent for the debugging and fine tunning.

The state of the library sensors.

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 struct tag_sensor_t sensor_t

Options for the sensor types available.

typedef uint8_t threshold_t

QMATRIX Start.

QMATRIX EndAn unsigned 8-bit number setting a sensor detection threshold.

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 

The channel(s) in a sensor.

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 

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 

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 

Options for the sensor types available.

Enumerator
SENSOR_TYPE_UNASSIGNED 
SENSOR_TYPE_KEY 
SENSOR_TYPE_ROTOR 
SENSOR_TYPE_SLIDER 

void BURST_FUNC_NAME ( TOUCH_DATA_T  mask_index)

Burst function prototype. The code itself is stored in the touch library.

void calc_masks ( void  )
void qt_calibrate_sensing ( void  )

calibrate touch sensing.

Note
This function forces a calibration of all enabled sensors. This may be useful if, for instance, it is desired to globally recalibrate all sensors on a change in application operating mode.
void qt_enable_key ( channel_t  channel,
aks_group_t  aks_group,
threshold_t  detect_threshold,
hysteresis_t  detect_hysteresis 
)

enable a key sensor.

Parameters
channel,:which touch channel the key sensor uses
aks_group,:which AKS group (if any) the sensor is in
detect_threshold,:the sensor detection threshold
detect_hysteresis,:the sensor detection hysteresis value
Note
The sensor number corresponding to the key depends on the order in which sensors are enabled. The first sensor enabled is sensor 0, the second is sensor 1, and so on.

The current state of the key (on or off) can be checked in qt_touch_status.sensor_states.

Referenced by config_sensors().

void qt_get_library_sig ( qt_lib_siginfo_t lib_sig_ptr)

Get the library signature.

Parameters
qt_lib_siginfo_t,:lib_sig_ptr=Pointer to the library signature structure

Referenced by trace_library_info().

int16_t qt_get_sensor_delta ( uint8_t  sensor)

get the current delta on the specified sensor.

Parameters
sensor,:sensor number for which to get the delta.
Returns
int16_t: returns the delta on the specified sensor.
Note
This function is supplied as a functional replacement for the sensor_deltas[] array provided in earlier library versions.
void qt_init_sensing_with_burst ( void(*)(TOUCH_DATA_T mask_index)  burst_function,
void(*)(void)  calculate_masks 
)
uint16_t qt_measure_sensors ( uint16_t  current_time_ms)

measure touch sensors.

Parameters
current_time_ms,:the current time, in ms
Returns
uint16_t: outputs the library status bits.
Note
This function performs a capacitive measurement on all enabled sensors. The measured signals for each sensor are then processed to check for user touches, releases, changes in rotor angle, changes in slider position, etc.

The current state of all enabled sensors is reported in the qt_touch_status struct.

Before calling this function, one or more sensors must have been enabled (using qt_enable_xxx()), and qt_init_sensing() must have been called.

Referenced by demo_qtouch_event_handler(), main(), and trace_library_info().

void qt_reset_sensing ( void  )

reset touch sensing.

Note
This function disables all enabled sensors, and returns all library variables (e.g., qt_di) to their default values.

This may be useful if it is desired to dynamically reconfigure sensing. After calling this function, any required sensors must be re-enabled, and qt_init_sensing() must be called before qt_measure_channels() is called again.

Referenced by demo_qt_init(), and main().

void(* burst_proc)(TOUCH_DATA_T mask_index)

Function pointer used for bursting.

uint16_t tag_qt_touch_lib_measure_data_t::channel_references[QT_NUM_CHANNELS]

reference signal for each channel.

uint16_t tag_qt_touch_lib_measure_data_t::channel_signals[QT_NUM_CHANNELS]

measured signal on each channel.

uint8_t tag_sensor_t::from_channel

sensor from and to channels keys: from channel = to channel rotors/sliders run between the from and to channels NB: only need to_channel for keys in rotors/sliders build

uint8_t tag_sensor_t::general_counter

general purpose ctr: used for calibration, drifting, etc.

uint16_t qt_lib_sig_info_t::lib_sig_hword
uint16_t qt_lib_sig_info_t::lib_sig_lword

Referenced by trace_library_info().

uint16_t lib_status_flags

variable holding the status flags.

uint16_t qt_lib_sig_info_t::library_version

Referenced by trace_library_info().

uint8_t tag_sensor_t::ndil_counter

DI ctr.

This configuration data structure parameters if needs to be changed will be changed in the qt_set_parameters function.

Referenced by qt_set_parameters().

uint8_t tag_qt_touch_lib_config_data_t::qt_di

Sensor detect integration (DI) limit.

Referenced by qt_set_parameters().

uint8_t tag_qt_touch_lib_config_data_t::qt_drift_hold_time

Sensor drift hold time.

Referenced by qt_set_parameters().

void(* qt_filter_callback)(void)

This function is called after the library has made capacitive measurements, but before it has processed them. The user can use this hook to apply filter functions to the measured signal values.

Referenced by demo_qt_init(), and main().

uint8_t tag_qt_touch_lib_config_data_t::qt_max_on_duration

Sensor maximum on duration.

Referenced by qt_set_parameters().

qt_touch_lib_measure_data_t qt_measure_data

measurement data.

uint16_t qt_measurement_period_msec

timer period in msec.

timer period in msec.

Referenced by init_timer_isr(), and SysTick_Handler().

uint8_t tag_qt_touch_lib_config_data_t::qt_neg_drift_rate

Sensor negative drift rate.

Referenced by qt_set_parameters().

uint8_t tag_qt_touch_lib_config_data_t::qt_pos_drift_rate

Sensor positive drift rate.

Referenced by qt_set_parameters().

uint8_t tag_qt_touch_lib_config_data_t::qt_pos_recal_delay

Positive recalibration delay.

Referenced by qt_set_parameters().

recal_threshold_t tag_qt_touch_lib_config_data_t::qt_recal_threshold

Sensor recalibration threshold.

Referenced by qt_set_parameters().

qt_touch_status_t tag_qt_touch_lib_measure_data_t::qt_touch_status

state of sensors.

uint8_t tag_qt_touch_status_t::rotor_slider_values[QT_MAX_NUM_ROTORS_SLIDERS]

Rotor angles or slider positions.

These values are valid when sensor_states shows that the corresponding rotor or slider sensor is in detect.

uint8_t tag_qt_touch_status_t::sensor_states[QT_NUM_SENSOR_STATE_BYTES]

The state (on/off) of the library sensors.

Bit 'n' = state of sensor 'n'. Bit 0 = sensor_states[0] bit 0 Bit 1 = sensor_states[0] bit 1 ... Bit 7 = sensor_states[0] bit 7 Bit 8 = sensor_states[1] bit 0 Bit 9 = sensor_states[1] bit 1 ... etc 0 = not in detect, 1 = in detect.

the library sensors.

uint8_t tag_sensor_t::state

sensor state (calibrating, on, ...).

uint8_t tag_sensor_t::threshold

sensor detection threshold.

uint8_t tag_sensor_t::type_aks_pos_hyst

sensor type, AKS group, positive recal flag, and hysteresis value bits 7..6: sensor type: 00: key 01: rotor 10: slider 11: reserved bits 5..3: AKS group (0..7): 0 = no AKS group bit 2 : positive recal flag bits 1..0: hysteresis