Surface Parameters
Last modified by Microchip on 2026/03/24 11:55
This page provides a comprehensive overview of the essential surface macros, typedefs, and Application Programming Interfaces (APIs) used in the Capacitive Voltage Divider (CVD) technique for touch sensing. Scroller includes both slider and wheel.
Surface Structures and Enums
mtouch_surface_t
typedef struct{ /* Surface CS Configuration */ uint8_t start_segment_h; uint8_t number_of_segments_h; uint8_t start_segment_v; uint8_t number_of_segments_v; uint8_t resol_deadband; uint8_t position_hysteresis; uint8_t position_filter; uint16_t contact_min_threshold; /* Surface Contact Data */ uint8_t surface_status; uint8_t contact_status[2]; uint16_t h_position_abs[2]; uint16_t h_position[2]; uint16_t v_position_abs[2]; uint16_t v_position[2]; uint16_t contact_size[2];} mtouch_surface_t;
Description: This enumeration defines the Surface CS Configuration and CS Data.
More Info: Here is a description of each of the elements in this structure:
| Parameter | Size | Range/Options | Usage |
|---|---|---|---|
| start_segment_h | 1 byte | 0 – 255 | Start segment of horizontal axis |
| number_of_segments_h | 1 byte | 0 – 255 | Number of channels forming horizontal axis |
| start_segment_v | 1 byte | 0 – 255 | Start segment of vertical axis |
| number_of_segments_v | 1 byte | 0 – 255 | Number of channels forming vertical axis |
| resol_deadband | 1 byte | 0 – 255 | Resolution 2 to 12 bits | Deadband 0% to 15% |
| position_hysteresis | 1 byte | 0 – 255 | Distance threshold for initial move or direction change |
| position_filter | 1 byte | 0 – 255 | Bits 1:0 = IIR (0% / 25% / 50% / 75%), Bit 4 = Enable Median Filter (3-point) |
| contact_min_threshold | 2 bytes | 0 to 65534 | Contact threshold / sum of 4 deltas |
| surface_status | 1 byte | 0 – 255 | Indicates the status of the surface configured |
| contact_status | 1 byte | 0 – 255 | Indicates the touch contact status on the surface |
| h_position_abs | 2 bytes | 0 to 65534 | Absolute horizontal position of touch |
| h_position | 2 bytes | 0 to 65534 | Touch horizontal position |
| v_position_abs | 2 bytes | 0 to 65534 | Absolute vertical position of touch |
| v_position | 2 bytes | 0 to 65534 | Touch vertical position |
| contact_size | 2 bytes | 0 to 65534 | Size of the touch contact |
surface_resolution_t
typedef enum tag_surface_resolution_t{ SURFACE_RESOL_2_BIT = 2, SURFACE_RESOL_3_BIT, SURFACE_RESOL_4_BIT, SURFACE_RESOL_5_BIT, SURFACE_RESOL_6_BIT, SURFACE_RESOL_7_BIT, SURFACE_RESOL_8_BIT, SURFACE_RESOL_9_BIT, SURFACE_RESOL_10_BIT, SURFACE_RESOL_11_BIT, SURFACE_RESOL_12_BIT } surface_resolution_t;
Description: This enumeration defines the surface resolution settings.
surface_deadband_t
typedef enum tag_surface_deadband_t{ SURFACE_DB_NONE, SURFACE_DB_1_PERCENT, SURFACE_DB_2_PERCENT, SURFACE_DB_3_PERCENT, SURFACE_DB_4_PERCENT, SURFACE_DB_5_PERCENT, SURFACE_DB_6_PERCENT, SURFACE_DB_7_PERCENT, SURFACE_DB_8_PERCENT, SURFACE_DB_9_PERCENT, SURFACE_DB_10_PERCENT, SURFACE_DB_11_PERCENT, SURFACE_DB_12_PERCENT, SURFACE_DB_13_PERCENT, SURFACE_DB_14_PERCENT, SURFACE_DB_15_PERCENT} surface_deadband_t;
Description: This enumeration defines the surface deadband percentage settings.