- group nrfx_lpcomp
Low Power Comparator (LPCOMP) peripheral driver.
LPCOMP driver default configuration.
This configuration sets up LPCOMP with the following options:
reference voltage: 4/8 of supply voltage
detection of both up and down crossings
_input – [in] Comparator input pin.
nrfx_err_t nrfx_lpcomp_init(nrfx_lpcomp_config_t const *p_config, nrfx_lpcomp_event_handler_t event_handler)
Function for initializing the LPCOMP driver.
This function initializes the LPCOMP driver, but does not enable the peripheral or any interrupts. To start the driver, call the function nrfx_lpcomp_enable() after initialization.
p_config – [in] Pointer to the structure with the initial configuration.
event_handler – [in] Event handler provided by the user. Must not be NULL.
- Return values
NRFX_SUCCESS – Initialization was successful.
NRFX_ERROR_INVALID_STATE – The driver has already been initialized.
NRFX_ERROR_BUSY – The COMP peripheral is already in use. This is possible only if Peripheral Resource Sharing (PRS) module is enabled.
Function for uninitializing the LCOMP driver.
This function uninitializes the LPCOMP driver. The LPCOMP peripheral and its interrupts are disabled, and local variables are cleaned. After this call, you must initialize the driver again by calling nrfx_lpcomp_init() if you want to use it.
Function for enabling the LPCOMP peripheral and interrupts.
Before calling this function, the driver must be initialized. This function enables the LPCOMP peripheral and its interrupts.
- #include <nrfx_lpcomp.h>