LPCOMP HALY

group nrfy_lpcomp

Hardware access layer with cache and barrier support for managing the LPCOMP peripheral.

Functions

NRFY_STATIC_INLINE void nrfy_lpcomp_periph_configure(NRF_LPCOMP_Type *p_reg, nrfy_lpcomp_config_t const *p_config)

Function for configuring the LPCOMP.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • p_config[in] Pointer to the peripheral configuration structure.

NRFY_STATIC_INLINE void nrfy_lpcomp_int_init(NRF_LPCOMP_Type *p_reg, uint32_t mask, uint8_t irq_priority, bool enable)

Function for initializing the specified LPCOMP interrupts.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of interrupts to be initialized.

  • irq_priority[in] Interrupt priority.

  • enable[in] True if the interrupts are to be enabled, false otherwise.

NRFY_STATIC_INLINE void nrfy_lpcomp_int_uninit(NRF_LPCOMP_Type *p_reg)

Function for uninitializing the LPCOMP interrupts.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

NRFY_STATIC_INLINE uint32_t nrfy_lpcomp_events_process(NRF_LPCOMP_Type *p_reg, uint32_t mask)

Function for processing the specified LPCOMP events.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of events to be processed, created by NRFY_EVENT_TO_INT_BITMASK().

Returns:

Mask of events that were generated and processed. To be checked against the result of NRFY_EVENT_TO_INT_BITMASK().

NRFY_STATIC_INLINE bool nrfy_lpcomp_sample_check(NRF_LPCOMP_Type *p_reg)

Function for reading the current state of the LPCOMP input.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Return values:
  • false – The input voltage is below the threshold.

  • true – The input voltage is above the threshold.

NRFY_STATIC_INLINE void nrfy_lpcomp_ref_set(NRF_LPCOMP_Type *p_reg, nrf_lpcomp_ref_t reference)

See also

nrf_lpcomp_ref_set Function for setting the reference source.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • reference[in] LPCOMP reference selection.

NRFY_STATIC_INLINE void nrfy_lpcomp_ext_ref_set(NRF_LPCOMP_Type *p_reg, nrf_lpcomp_ext_ref_t ext_ref)

See also

nrf_lpcomp_ext_ref_set Function for setting the external analog reference source.

To use external reference first call nrf_lpcomp_ref_set with NRF_LPCOMP_REF_EXT_REF argument.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • ext_ref[in] LPCOMP external analog reference selection.

NRFY_STATIC_INLINE void nrfy_lpcomp_detection_set(NRF_LPCOMP_Type *p_reg, nrf_lpcomp_detect_t detection)

See also

nrf_lpcomp_detection_set Function for setting the detection type.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • detection[in] LPCOMP detection type.

NRFY_STATIC_INLINE void nrfy_lpcomp_hysteresis_set(NRF_LPCOMP_Type *p_reg, nrf_lpcomp_hyst_t hyst)

See also

nrf_lpcomp_hysteresis_set Function for setting the hysteresis.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • hyst[in] LPCOMP comparator hysteresis.

NRFY_STATIC_INLINE void nrfy_lpcomp_configure(NRF_LPCOMP_Type *p_reg, nrf_lpcomp_config_t const *p_config)

See also

nrf_lpcomp_configure 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.

Deprecated:

Use the dedicated functions instead.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • p_config[in] Configuration.

NRFY_STATIC_INLINE void nrfy_lpcomp_input_select(NRF_LPCOMP_Type *p_reg, nrf_lpcomp_input_t input)

See also

nrf_lpcomp_input_select Function for selecting an active LPCOMP input.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • input[in] Input to be selected.

NRFY_STATIC_INLINE void nrfy_lpcomp_enable(NRF_LPCOMP_Type *p_reg)

See also

nrf_lpcomp_enable Function for enabling the LPCOMP.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

NRFY_STATIC_INLINE void nrfy_lpcomp_disable(NRF_LPCOMP_Type *p_reg)

See also

nrf_lpcomp_disable Function for disabling the LPCOMP.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

NRFY_STATIC_INLINE uint32_t nrfy_lpcomp_result_get(NRF_LPCOMP_Type const *p_reg)

See also

nrf_lpcomp_result_get Function for getting the last LPCOMP compare result.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns:

The last compare result. If 0, then VIN+ < VIN-. If 1, then VIN- < VIN+.

NRFY_STATIC_INLINE void nrfy_lpcomp_int_enable(NRF_LPCOMP_Type *p_reg, uint32_t mask)

See also

nrf_lpcomp_int_enable Function for enabling interrupts from LPCOMP.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of interrupts to be enabled. Use nrf_lpcomp_int_mask_t values for bit masking.

NRFY_STATIC_INLINE void nrfy_lpcomp_int_disable(NRF_LPCOMP_Type *p_reg, uint32_t mask)

See also

nrf_lpcomp_int_disable Function for disabling interrupts from LPCOMP.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of interrupts to be disabled. Use nrf_lpcomp_int_mask_t values for bit masking.

NRFY_STATIC_INLINE uint32_t nrfy_lpcomp_int_enable_check(NRF_LPCOMP_Type const *p_reg, uint32_t mask)

See also

nrf_lpcomp_int_enable_check Function for checking if the specified interrupts are enabled.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of interrupts to be checked. Use nrf_lpcomp_int_mask_t values for bit masking.

Returns:

Mask of enabled interrupts.

NRFY_STATIC_INLINE uint32_t nrfy_lpcomp_task_address_get(NRF_LPCOMP_Type const *p_reg, nrf_lpcomp_task_t task)

See also

nrf_lpcomp_task_address_get Function for getting the address of the specified LPCOMP task register.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • task[in] LPCOMP task.

Returns:

The address of the specified LPCOMP task.

NRFY_STATIC_INLINE uint32_t nrfy_lpcomp_event_address_get(NRF_LPCOMP_Type const *p_reg, nrf_lpcomp_event_t event)

See also

nrf_lpcomp_event_address_get Function for getting the address of the specified LPCOMP event register.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] LPCOMP event.

Returns:

The address of the specified LPCOMP event.

NRFY_STATIC_INLINE void nrfy_lpcomp_shorts_enable(NRF_LPCOMP_Type *p_reg, uint32_t mask)

See also

nrf_lpcomp_shorts_enable Function for setting LPCOMP shorts.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of shortcuts.

NRFY_STATIC_INLINE void nrfy_lpcomp_shorts_disable(NRF_LPCOMP_Type *p_reg, uint32_t mask)

See also

nrf_lpcomp_shorts_disable Function for clearing LPCOMP shorts by mask.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of shortcuts.

NRFY_STATIC_INLINE void nrfy_lpcomp_task_trigger(NRF_LPCOMP_Type *p_reg, nrf_lpcomp_task_t task)

See also

nrf_lpcomp_task_trigger Function for setting the specified LPCOMP task.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • task[in] LPCOMP task to be set.

NRFY_STATIC_INLINE void nrfy_lpcomp_event_clear(NRF_LPCOMP_Type *p_reg, nrf_lpcomp_event_t event)

See also

nrf_lpcomp_event_clear Function for clearing the specified LPCOMP event.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] LPCOMP event to be cleared.

NRFY_STATIC_INLINE bool nrfy_lpcomp_event_check(NRF_LPCOMP_Type const *p_reg, nrf_lpcomp_event_t event)

See also

nrf_lpcomp_event_check Function for retrieving the state of the LPCOMP event.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] Event to be checked.

Return values:
  • true – The event has been generated.

  • false – The event has not been generated.

struct nrfy_lpcomp_config_t
#include <nrfy_lpcomp.h>

LPCOMP configuration structure.

Public Members

nrf_lpcomp_config_t config

Peripheral configuration.

Deprecated:

Use other fields instead.

nrf_lpcomp_ref_t reference

Reference selection.

nrf_lpcomp_ext_ref_t ext_ref

External analog reference selection.

nrf_lpcomp_detect_t detection

Detection type.

nrf_lpcomp_input_t input

Input to be monitored.