![]() |
nRF5 SDK
v13.0.0-1.alpha
|
Choose documentation: | nRF5 SDK | S132 SoftDevice API | S140 SoftDevice API | S212 SoftDevice API | S332 SoftDevice API |
The Capacitive Sensor driver provides support for power-efficient capacitive sensing.
The number of supported capacitive pads is equal to the number of available analog channels – 8. This driver uses the COMP module, which supports single capacitive touch sensing. For details, refer to Capacitive sensing.
You can create only one instance of this driver. Additionally, the number of channels is limited to the number of analog channels, which is eight.
The driver uses the following resources:
Important: If the Capacitive Sensor driver is used for analog input, it cannot be used by ADC, COMP, or LPCOMP as these three modules share resources.
There are two functions that you must run before you can start working with this driver.
First, you must initialize the module without specifying any additional configuration parameters.
After the module is initialized, all channels are automatically disabled. To enable the channels, you must run the function nrf_drv_csense_channels_enable. After that, you can start the measurement by calling nrf_drv_csense_sample.
NOTE: Even if all channels are disabled, there is always one channel that remains enabled after the COMP driver initialization. This channel cannot be used for ADC or LPCOMP because of sharing resources. After deinitializing COMP, the channel is available again.
You can now start working with the module. Every time you call the nrf_drv_csense_sample function, the conversion of all enabled channels is performed. You can read the result through a handler or at any time after the conversion. However, data is overwritten after each conversion, so it can be read only until the next conversion.
See the Capacitive Sensor Driver Example for a full example that uses Capacitive Sensor driver.