nRF5 SDK v17.1.0
Modules | Data Structures | Macros | Typedefs | Functions
Capacitive sensor low-level library

Module for using the capacitive sensor on low-energy level. More...

Modules

 Capacitive sensor low-level module configuration
 

Data Structures

struct  nrf_drv_csense_config_t
 Module initializing structure. More...
 
struct  nrf_drv_csense_evt_t
 Structure holding event parameters. More...
 

Macros

#define MAX_ANALOG_INPUTS   8
 Maximum number of analog inputs.
 

Typedefs

typedef void(* nrf_drv_csense_event_handler_t )(nrf_drv_csense_evt_t *p_event_struct)
 Capacitive sensor event handler. Called from conversion handler. More...
 

Functions

ret_code_t nrf_drv_csense_init (nrf_drv_csense_config_t const *p_config, nrf_drv_csense_event_handler_t event_handler)
 Function for initializing the module. More...
 
ret_code_t nrf_drv_csense_uninit (void)
 Function for unintializing the capacitive sensor. Clears the mask of enabled channels. More...
 
void nrf_drv_csense_channels_enable (uint8_t channels_mask)
 Function for enabling analog channels for the capacitive sensor. More...
 
void nrf_drv_csense_channels_disable (uint8_t channels_mask)
 Function for disabling analog channels of the capacitive sensor. More...
 
uint16_t nrf_drv_csense_channel_read (uint8_t csense_channel)
 Function for getting the last read value from an analog channel. More...
 
ret_code_t nrf_drv_csense_sample (void)
 Function for triggering a measurement on all enabled analog channels. The handler will be called on every completed measurement. More...
 
bool nrf_drv_csense_is_busy (void)
 Function for checking if the module is busy. More...
 

Detailed Description

Module for using the capacitive sensor on low-energy level.

Typedef Documentation

typedef void(* nrf_drv_csense_event_handler_t)(nrf_drv_csense_evt_t *p_event_struct)

Capacitive sensor event handler. Called from conversion handler.

Parameters
[in]event_structStructure holding event parameters.

Function Documentation

uint16_t nrf_drv_csense_channel_read ( uint8_t  csense_channel)

Function for getting the last read value from an analog channel.

Parameters
[in]csense_channelNumber of the channel to get the value from.
Returns
Analog value measured on the channel.
void nrf_drv_csense_channels_disable ( uint8_t  channels_mask)

Function for disabling analog channels of the capacitive sensor.

Parameters
[in]channels_maskMask of analog channels to be disabled.
void nrf_drv_csense_channels_enable ( uint8_t  channels_mask)

Function for enabling analog channels for the capacitive sensor.

Parameters
[in]channels_maskMask of analog channels to be enabled.
ret_code_t nrf_drv_csense_init ( nrf_drv_csense_config_t const *  p_config,
nrf_drv_csense_event_handler_t  event_handler 
)

Function for initializing the module.

After calling this function, the module is in initialized state and all channels are disabled. The nrf_drv_csense_channels_enable function must be called. This function initializes all modules required by the capacitive sensor library: ADC for (nRF51) or TIMERs, PPIs, and COMP (for nRF52).

Parameters
[in]p_configStructure for initializing the module.
[in]event_handlerEvent handler for capacitive sensor events.
Return values
NRF_ERROR_INVALID_PARAMInvalid parameter.
NRF_ERROR_NO_MEMTimer operations queue was full.
NRF_ERROR_INTERNALError occurred during timers, PPI's, or COMP initialization.
NRF_SUCCESSModule was initialized successfully.
See Also
nrf_drv_csense_channels_enable
bool nrf_drv_csense_is_busy ( void  )

Function for checking if the module is busy.

Returns
True if busy or false if not busy.
ret_code_t nrf_drv_csense_sample ( void  )

Function for triggering a measurement on all enabled analog channels. The handler will be called on every completed measurement.

Return values
NRF_ERROR_BUSYIf the module was busy or SAADC module is in use and was busy.
NRF_SUCCESSIf the measurement was triggered successfully.
ret_code_t nrf_drv_csense_uninit ( void  )

Function for unintializing the capacitive sensor. Clears the mask of enabled channels.

Returns
Values returned by nrf_drv_ppi_channel_free.

Documentation feedback | Developer Zone | Subscribe | Updated