Button Parameters

Last modified by Microchip on 2026/03/23 15:06

This page provides a comprehensive overview of the essential button structures, enums, and typedefs used in the Capacitive Voltage Divider (CVD) technique for touch sensing.

For APIs, refer to the Button Application Programming Interfaces (APIs) page.

Button Typedefs

mtouch_button_statecounter_t

typedef uint16_t mtouch_button_statecounter_t;

Description: Defines the button state counter minimum and maximum

Range:

#define MTOUCH_BUTTON_STATECOUNTER_MIN (0)
#define MTOUCH_BUTTON_STATECOUNTER_MAX (UINT16_MAX)

mtouch_button_baselinecounter_t

typedef uint16_t mtouch_button_baselinecounter_t;

Description: Defines the button baseline counter minimum and maximum

Range:

#define MTOUCH_BUTTON_BASECOUNTER_MIN (0)
#define MTOUCH_BUTTON_BASECOUNTER_MAX (UINT16_MAX)

mtouch_button_reading_t

typedef uint16_t mtouch_button_reading_t;

Description: Defines the button reading minimum and maximum

Range:

#define MTOUCH_BUTTON_READING_MIN (0)
#define MTOUCH_BUTTON_READING_MAX (UINT16_MAX)

mtouch_button_baseline_t

typedef uint32_t mtouch_button_baseline_t;

Description: Defines the button baseline reading minimum and maximum

Range:

#define MTOUCH_BUTTON_BASELINE_MIN (0)
#define MTOUCH_BUTTON_BASELINE_MAX (UINT32_MAX)

mtouch_button_deviation_t

typedef int8_t mtouch_button_deviation_t;

Description: Defines the button deviation reading minimum and maximum

Range:

#define MTOUCH_BUTTON_DEVIATION_MIN (INT8_MIN)
#define MTOUCH_BUTTON_DEVIATION_MAX (INT8_MAX)

mtouch_button_threshold_t

typedef uint8_t mtouch_button_threshold_t;

Description: Defines the button theshold minimum and maximum

 Range:

#define MTOUCH_BUTTON_THRESHOLD_MIN ((mtouch_button_threshold_t)(1))
#define MTOUCH_BUTTON_THRESHOLD_MAX ((mtouch_button_threshold_t)(127))

mtouch_button_scaling_t

typedef uint8_t mtouch_button_scaling_t;

Description: Defines the button scaling minimum and maximum

Range:

#define MTOUCH_BUTTON_SCALING_MIN ((mtouch_button_scaling_t)(0))
#define MTOUCH_BUTTON_SCALING_MAX ((mtouch_button_scaling_t)(8))

Back to Top

Button enum and Structures

mtouch_button_state

enum mtouch_button_state {     MTOUCH_BUTTON_STATE_initializing = 0,     MTOUCH_BUTTON_STATE_notPressed,     MTOUCH_BUTTON_STATE_pressed };

Description: Available states for button in the statemachine

 

mtouch_button_hysteresis_thresholds

 enum mtouch_button_hysteresis_thresholds    {        HYST_50_PERCENT     = 1,        HYST_25_PERCENT     = 2,        HYST_12_5_PERCENT   = 3,        HYST_6_25_PERCENT   = 4,        HYST_MAX            = 5    };

Description: Available hystersis thresholds for buttons

 

mtouch_button_t

 typedef struct    {        const enum mtouch_button_names      name;        const enum mtouch_sensor_names      sensor;        enum mtouch_button_state            state;        mtouch_button_reading_t         reading;        mtouch_button_baseline_t        baseline;        mtouch_button_deviation_t       deviation;        mtouch_button_statecounter_t    counter;        mtouch_button_baselinecounter_t baseline_count;        mtouch_button_threshold_t       threshold;        mtouch_button_scaling_t         scaling;    } mtouch_button_t;

Description: Lists down all the elements corresponding to buttons configured in the project

 

Back to Top