Module for using the capacitive sensor library with support for many instances of sliders, wheels, and buttons. More...
Modules |
|
| nrf_csense module configuration | |
| Capacitive Sensor | |
|
A set of macros to facilitate creation of a new capacitive sensor instance.
|
|
Data Structures |
|
| struct | nrf_csense_slider_evt_t |
|
Structure with slider event data including the measured step.
More...
|
|
| union | nrf_csense_evt_param_t |
|
Event data union for nrf_csense events.
More...
|
|
| struct | nrf_csense_evt_t |
|
Structure with event parameters.
More...
|
|
Macros |
|
| #define | NRF_CSENSE_GET_INSTANCE_ID (instance) (&instance) |
|
Macro for returning the address of a variable.
|
|
| #define | NRF_CSENSE_BUTTON_DEF (name, p1) NRF_CSENSE_INTERNAL_BUTTON_DEF(name, p1) |
|
Statically allocate memory for the instance of a capacitive sensor.
More...
|
|
| #define | NRF_CSENSE_SLIDER_2_DEF (name, steps_no, p1, p2) NRF_CSENSE_INTERNAL_SLIDER_2_DEF(name, steps_no, p1, p2) |
|
Macro for creating a 2-pads slider instance.
More...
|
|
| #define | NRF_CSENSE_SLIDER_3_DEF (name, steps_no, p1, p2, p3) NRF_CSENSE_INTERNAL_SLIDER_3_DEF(name, steps_no, p1, p2, p3) |
|
Macro for creating a 3-pads slider instance.
More...
|
|
| #define | NRF_CSENSE_SLIDER_4_DEF (name, steps_no, p1, p2, p3, p4) NRF_CSENSE_INTERNAL_SLIDER_4_DEF(name, steps_no, p1, p2, p3, p4) |
|
Macro for creating a 4-pads slider instance.
More...
|
|
| #define | NRF_CSENSE_SLIDER_5_DEF (name, steps_no, p1, p2, p3, p4, p5) NRF_CSENSE_INTERNAL_SLIDER_5_DEF(name, steps_no, p1, p2, p3, p4, p5) |
|
Macro for creating a 5-pads slider instance.
More...
|
|
| #define | NRF_CSENSE_WHEEL_3_DEF (name, steps_no, p1, p2, p3) NRF_CSENSE_INTERNAL_WHEEL_3_DEF(name, steps_no, p1, p2, p3) |
|
Macro for creating a 3-pads wheel instance.
More...
|
|
| #define | NRF_CSENSE_WHEEL_4_DEF (name, steps_no, p1, p2, p3, p4) NRF_CSENSE_INTERNAL_WHEEL_4_DEF(name, steps_no, p1, p2, p3, p4) |
|
Macro for creating a 4-pads wheel instance.
More...
|
|
| #define | NRF_CSENSE_WHEEL_5_DEF (name, steps_no, p1, p2, p3, p4, p5) NRF_CSENSE_INTERNAL_WHEEL_5_DEF(name, steps_no, p1, p2, p3, p4, p5) |
|
Macro for creating a 5-pads wheel instance.
More...
|
|
Typedefs |
|
| typedef void(* | nrf_csense_event_handler_t )( nrf_csense_evt_t *p_evt) |
|
Capacitive sensor handler type.
|
|
Enumerations |
|
| enum |
nrf_csense_evt_type_t
{
NRF_CSENSE_BTN_EVT_PRESSED , NRF_CSENSE_BTN_EVT_RELEASED , NRF_CSENSE_SLIDER_EVT_PRESSED , NRF_CSENSE_SLIDER_EVT_RELEASED , NRF_CSENSE_SLIDER_EVT_DRAGGED } |
|
Enum for nrf_csense events.
More...
|
|
Functions |
|
| __STATIC_INLINE void | nrf_csense_instance_context_set (nrf_csense_instance_t *const p_instance, void *p_context) |
|
Function for setting a handler of the instance.
More...
|
|
| ret_code_t | nrf_csense_init ( nrf_csense_event_handler_t event_handler, uint32_t ticks) |
|
Function for initializing the module. After initialization, no instances are enabled.
More...
|
|
| ret_code_t | nrf_csense_uninit (void) |
|
Function for uninitializing the module.
More...
|
|
| ret_code_t | nrf_csense_add (nrf_csense_instance_t *const p_instance) |
|
Function for adding an instance of capacitive sensor to a linked list.
More...
|
|
| ret_code_t | nrf_csense_enable (nrf_csense_instance_t *const p_instance) |
|
Function for enabling a single instance.
More...
|
|
| ret_code_t | nrf_csense_disable (nrf_csense_instance_t *const p_instance) |
|
Function for disabling an instance.
More...
|
|
| ret_code_t | nrf_csense_ticks_set (uint32_t ticks) |
|
Function for setting ticks between next measurements.
More...
|
|
| ret_code_t | nrf_csense_steps_set (nrf_csense_instance_t *const p_instance, uint16_t steps) |
|
Function for setting steps of an instance.
More...
|
|
Detailed Description
Module for using the capacitive sensor library with support for many instances of sliders, wheels, and buttons.
Macro Definition Documentation
| #define NRF_CSENSE_BUTTON_DEF | ( | name, | |
| p1 | |||
| ) | NRF_CSENSE_INTERNAL_BUTTON_DEF(name, p1) |
Statically allocate memory for the instance of a capacitive sensor.
- Parameters
-
[in,out] name Name of the capacitive sensor instance that will be created. [in] p1 Pair of two arguments: threshold and analog_input_number. Must be passed as (analog_input_number, threshold).
| #define NRF_CSENSE_SLIDER_2_DEF | ( | name, | |
| steps_no, | |||
| p1, | |||
| p2 | |||
| ) | NRF_CSENSE_INTERNAL_SLIDER_2_DEF(name, steps_no, p1, p2) |
Macro for creating a 2-pads slider instance.
- Parameters
-
[in,out] name Name of the capacitive sensor instance that will be created. [in] steps_no Number of relative pads. It means that the slider in its handler will give values (1, steps_no). [in] p1 Pair of two arguments: threshold and analog_input_number. Must be passed as (analog_input_number, threshold). [in] p2 Pair of two arguments: threshold and analog_input_number. Must be passed as (analog_input_number, threshold).
| #define NRF_CSENSE_SLIDER_3_DEF | ( | name, | |
| steps_no, | |||
| p1, | |||
| p2, | |||
| p3 | |||
| ) | NRF_CSENSE_INTERNAL_SLIDER_3_DEF(name, steps_no, p1, p2, p3) |
Macro for creating a 3-pads slider instance.
- Parameters
-
[in,out] name Name of the capacitive sensor instance that will be created. [in] steps_no Number of relative pads. It means that the slider in its handler will give values (1, steps_no). [in] p1 Pair of two arguments: threshold and analog_input_number. Must be passed as (analog_input_number, threshold). [in] p2 Pair of two arguments: threshold and analog_input_number. Must be passed as (analog_input_number, threshold). [in] p3 Pair of two arguments: threshold and analog_input_number. Must be passed as (analog_input_number, threshold).
| #define NRF_CSENSE_SLIDER_4_DEF | ( | name, | |
| steps_no, | |||
| p1, | |||
| p2, | |||
| p3, | |||
| p4 | |||
| ) | NRF_CSENSE_INTERNAL_SLIDER_4_DEF(name, steps_no, p1, p2, p3, p4) |
Macro for creating a 4-pads slider instance.
- Parameters
-
[in,out] name Name of the capacitive sensor instance that will be created. [in] steps_no Number of relative pads. It means that the slider in its handler will give values (1, steps_no). [in] p1 Pair of two arguments: threshold and analog_input_number. Must be passed as (analog_input_number, threshold). [in] p2 Pair of two arguments: threshold and analog_input_number. Must be passed as (analog_input_number, threshold). [in] p3 Pair of two arguments: threshold and analog_input_number. Must be passed as (analog_input_number, threshold). [in] p4 Pair of two arguments: threshold and analog_input_number. Must be passed as (analog_input_number, threshold).
| #define NRF_CSENSE_SLIDER_5_DEF | ( | name, | |
| steps_no, | |||
| p1, | |||
| p2, | |||
| p3, | |||
| p4, | |||
| p5 | |||
| ) | NRF_CSENSE_INTERNAL_SLIDER_5_DEF(name, steps_no, p1, p2, p3, p4, p5) |
Macro for creating a 5-pads slider instance.
- Parameters
-
[in,out] name Name of the capacitive sensor instance that will be created. [in] steps_no Number of relative pads. It means that the slider in its handler will give values (1, steps_no). [in] p1 Pair of two arguments: threshold and analog_input_number. Must be passed as (analog_input_number, threshold). [in] p2 Pair of two arguments: threshold and analog_input_number. Must be passed as (analog_input_number, threshold). [in] p3 Pair of two arguments: threshold and analog_input_number. Must be passed as (analog_input_number, threshold). [in] p4 Pair of two arguments: threshold and analog_input_number. Must be passed as (analog_input_number, threshold). [in] p5 Pair of two arguments: threshold and analog_input_number. Must be passed as (analog_input_number, threshold).
| #define NRF_CSENSE_WHEEL_3_DEF | ( | name, | |
| steps_no, | |||
| p1, | |||
| p2, | |||
| p3 | |||
| ) | NRF_CSENSE_INTERNAL_WHEEL_3_DEF(name, steps_no, p1, p2, p3) |
Macro for creating a 3-pads wheel instance.
- Parameters
-
[in,out] name Name of the capacitive sensor instance that will be created. [in] steps_no Number of relative pads. It means that the slider in its handler will give values (1, steps_no). [in] p1 Pair of two arguments: threshold and analog_input_number. Must be passed as (analog_input_number, threshold). [in] p2 Pair of two arguments: threshold and analog_input_number. Must be passed as (analog_input_number, threshold). [in] p3 Pair of two arguments: threshold and analog_input_number. Must be passed as (analog_input_number, threshold).
| #define NRF_CSENSE_WHEEL_4_DEF | ( | name, | |
| steps_no, | |||
| p1, | |||
| p2, | |||
| p3, | |||
| p4 | |||
| ) | NRF_CSENSE_INTERNAL_WHEEL_4_DEF(name, steps_no, p1, p2, p3, p4) |
Macro for creating a 4-pads wheel instance.
- Parameters
-
[in,out] name Name of the capacitive sensor instance that will be created. [in] steps_no Number of relative pads. It means that the slider in its handler will give values (1, steps_no). [in] p1 Pair of two arguments: threshold and analog_input_number. Must be passed as (analog_input_number, threshold). [in] p2 Pair of two arguments: threshold and analog_input_number. Must be passed as (analog_input_number, threshold). [in] p3 Pair of two arguments: threshold and analog_input_number. Must be passed as (analog_input_number, threshold). [in] p4 Pair of two arguments: threshold and analog_input_number. Must be passed as (analog_input_number, threshold).
| #define NRF_CSENSE_WHEEL_5_DEF | ( | name, | |
| steps_no, | |||
| p1, | |||
| p2, | |||
| p3, | |||
| p4, | |||
| p5 | |||
| ) | NRF_CSENSE_INTERNAL_WHEEL_5_DEF(name, steps_no, p1, p2, p3, p4, p5) |
Macro for creating a 5-pads wheel instance.
- Parameters
-
[in,out] name Name of the capacitive sensor instance that will be created. [in] steps_no Number of relative pads. It means that the slider in its handler will give values (1, steps_no). [in] p1 Pair of two arguments: threshold and analog_input_number. Must be passed as (analog_input_number, threshold). [in] p2 Pair of two arguments: threshold and analog_input_number. Must be passed as (analog_input_number, threshold). [in] p3 Pair of two arguments: threshold and analog_input_number. Must be passed as (analog_input_number, threshold). [in] p4 Pair of two arguments: threshold and analog_input_number. Must be passed as (analog_input_number, threshold). [in] p5 Pair of two arguments: threshold and analog_input_number. Must be passed as (analog_input_number, threshold).
Enumeration Type Documentation
Enum for nrf_csense events.
Function Documentation
| ret_code_t nrf_csense_add | ( | nrf_csense_instance_t *const | p_instance | ) |
Function for adding an instance of capacitive sensor to a linked list.
The function calls nrf_csense_enable to enable the instance that was added to the linked list.
- Parameters
-
[in] p_instance Pointer to the capacitive sensor instance. It is saved by the module and is used whenever the instance is referred.
- Returns
- Values returned by nrf_csense_enable .
| ret_code_t nrf_csense_disable | ( | nrf_csense_instance_t *const | p_instance | ) |
Function for disabling an instance.
- Parameters
-
[in] p_instance Pointer to the instance to be disabled.
- Return values
-
NRF_ERROR_INVALID_PARAM If the instance was already disabled. NRF_SUCCESS If the instance was disabled successfully.
| ret_code_t nrf_csense_enable | ( | nrf_csense_instance_t *const | p_instance | ) |
Function for enabling a single instance.
- Parameters
-
[in,out] p_instance Pointer to the capacitive sensor instance. It is saved by the module and is used whenever the instance is referred.
- Returns
- Values returned by app_timer_start .
| ret_code_t nrf_csense_init | ( | nrf_csense_event_handler_t | event_handler , |
| uint32_t | ticks | ||
| ) |
Function for initializing the module. After initialization, no instances are enabled.
- Parameters
-
[in] event_handler Event handler for the Capacitive Sensor module. [in] ticks Time in app_timer ticks between next conversions.
- Return values
-
NRF_ERROR_INVALID_PARAM If invalid parameter was provided. NRF_ERROR_INVALID_STATE If one of the used modules is in invalid state. NRF_ERROR_INTERNAL If an error occured while initializing one of the modules used by the capacitive sensor library. NRF_SUCCESS If the module was initialized successfully.
| __STATIC_INLINE void nrf_csense_instance_context_set | ( | nrf_csense_instance_t *const | p_instance , |
| void * | p_context | ||
| ) |
Function for setting a handler of the instance.
- Parameters
-
[in] p_instance Pointer to the instance whose steps are going to be changed. [in] p_context General purpose pointer. Will be passed to the callback function.
| ret_code_t nrf_csense_steps_set | ( | nrf_csense_instance_t *const | p_instance , |
| uint16_t | steps | ||
| ) |
Function for setting steps of an instance.
Note that you have do disable the instance before you can change its number of steps.
- Parameters
-
[in] p_instance Pointer to the instance whose steps are going to be changed. [in] steps New steps value.
- Return values
-
NRF_ERROR_BUSY If the capacitive sensor was busy. NRF_SUCCESS If steps were set successfully.
| ret_code_t nrf_csense_ticks_set | ( | uint32_t | ticks | ) |
Function for setting ticks between next measurements.
- Parameters
-
[in] ticks New time between conversions in app_timer ticks.
- Return values
-
NRF_ERROR_BUSY If the capacitive sensor was busy. NRF_ERROR_INVALID_PARAM If an invalid parameter was provided. NRF_ERROR_INVALID_STATE If app_timer was in invalid state. NRF_SUCCESS If ticks were set successfully.
| ret_code_t nrf_csense_uninit | ( | void | ) |
Function for uninitializing the module.
- Returns
- Values returned by nrf_drv_csense_uninit and app_timer_stop .