Common Data Structures and Enumerations

Last modified by Microchip on 2026/02/23 13:49

DO_NOT_REMOVE

Microchip’s Touch Modular Library uses a set of common data structures and enumerations (enums) to manage configuration, state, and results across its various modules (Acquisition, Key, Scroller, Surface, Gestures, Frequency Hop, etc.). These structures provide a standardized way to interact with the library Application Programming Interfaces (APIs) and facilitate modular integration.

touch_ret_t

typedef enum tag_touch_ret_t
{
 /* Successful completion of operation. */
  TOUCH_SUCCESS = 0u,

 /* Touch library is busy with pending previous touch measurement. */
  TOUCH_ACQ_INCOMPLETE = 1u,

 /* Invalid input parameter. */
  TOUCH_INVALID_INPUT_PARAM = 2u,

 /* Operation not allowed in the current state of the library module. */
  TOUCH_INVALID_LIB_STATE = 3u,

 /* Successful completion of FMEA.*/
  TOUCH_FMEA_SUCCESS = 4u,

 /* Error in FMEA module. */
  TOUCH_FMEA_ERROR = 5u,

 /* MAGIC number used for Program Counter checking. */
  TOUCH_PC_FUNC_MAGIC_NO_1 = 6u,

 /* MAGIC number used for Program Counter checking. */
  TOUCH_PC_FUNC_MAGIC_NO_2 = 7u,

 /* Error in logical program flow. */
  TOUCH_LOGICAL_PROGRAM_FLOW_ERROR = 8u,

 /* CRC on touch configuration failure. */
  TOUCH_LIB_CRC_FAIL = 9u,

 /* Double inverse failure. */
  TOUCH_LIB_DI_FAIL = 10u,

 /* Invalid pointer argument */
  TOUCH_INVALID_POINTER = 11u,

 /* MAGIC number used for Program Counter checking. */
  TOUCH_PC_FUNC_MAGIC_NO_3  =12u,

 /* Library is unsafe to use */
  TOUCH_LIB_UNSAFE =13u,

 /* Library is unable to calibrate node */
  TOUCH_LIB_NODE_CAL_ERROR = 14u,

 /* Successful completion of BIST.*/
  TOUCH_BIST_SUCCESS = 15u,

 /* Error in BIST module. */
  TOUCH_BIST_ERROR = 16u
} touch_ret_t;

Description: Touch Library functions return a value of type touch_ret_t

 

touch_lib_state_t

typedef enum tag_touch_lib_state_t
{
 /* Null - Not initialized */
  TOUCH_STATE_NULL = 0u,

 /* Initialized, no measurements yet */
  TOUCH_STATE_INIT = 1u,

 /* Ready to take a measurement */
  TOUCH_STATE_READY = 2u,

 /* Calibration set for some nodes */
  TOUCH_STATE_CALIBRATE = 3u,

 /* Measurement sequence in progress */
  TOUCH_STATE_BUSY = 4u
} touch_lib_state_t;

Description: Touch library state.

 

qtm_acq_node_data_t

typedef struct
{
 uint8_t node_acq_status;
 uint16_t node_acq_signals;
 uint16_t node_comp_caps;
}qtm_acq_node_data_t;

Description: Acquisition Node run-time data.

 

qtm_touch_key_data_t

typedef struct
{
 /* Disabled, Off, On, Filter, Cal... */
 uint8_t sensor_state;

 /* State counter */
 uint8_t sensor_state_counter;

 /* Pointer to node data structure */
  qtm_acq_node_data_t* node_data_struct_ptr;

 /* Reference signal */
 uint16_t channel_reference;
}qtm_touch_key_data_t;

Description: Key sensor run-time data.

 

NameType/Value
touch_ret_t

enum {

TOUCH_SUCCESS = 0u,

TOUCH_ACQ_INCOMPLETE = 1u,

TOUCH_INVALID_INPUT_PARAM = 2u,

TOUCH_INVALID_LIB_STATE = 3u,

TOUCH_FMEA_SUCCESS = 4u,

TOUCH_FMEA_ERROR = 5u,

TOUCH_PC_FUNC_MAGIC_NO_1 = 6u,

TOUCH_PC_FUNC_MAGIC_NO_2 = 7u,

TOUCH_LOGICAL_PROGRAM_FLOW_ERROR = 8u,

TOUCH_LIB_CRC_FAIL = 9u,

TOUCH_LIB_DI_FAIL = 10u,

TOUCH_INVALID_POINTER = 11u,

TOUCH_PC_FUNC_MAGIC_NO_3 =12u,

TOUCH_LIB_UNSAFE =13u,

TOUCH_LIB_NODE_CAL_ERROR = 14u,

TOUCH_DIAG_SUCCESS = 15u,

TOUCH_DIAG_ERROR = 16u,

}

touch_lib_state_t

enum {

TOUCH_STATE_NULL = 0u,

TOUCH_STATE_INIT = 1u,

TOUCH_STATE_READY = 2u,

TOUCH_STATE_CALIBRATE = 3u,

TOUCH_STATE_BUSY = 4u

}

qtm_acq_node_data_t

struct {

uint8_t node_acq_status;

uint16_t node_acq_signals;

uint16_t node_comp_caps;

}

qtm_touch_key_data_t

struct {

uint8_t sensor_state;

uint8_t sensor_state_counter;

qtm_acq_node_data_t* node_data_struct_ptr;

uint16_t channel_reference;

}

Back to Top