Hardware access layer for managing the Low Power Comparator (LPCOMP) peripheral. More...
Data Structures | |
struct | nrf_lpcomp_config_t |
LPCOMP configuration. More... | |
Enumerations | |
enum | nrf_lpcomp_ref_t { NRF_LPCOMP_REF_SUPPLY_1_8 = LPCOMP_REFSEL_REFSEL_SupplyOneEighthPrescaling, NRF_LPCOMP_REF_SUPPLY_2_8 = LPCOMP_REFSEL_REFSEL_SupplyTwoEighthsPrescaling, NRF_LPCOMP_REF_SUPPLY_3_8 = LPCOMP_REFSEL_REFSEL_SupplyThreeEighthsPrescaling, NRF_LPCOMP_REF_SUPPLY_4_8 = LPCOMP_REFSEL_REFSEL_SupplyFourEighthsPrescaling, NRF_LPCOMP_REF_SUPPLY_5_8 = LPCOMP_REFSEL_REFSEL_SupplyFiveEighthsPrescaling, NRF_LPCOMP_REF_SUPPLY_6_8 = LPCOMP_REFSEL_REFSEL_SupplySixEighthsPrescaling, NRF_LPCOMP_REF_SUPPLY_7_8 = LPCOMP_REFSEL_REFSEL_SupplySevenEighthsPrescaling, NRF_LPCOMP_REF_EXT_REF0, NRF_LPCOMP_REF_EXT_REF1 } |
LPCOMP reference selection. More... | |
enum | nrf_lpcomp_input_t { NRF_LPCOMP_INPUT_0 = LPCOMP_PSEL_PSEL_AnalogInput0, NRF_LPCOMP_INPUT_1 = LPCOMP_PSEL_PSEL_AnalogInput1, NRF_LPCOMP_INPUT_2 = LPCOMP_PSEL_PSEL_AnalogInput2, NRF_LPCOMP_INPUT_3 = LPCOMP_PSEL_PSEL_AnalogInput3, NRF_LPCOMP_INPUT_4 = LPCOMP_PSEL_PSEL_AnalogInput4, NRF_LPCOMP_INPUT_5 = LPCOMP_PSEL_PSEL_AnalogInput5, NRF_LPCOMP_INPUT_6 = LPCOMP_PSEL_PSEL_AnalogInput6, NRF_LPCOMP_INPUT_7 = LPCOMP_PSEL_PSEL_AnalogInput7 } |
LPCOMP input selection. More... | |
enum | nrf_lpcomp_detect_t { NRF_LPCOMP_DETECT_CROSS = LPCOMP_ANADETECT_ANADETECT_Cross, NRF_LPCOMP_DETECT_UP = LPCOMP_ANADETECT_ANADETECT_Up, NRF_LPCOMP_DETECT_DOWN = LPCOMP_ANADETECT_ANADETECT_Down } |
LPCOMP detection type selection. More... | |
enum | nrf_lpcomp_task_t { NRF_LPCOMP_TASK_START = offsetof(NRF_LPCOMP_Type, TASKS_START), NRF_LPCOMP_TASK_STOP = offsetof(NRF_LPCOMP_Type, TASKS_STOP), NRF_LPCOMP_TASK_SAMPLE = offsetof(NRF_LPCOMP_Type, TASKS_SAMPLE) } |
LPCOMP tasks. More... | |
enum | nrf_lpcomp_event_t { NRF_LPCOMP_EVENT_READY = offsetof(NRF_LPCOMP_Type, EVENTS_READY), NRF_LPCOMP_EVENT_DOWN = offsetof(NRF_LPCOMP_Type, EVENTS_DOWN), NRF_LPCOMP_EVENT_UP = offsetof(NRF_LPCOMP_Type, EVENTS_UP), NRF_LPCOMP_EVENT_CROSS = offsetof(NRF_LPCOMP_Type, EVENTS_CROSS) } |
LPCOMP events. More... | |
enum | nrf_lpcomp_int_mask_t { NRF_LPCOMP_INT_READY_MASK = LPCOMP_INTENSET_READY_Msk, NRF_LPCOMP_INT_DOWN_MASK = LPCOMP_INTENSET_DOWN_Msk, NRF_LPCOMP_INT_UP_MASK = LPCOMP_INTENSET_UP_Msk, NRF_LPCOMP_INT_CROSS_MASK = LPCOMP_INTENSET_CROSS_Msk } |
LPCOMP interrupts. More... | |
enum | nrf_lpcomp_short_mask_t { NRF_LPCOMP_SHORT_CROSS_STOP_MASK = LPCOMP_SHORTS_CROSS_STOP_Msk, NRF_LPCOMP_SHORT_UP_STOP_MASK = LPCOMP_SHORTS_UP_STOP_Msk, NRF_LPCOMP_SHORT_DOWN_STOP_MASK = LPCOMP_SHORTS_DOWN_STOP_Msk, NRF_LPCOMP_SHORT_READY_STOP_MASK = LPCOMP_SHORTS_READY_STOP_Msk, NRF_LPCOMP_SHORT_READY_SAMPLE_MASK = LPCOMP_SHORTS_READY_SAMPLE_Msk } |
LPCOMP shortcut masks. More... | |
enum | nrf_lpcomp_hysteresis_t { NRF_LPCOMP_HYST_NOHYST = LPCOMP_HYST_HYST_Disabled, NRF_LPCOMP_HYST_ENABLED = LPCOMP_HYST_HYST_Enabled } |
LPCOMP hysteresis. More... | |
Functions | |
NRF_STATIC_INLINE void | nrf_lpcomp_configure (NRF_LPCOMP_Type *p_reg, nrf_lpcomp_config_t const *p_config) |
Function for configuring LPCOMP. More... | |
NRF_STATIC_INLINE void | nrf_lpcomp_input_select (NRF_LPCOMP_Type *p_reg, nrf_lpcomp_input_t input) |
Function for selecting the LPCOMP input. More... | |
NRF_STATIC_INLINE void | nrf_lpcomp_enable (NRF_LPCOMP_Type *p_reg) |
Function for enabling the Low Power Comparator. More... | |
NRF_STATIC_INLINE void | nrf_lpcomp_disable (NRF_LPCOMP_Type *p_reg) |
Function for disabling the Low Power Comparator. More... | |
NRF_STATIC_INLINE uint32_t | nrf_lpcomp_result_get (NRF_LPCOMP_Type const *p_reg) |
Function for getting the last LPCOMP compare result. More... | |
NRF_STATIC_INLINE void | nrf_lpcomp_int_enable (NRF_LPCOMP_Type *p_reg, uint32_t mask) |
Function for enabling interrupts from LPCOMP. More... | |
NRF_STATIC_INLINE void | nrf_lpcomp_int_disable (NRF_LPCOMP_Type *p_reg, uint32_t mask) |
Function for disabling interrupts from LPCOMP. More... | |
NRF_STATIC_INLINE uint32_t | nrf_lpcomp_int_enable_check (NRF_LPCOMP_Type const *p_reg, uint32_t mask) |
Function for checking if the specified interrupts are enabled. More... | |
NRF_STATIC_INLINE uint32_t | nrf_lpcomp_task_address_get (NRF_LPCOMP_Type const *p_reg, nrf_lpcomp_task_t task) |
Function for getting the address of the specified LPCOMP task register. More... | |
NRF_STATIC_INLINE uint32_t | nrf_lpcomp_event_address_get (NRF_LPCOMP_Type const *p_reg, nrf_lpcomp_event_t event) |
Function for getting the address of the specified LPCOMP event register. More... | |
NRF_STATIC_INLINE void | nrf_lpcomp_shorts_enable (NRF_LPCOMP_Type *p_reg, uint32_t mask) |
Function for setting LPCOMP shorts. More... | |
NRF_STATIC_INLINE void | nrf_lpcomp_shorts_disable (NRF_LPCOMP_Type *p_reg, uint32_t mask) |
Function for clearing LPCOMP shorts by mask. More... | |
NRF_STATIC_INLINE void | nrf_lpcomp_task_trigger (NRF_LPCOMP_Type *p_reg, nrf_lpcomp_task_t task) |
Function for setting the specified LPCOMP task. More... | |
NRF_STATIC_INLINE void | nrf_lpcomp_event_clear (NRF_LPCOMP_Type *p_reg, nrf_lpcomp_event_t event) |
Function for clearing the specified LPCOMP event. More... | |
NRF_STATIC_INLINE bool | nrf_lpcomp_event_check (NRF_LPCOMP_Type const *p_reg, nrf_lpcomp_event_t event) |
Function for retrieving the state of the LPCOMP event. More... | |
Hardware access layer for managing the Low Power Comparator (LPCOMP) peripheral.
enum nrf_lpcomp_detect_t |
enum nrf_lpcomp_event_t |
enum nrf_lpcomp_input_t |
enum nrf_lpcomp_ref_t |
LPCOMP reference selection.
LPCOMP shortcut masks.
enum nrf_lpcomp_task_t |
NRF_STATIC_INLINE void nrf_lpcomp_configure | ( | NRF_LPCOMP_Type * | p_reg, |
nrf_lpcomp_config_t const * | p_config | ||
) |
Function for configuring LPCOMP.
This function powers on LPCOMP and configures it. LPCOMP is in DISABLE state after configuration, so it must be enabled before using it. All shorts are inactive, events are cleared, and LPCOMP is stopped.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | p_config | Configuration. |
NRF_STATIC_INLINE void nrf_lpcomp_disable | ( | NRF_LPCOMP_Type * | p_reg | ) |
Function for disabling the Low Power Comparator.
This function disables LPCOMP.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE void nrf_lpcomp_enable | ( | NRF_LPCOMP_Type * | p_reg | ) |
Function for enabling the Low Power Comparator.
This function enables LPCOMP.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE uint32_t nrf_lpcomp_event_address_get | ( | NRF_LPCOMP_Type const * | p_reg, |
nrf_lpcomp_event_t | event | ||
) |
Function for getting the address of the specified LPCOMP event register.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | event | LPCOMP event. |
NRF_STATIC_INLINE bool nrf_lpcomp_event_check | ( | NRF_LPCOMP_Type const * | p_reg, |
nrf_lpcomp_event_t | event | ||
) |
Function for retrieving the state of the LPCOMP event.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | event | Event to be checked. |
true | The event has been generated. |
false | The event has not been generated. |
NRF_STATIC_INLINE void nrf_lpcomp_event_clear | ( | NRF_LPCOMP_Type * | p_reg, |
nrf_lpcomp_event_t | event | ||
) |
Function for clearing the specified LPCOMP event.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | event | LPCOMP event to be cleared. |
NRF_STATIC_INLINE void nrf_lpcomp_input_select | ( | NRF_LPCOMP_Type * | p_reg, |
nrf_lpcomp_input_t | input | ||
) |
Function for selecting the LPCOMP input.
This function selects the active input of LPCOMP.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | input | Input to be selected. |
NRF_STATIC_INLINE void nrf_lpcomp_int_disable | ( | NRF_LPCOMP_Type * | p_reg, |
uint32_t | mask | ||
) |
Function for disabling interrupts from LPCOMP.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | mask | Mask of interrupts to be disabled. |
NRF_STATIC_INLINE void nrf_lpcomp_int_enable | ( | NRF_LPCOMP_Type * | p_reg, |
uint32_t | mask | ||
) |
Function for enabling interrupts from LPCOMP.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | mask | Mask of interrupts to be enabled. |
NRF_STATIC_INLINE uint32_t nrf_lpcomp_int_enable_check | ( | NRF_LPCOMP_Type const * | p_reg, |
uint32_t | mask | ||
) |
Function for checking if the specified interrupts are enabled.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | mask | Mask of interrupts to be checked. |
NRF_STATIC_INLINE uint32_t nrf_lpcomp_result_get | ( | NRF_LPCOMP_Type const * | p_reg | ) |
Function for getting the last LPCOMP compare result.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE void nrf_lpcomp_shorts_disable | ( | NRF_LPCOMP_Type * | p_reg, |
uint32_t | mask | ||
) |
Function for clearing LPCOMP shorts by mask.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | mask | Mask of shortcuts. |
NRF_STATIC_INLINE void nrf_lpcomp_shorts_enable | ( | NRF_LPCOMP_Type * | p_reg, |
uint32_t | mask | ||
) |
Function for setting LPCOMP shorts.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | mask | Mask of shortcuts. |
NRF_STATIC_INLINE uint32_t nrf_lpcomp_task_address_get | ( | NRF_LPCOMP_Type const * | p_reg, |
nrf_lpcomp_task_t | task | ||
) |
Function for getting the address of the specified LPCOMP task register.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | task | LPCOMP task. |
NRF_STATIC_INLINE void nrf_lpcomp_task_trigger | ( | NRF_LPCOMP_Type * | p_reg, |
nrf_lpcomp_task_t | task | ||
) |
Function for setting the specified LPCOMP task.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | task | LPCOMP task to be set. |