COMP HALY

group nrfy_comp

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

Defines

NRFY_COMP_HAS_ISOURCE

@refhal{NRF_COMP_HAS_ISOURCE}

Functions

NRFY_STATIC_INLINE void nrfy_comp_periph_configure(NRF_COMP_Type *p_reg, nrfy_comp_config_t const *p_config)

Function for configuring the COMP.

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_comp_int_init(NRF_COMP_Type *p_reg, uint32_t mask, uint8_t irq_priority, bool enable)

Function for initializing the specified COMP 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_comp_int_uninit(NRF_COMP_Type *p_reg)

Function for uninitializing the COMP interrupts.

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

NRFY_STATIC_INLINE uint32_t nrfy_comp_events_process(NRF_COMP_Type *p_reg, uint32_t mask)

Function for processing the specified COMP 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 uint32_t nrfy_comp_sample(NRF_COMP_Type *p_reg)

Function for reading the current state of the COMP.

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

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

  • 1 – The input voltage is above the threshold.

NRFY_STATIC_INLINE void nrfy_comp_enable(NRF_COMP_Type *p_reg)

@refhal{nrf_comp_enable}

NRFY_STATIC_INLINE void nrfy_comp_disable(NRF_COMP_Type *p_reg)

@refhal{nrf_comp_disable}

NRFY_STATIC_INLINE bool nrfy_comp_enable_check(NRF_COMP_Type const *p_reg)

@refhal{nrf_comp_enable_check}

NRFY_STATIC_INLINE void nrfy_comp_ref_set(NRF_COMP_Type *p_reg, nrf_comp_ref_t reference)

@refhal{nrf_comp_ref_set}

NRFY_STATIC_INLINE void nrfy_comp_ext_ref_set(NRF_COMP_Type *p_reg, nrf_comp_ext_ref_t ext_ref)

@refhal{nrf_comp_ext_ref_set}

NRFY_STATIC_INLINE void nrfy_comp_th_set(NRF_COMP_Type *p_reg, nrf_comp_th_t threshold)

@refhal{nrf_comp_th_set}

NRFY_STATIC_INLINE void nrfy_comp_main_mode_set(NRF_COMP_Type *p_reg, nrf_comp_main_mode_t main_mode)

@refhal{nrf_comp_main_mode_set}

NRFY_STATIC_INLINE void nrfy_comp_speed_mode_set(NRF_COMP_Type *p_reg, nrf_comp_sp_mode_t speed_mode)

@refhal{nrf_comp_speed_mode_set}

NRFY_STATIC_INLINE void nrfy_comp_hysteresis_set(NRF_COMP_Type *p_reg, nrf_comp_hyst_t hyst)

@refhal{nrf_comp_hysteresis_set}

NRFY_STATIC_INLINE void nrfy_comp_isource_set(NRF_COMP_Type *p_reg, nrf_isource_t isource)

@refhal{nrf_comp_isource_set}

NRFY_STATIC_INLINE void nrfy_comp_input_select(NRF_COMP_Type *p_reg, nrf_comp_input_t input)

@refhal{nrf_comp_input_select}

NRFY_STATIC_INLINE uint32_t nrfy_comp_result_get(NRF_COMP_Type const *p_reg)

@refhal{nrf_comp_result_get}

NRFY_STATIC_INLINE void nrfy_comp_int_enable(NRF_COMP_Type *p_reg, uint32_t mask)

@refhal{nrf_comp_int_enable}

NRFY_STATIC_INLINE void nrfy_comp_int_disable(NRF_COMP_Type *p_reg, uint32_t mask)

@refhal{nrf_comp_int_disable}

NRFY_STATIC_INLINE uint32_t nrfy_comp_int_enable_check(NRF_COMP_Type const *p_reg, uint32_t mask)

@refhal{nrf_comp_int_enable_check}

NRFY_STATIC_INLINE uint32_t nrfy_comp_task_address_get(NRF_COMP_Type const *p_reg, nrf_comp_task_t task)

@refhal{nrf_comp_task_address_get}

NRFY_STATIC_INLINE uint32_t nrfy_comp_event_address_get(NRF_COMP_Type const *p_reg, nrf_comp_event_t event)

@refhal{nrf_comp_event_address_get}

NRFY_STATIC_INLINE void nrfy_comp_shorts_enable(NRF_COMP_Type *p_reg, uint32_t mask)

@refhal{nrf_comp_shorts_enable}

NRFY_STATIC_INLINE void nrfy_comp_shorts_disable(NRF_COMP_Type *p_reg, uint32_t mask)

@refhal{nrf_comp_shorts_disable}

NRFY_STATIC_INLINE void nrfy_comp_task_trigger(NRF_COMP_Type *p_reg, nrf_comp_task_t task)

@refhal{nrf_comp_task_trigger}

NRFY_STATIC_INLINE void nrfy_comp_event_clear(NRF_COMP_Type *p_reg, nrf_comp_event_t event)

@refhal{nrf_comp_event_clear}

NRFY_STATIC_INLINE bool nrfy_comp_event_check(NRF_COMP_Type const *p_reg, nrf_comp_event_t event)

@refhal{nrf_comp_event_check}

struct nrfy_comp_config_t
#include <nrfy_comp.h>

COMP configuration structure.

Public Members

nrf_comp_ref_t reference

Reference selection.

nrf_comp_ext_ref_t ext_ref

External analog reference selection.

nrf_comp_main_mode_t main_mode

Main operation mode.

nrf_comp_th_t threshold

Structure holding THDOWN and THUP values needed by the COMP_TH register.

nrf_comp_sp_mode_t speed_mode

Speed and power mode.

nrf_comp_hyst_t hyst

Comparator hysteresis.

nrf_isource_t isource

Current source selected on analog input.

nrf_comp_input_t input

Input to be monitored.