Key Parameters

Last modified by Microchip on 2026/02/23 09:27

DO_NOT_REMOVE

The keys parameter set allows you to configure the behavior, sensitivity, and detection logic for each individual touch button in your application. This section covers parameters that control key touch detection behavior. The key parameters for each channel are set using the following format:

DEF_ANTI_TCH_DET_INT

#define DEF_ANTI_TCH_DET_INT (value)

Description: This parameter defines the number of additional touch measurements to be performed to confirm a negative delta recalibration.

Range: 0 to 255

More info: Usually, a continuous negative delta will be observed when the system is calibrated with a finger/conductive object placed on the sensor and the object is removed. This scenario is monitored and recalibration is performed to resume normal operation. A negative delta due to noise (an occasional spike) should not trigger recalibration.

Information

Note: Configuring this parameter to zero will disable negative delta recalibration.

DEF_ANTI_TCH_DRIFT_RATE

#define DEF_ANTI_TCH_DRIFT_RATE (value)

Description: This parameter works in the same way as DEF_TCH_DRIFT_RATE, but in the opposite direction.

Range: 0 to 255

Units: 200 ms Eg - 5u = 1s

DEF_ANTI_TCH_RECAL_THRSHLD

#define DEF_ANTI_TCH_RECAL_THRSHLD (value)

Description: This parameter is complementary to DEF_ANTI_TCH_DET_INT. Where DEF_ANTI_TCH_DET_INT acts as the confirmation, this parameter acts as the threshold. If the touch delta is more than Anti-Touch Recall Threshold on the negative side for DEF_ANTI_TCH_DET_INT times, the sensor is recalibrated. This parameter is configured as a percentage of the sensor threshold.

Range: RECAL_100/ RECAL_50 / RECAL_25 / RECAL_12_5 / RECAL_6_25

DEF_DRIFT_HOLD_TIME

#define DEF_DRIFT_HOLD_TIME (value)

Description: This parameter defines the amount of time to pause the drifting after removing the finger.

Range: 0 to 255

Units: 200 ms

More Info: When a sensor is in the detect state, the drifting on all other sensors is stopped. When the finger is removed (when the sensor goes out of the detection state), drifting is started.

Drift Hold Time defines the amount of time drifting needs to be paused after removing the finger. This value is scaled by 200 ms. It is essential to pause the drift for a couple of seconds, as there is a possibility that the finger is still around the sensors and causing some difference in signal and reference.

DEF_MAX_ON_DURATION

#define DEF_MAX_ON_DURATION (value)

Description: Max-On-Duration (MOD) defines the maximum sensor ON time. For a system, if prolonged touch is not valid, then MOD can be configured. If a sensor is in detect for more than MOD, then the sensor will be calibrated (resulting in going back to a no-detect state).

Range: 0 to 255

Note: If MOD is configured as zero, then MOD is infinite. Otherwise, this value is scaled by 200 ms.

DEF_NUM_SENSORS

#define DEF_NUM_SENSORS (value)

Description: This parameter defines the number of key sensors. 

Range: 1 to 65535

DEF_REBURST_MODE

#define DEF_REBURST_MODE (value)

Description: This parameter defines if and how re-bursting happens.

Range: REBURST_NONE / REBURST_UNRESOLVED / REBURST_ALL

More Info: Under various conditions (like calibration, detect integration, and recalibration), additional touch measurements need to be performed to confirm an activity. The taking of these additional measurements is known as re-bursting, and this parameter defines how that re-bursting happens. We recommend using the default value in order to get faster response time. If re-burst is disabled, then the additional measurements are done at the normal scan rate, which may increase the response time. If re-burst, all active sensors are used, and all the active sensors are measured irrespective of their state, which again affects the response time.

If REBURST_UNRESOLVED is used, then additional measurements are performed only on sensors that are in the process of calibration/ filter in/ filter out and Adjacent Key Suppression (AKS) groups.

The following figure shows how each re-burst is done.

REBURST_NONE / REBURST_UNRESOLVED / REBURST_ALL

DEF_TCH_DRIFT_RATE

#define DEF_TCH_DRIFT_RATE (value)

Description: This parameter defines the time interval for drifting.

Range: 0 to 255

Units: 200 ms, Eg 20U = 4s

More info: When there is a touch, the signal value increases above the reference, but if such a signal value does not increase beyond the threshold, then the rise in signal is not due to finger touch. Usually, such a scenario can happen when there is a change in environmental conditions, like temperature or humidity. This deviation should be drifted out for proper touch operation.

When the signal value is greater than the reference, this value defines the rate at which the sensor reference value is adjusted towards the change in signal value. The Touch Drift Rate value is scaled by 200 ms. If the Touch Drift Rate is 10, then the drift period is 10 × 200 ms = 2s. So, every 2 seconds, the reference value will be incremented by 1 until it is equal to the signal value. 

DEF_TOUCH_DET_INT

#define DEF_TOUCH_DET_INT (value)

Description: This parameter defines the number of additional touch measurements to be performed to confirm a touch or to confirm the removal of a touch. The actual additional measurement will be DEF_TOUCH_DET_INT + 1.

Range: 0 to 255

Example: KEY_0_PARAMS → Correspond to Channel 0. 

KEY_x_PARAMS

#define KEY_x_PARAMS {Sensor Threshold, Sensor Hysterisis, Sensor AKS}

Description: This parameter defines the Key Sensor settings: Sensor Threshold, Sensor Hysterisis, and Sensor AKS.

Range: 

SettingRange
Sensor Threshold0 to 255
Sensor HysteresisHYST_50/ HYST_25/ HYST_12_5/ HYST_6_25/ MAX_HYST
Sensor AKS0-to-255 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

More Info: The settings included in this parameter include:

  1. Sensor Threshold: This defines the sensor's detect threshold. When a finger touches the sensor, the touch delta increases. The sensor will be reported as touched only if the sensor's touch delta value is more than the Sensor Threshold. It is recommended to configure the Sensor Threshold as 50-70% of touch delta. It is good to start with the default value and adjust after monitoring the touch delta value.
  2. Sensor Hysteresis: Under noisy conditions, the delta value goes up and down over the sensor threshold. During these conditions, the sensor dithers in and out of touch. To avoid this, once a sensor goes into the detect state, the threshold for the sensor is reduced by the hysteresis value. Hysteresis values are derived from the Sensor Threshold value. It is not enough for the delta to go below the threshold for the sensor to report no touch. It has to go below the hysteresis level to declare no touch. Refer to the following image.

    Hysteresis values derived from the Sensor Threshold value

    There are four different hysteresis levels available to choose from.

    OptionDescription
    HYST_50Hysteresis is 50% of the Sensor Threshold
    HYST_25Hysteresis is 25% of the Sensor Threshold
    HYST_12_5Hysteresis is 12.5% of the Sensor Threshold
    HYST_6_25Hysteresis is 6.25% of the Sensor Threshold
  1. AKS: AKS can be used when touching multiple sensors is NOT allowed in a system. When sensors are physically close to each other, there is a possibility that touching one sensor will result in increasing the touch delta value on other adjacent sensors. At times, the delta rise in other sensors may cross the threshold and could report false detection. When such sensors are configured in the same AKS group, only the first sensor (which goes in to detect) will be reported as touched. All other sensors' states will be suppressed, even if their delta crosses the Sensor Threshold.

Back to Top