Sensor Parameters
Sensor parameters are critical parameters that define how and when capacitive touch measurements are performed in Microchip’s touch libraries. This section covers parameters that control touch measurement behaviors that are common to all the sensors.
Please refer to the "Sensor Application Programming Interfaces (APIs)" page for details on APIs.
Sensor Typedefs
mtouch_sensor_sample_t
Description: Defines the sensor sample reading minimum and maximum
Range:
#define MTOUCH_SENSOR_SAMPLE_MAX (UINT16_MAX)
mtouch_sensor_mask_t
Description: Defines the sensor mask minimum and maximum value
Range:
#define MTOUCH_SENSOR_MASK_MAX (UINT8_MAX)
mtouch_sensor_adcsample_t
Description: Defines the sensor Analog-to-Digital Converter (ADC) sample minimum and maximum
Range:
#define MTOUCH_SENSOR_ADCSAMPLE_MAX ((mtouch_sensor_adcsample_t)4095)
mtouch_sensor_packetcounter_t
Description: Defines the sensor packet counter reading minimum and maximum
Range:
#define MTOUCH_SENSOR_PACKETCOUNTER_MIN ((mtouch_sensor_packetcounter_t)0)
#define MTOUCH_SENSOR_PACKETCOUNTER_MAX ((mtouch_sensor_packetcounter_t)UINT16_MAX)
mtouch_sensor_packetsample_t
Description: Defines the sensor packet sample reading minimum and maximum
Range:
#define MTOUCH_SENSOR_PACKETSAMPLE_MAX ((mtouch_sensor_packetsample_t)UINT16_MAX)
mtouch_sensor_delay_t
Description: Alias for code readability and adapting to sensor-specific naming conventions
Range:
0 to 255
mtouch_sensor_addcap_t
Description: Capacitance limit
Range:
mtouch_sensor_time_t
Description: Sensor time
#define MIN_ACQ_TIME ((mtouch_sensor_time_t)DELAY_CYCLE(1))
#define MAX_ACQ_TIME ((mtouch_sensor_time_t)DELAY_CYCLE(x))
#define MAX_PRECHARGE_TIME ((mtouch_sensor_time_t)DELAY_CYCLE(x))
X is based on the XTAL frequency.
Sensor Enum and Structures
mtouch_sensor_names
{
Sensor_ANAx = 0,
...
};
Description: Displays the sensor names configured in the project
mtouch_sensor_error
{
MTOUCH_SENSOR_ERROR_none = 0,
MTOUCH_SENSOR_ERROR_invalid_index = -1,
MTOUCH_SENSOR_ERROR_interrupt_notEnabled = -2,
MTOUCH_SENSOR_ERROR_invalid_calibrate = -3,
MTOUCH_SENSOR_ERROR_tooManyRetries = -4,
MTOUCH_SENSOR_ERROR_scanOverrun = -5,
MTOUCH_SENSOR_ERROR_interruptedScan = -6
};
Description: Lists the sensor error
mtouch_sensor_t
{
const enum mtouch_sensor_names sensor_name;
const uint8_t adpch;
mtouch_sensor_time_t precharge_time;
mtouch_sensor_time_t acquisition_time;
mtouch_sensor_packetcounter_t oversampling;
mtouch_sensor_addcap_t addcap;
mtouch_sensor_sample_t rawSample;
unsigned enabled:1;
unsigned sampled:1;
unsigned active:1;
unsigned calibrated:1;
unsigned acqTime_cal:1;
} mtouch_sensor_t;
Description: This structure lists down all the elements corresponding to sensors configured in the project