CSLIB library hardware configuration

Description

Hardware configuration for CSLIB.

These definitions configure the capacitive sensing hardware in active and sleep mode scans. They also configure channel-by-channel thresholds and expected touchd deltas.

Macros

#define DEF_NUM_SENSORS 2
Defines the size of the sensor node array.
#define MUX_VALUE_ARRAY 0, 1
Cross reference between sensor number ordering and pin ordering.
#define ACTIVE_THRESHOLD_ARRAY 70, 70
Per channel active threshold setting.
#define INACTIVE_THRESHOLD_ARRAY 30, 30
Per channel inactive threshold setting.
#define AVERAGE_TOUCH_DELTA_ARRAY 64 >> 4, 64 >> 4
Per-channel expected touch delta.
#define CSLIB_MUX_INPUT 3, 4
Per channel ACMP_CAPSENSE channel value for each enabled sensor.

Variables

const uint16_t CSLIB_muxInput []
Array stores ACMP input settings.
const uint8_t CSLIB_muxValues []
Array of cross-references between sensor number and actual pin number.
uint8_t sendComms
Only send comms after new values.

Macro Definition Documentation

DEF_NUM_SENSORS

#define DEF_NUM_SENSORS   2

Defines the size of the sensor node array.

Also defines volatile arrays that have a one-to-one correspondence to the number of sensors in the project.

Note
Minimum value is 1, maximum value is the number of capacitive sensing-enabled pins on the device

MUX_VALUE_ARRAY

#define MUX_VALUE_ARRAY   0, 1

Cross reference between sensor number ordering and pin ordering.

This allows for using pins that are not in order when doing layout.

ACTIVE_THRESHOLD_ARRAY

#define ACTIVE_THRESHOLD_ARRAY   70, 70

Per channel active threshold setting.

Note
Minimum threshold used is INACTIVE_THRESHOLD_ARRAY value, maximum value is 100

INACTIVE_THRESHOLD_ARRAY

#define INACTIVE_THRESHOLD_ARRAY   30, 30

Per channel inactive threshold setting.

Note
Minimum threshold used is 1, maximum value is ACTIVE_THRESHOLD_ARRAY

AVERAGE_TOUCH_DELTA_ARRAY

#define AVERAGE_TOUCH_DELTA_ARRAY   64 >> 4, 64 >> 4

Per-channel expected touch delta.

This value describes the difference in capacitive sensing output codes between the inactive/baseline of the sensor, and the output of the sensor when active(touched).

Note
These values should be defined in terms of X/16, or X>>4, as they are stored in a packed byte array

CSLIB_MUX_INPUT

#define CSLIB_MUX_INPUT   3, 4

Per channel ACMP_CAPSENSE channel value for each enabled sensor.

Variable Documentation

CSLIB_muxInput

const uint16_t CSLIB_muxInput[]

Array stores ACMP input settings.

Array stores ACMP input settings.

CSLIB_muxValues

const uint8_t CSLIB_muxValues[]

Array of cross-references between sensor number and actual pin number.

Array of cross-references between sensor number and actual pin number.

sendComms

uint8_t sendComms

Only send comms after new values.