![]() |
nrfx 4.5.0
|
Hardware access layer (HAL) for managing the Comparator (COMP) peripheral. More...
Data Structures | |
| struct | nrf_comp_th_t |
| COMP THDOWN and THUP values that are used to calculate the threshold voltages VDOWN and VUP. More... | |
| struct | nrf_comp_ref_conf_t |
| COMP reference configuration. More... | |
Typedefs | |
| typedef uint32_t | nrf_comp_input_t |
| COMP analog pin selection. | |
| typedef uint32_t | nrf_comp_ext_ref_t |
| COMP external analog reference selection. | |
Enumerations | |
| enum | nrf_comp_ref_t { NRF_COMP_REF_INT_1V2 = COMP_REFSEL_REFSEL_Int1V2 , NRF_COMP_REF_INT_1V8 = COMP_REFSEL_REFSEL_Int1V8 , NRF_COMP_REF_INT_2V4 = COMP_REFSEL_REFSEL_Int2V4 , NRF_COMP_REF_AVDDAO1V8 = COMP_REFSEL_REFSEL_AVDDAO1V8 , NRF_COMP_REF_VDD = COMP_REFSEL_REFSEL_VDD , NRF_COMP_REF_AREF = COMP_REFSEL_REFSEL_ARef } |
| COMP reference selection. More... | |
| enum | nrf_comp_main_mode_t { NRF_COMP_MAIN_MODE_SE = COMP_MODE_MAIN_SE , NRF_COMP_MAIN_MODE_DIFF = COMP_MODE_MAIN_Diff } |
| COMP main operation mode. More... | |
| enum | nrf_comp_sp_mode_t { NRF_COMP_SP_MODE_LOW = COMP_MODE_SP_Low , NRF_COMP_SP_MODE_NORMAL = COMP_MODE_SP_Normal , NRF_COMP_SP_MODE_HIGH = COMP_MODE_SP_High } |
| COMP speed and power mode. More... | |
| enum | nrf_comp_hyst_t { NRF_COMP_HYST_NO_HYST = COMP_HYST_HYST_NoHyst , NRF_COMP_HYST_DISABLED = NRF_COMP_HYST_NO_HYST , NRF_COMP_HYST_40MV = COMP_HYST_HYST_Hyst40mV , NRF_COMP_HYST_ENABLED = NRF_COMP_HYST_40MV , NRF_COMP_HYST_50MV = COMP_HYST_HYST_Hyst50mV , NRF_COMP_HYST_ENABLED = NRF_COMP_HYST_40MV } |
| COMP comparator hysteresis. More... | |
| enum | nrf_comp_isource_t { NRF_COMP_ISOURCE_OFF = COMP_ISOURCE_ISOURCE_Off , NRF_COMP_ISOURCE_IEN_2UA5 = COMP_ISOURCE_ISOURCE_Ien2uA5 , NRF_COMP_ISOURCE_IEN_5UA = COMP_ISOURCE_ISOURCE_Ien5uA , NRF_COMP_ISOURCE_IEN_10UA = COMP_ISOURCE_ISOURCE_Ien10uA } |
| COMP current source selection on analog input. More... | |
| enum | nrf_comp_task_t { NRF_COMP_TASK_START = offsetof(NRF_COMP_Type, TASKS_START) , NRF_COMP_TASK_STOP = offsetof(NRF_COMP_Type, TASKS_STOP) , NRF_COMP_TASK_SAMPLE = offsetof(NRF_COMP_Type, TASKS_SAMPLE) } |
| COMP tasks. More... | |
| enum | nrf_comp_event_t { NRF_COMP_EVENT_READY = offsetof(NRF_COMP_Type, EVENTS_READY) , NRF_COMP_EVENT_DOWN = offsetof(NRF_COMP_Type, EVENTS_DOWN) , NRF_COMP_EVENT_UP = offsetof(NRF_COMP_Type, EVENTS_UP) , NRF_COMP_EVENT_CROSS = offsetof(NRF_COMP_Type, EVENTS_CROSS) } |
| COMP events. More... | |
| enum | nrf_comp_int_mask_t { NRF_COMP_INT_READY_MASK = COMP_INTENSET_READY_Msk , NRF_COMP_INT_DOWN_MASK = COMP_INTENSET_DOWN_Msk , NRF_COMP_INT_UP_MASK = COMP_INTENSET_UP_Msk , NRF_COMP_INT_CROSS_MASK = COMP_INTENSET_CROSS_Msk } |
| COMP interrupts. More... | |
| enum | nrf_comp_short_mask_t { NRF_COMP_SHORT_STOP_CROSS_MASK = COMP_SHORTS_CROSS_STOP_Msk , NRF_COMP_SHORT_STOP_UP_MASK = COMP_SHORTS_UP_STOP_Msk , NRF_COMP_SHORT_STOP_DOWN_MASK = COMP_SHORTS_DOWN_STOP_Msk } |
| COMP shortcut masks. More... | |
Functions | |
| NRF_STATIC_INLINE void | nrf_comp_enable (NRF_COMP_Type *p_reg) |
| Function for enabling the COMP peripheral. | |
| NRF_STATIC_INLINE void | nrf_comp_disable (NRF_COMP_Type *p_reg) |
| Function for disabling the COMP peripheral. | |
| NRF_STATIC_INLINE bool | nrf_comp_enable_check (NRF_COMP_Type const *p_reg) |
| Function for checking if the COMP peripheral is enabled. | |
| NRF_STATIC_INLINE void | nrf_comp_ref_set (NRF_COMP_Type *p_reg, nrf_comp_ref_t reference) |
| Function for setting the reference source. | |
| NRF_STATIC_INLINE void | nrf_comp_ext_ref_set (NRF_COMP_Type *p_reg, nrf_comp_ext_ref_t ext_ref) |
| Function for setting the external analog reference source. | |
| NRF_STATIC_INLINE void | nrf_comp_th_set (NRF_COMP_Type *p_reg, nrf_comp_th_t threshold) |
| Function for setting threshold voltages. | |
| NRF_STATIC_INLINE void | nrf_comp_main_mode_set (NRF_COMP_Type *p_reg, nrf_comp_main_mode_t main_mode) |
| Function for setting the main mode. | |
| NRF_STATIC_INLINE void | nrf_comp_speed_mode_set (NRF_COMP_Type *p_reg, nrf_comp_sp_mode_t speed_mode) |
| Function for setting the speed mode. | |
| NRF_STATIC_INLINE void | nrf_comp_hysteresis_set (NRF_COMP_Type *p_reg, nrf_comp_hyst_t hyst) |
| Function for setting the hysteresis. | |
| NRF_STATIC_INLINE void | nrf_comp_isource_set (NRF_COMP_Type *p_reg, nrf_comp_isource_t isource) |
| Function for setting the current source on the analog input. | |
| NRF_STATIC_INLINE void | nrf_comp_input_select (NRF_COMP_Type *p_reg, nrf_comp_input_t input) |
| Function for selecting the active input of the COMP. | |
| NRF_STATIC_INLINE uint32_t | nrf_comp_result_get (NRF_COMP_Type const *p_reg) |
| Function for getting the last COMP compare result. | |
| NRF_STATIC_INLINE void | nrf_comp_int_enable (NRF_COMP_Type *p_reg, uint32_t mask) |
| Function for enabling interrupts from COMP. | |
| NRF_STATIC_INLINE void | nrf_comp_int_disable (NRF_COMP_Type *p_reg, uint32_t mask) |
| Function for disabling interrupts from COMP. | |
| NRF_STATIC_INLINE uint32_t | nrf_comp_int_enable_check (NRF_COMP_Type const *p_reg, uint32_t mask) |
| Function for checking if the specified interrupts are enabled. | |
| NRF_STATIC_INLINE uint32_t | nrf_comp_task_address_get (NRF_COMP_Type const *p_reg, nrf_comp_task_t task) |
| Function for getting the address of the specified COMP task register. | |
| NRF_STATIC_INLINE uint32_t | nrf_comp_event_address_get (NRF_COMP_Type const *p_reg, nrf_comp_event_t event) |
| Function for getting the address of the specified COMP event register. | |
| NRF_STATIC_INLINE void | nrf_comp_shorts_enable (NRF_COMP_Type *p_reg, uint32_t mask) |
| Function for setting COMP shortcuts. | |
| NRF_STATIC_INLINE void | nrf_comp_shorts_disable (NRF_COMP_Type *p_reg, uint32_t mask) |
| Function for clearing COMP shortcuts by mask. | |
| NRF_STATIC_INLINE void | nrf_comp_task_trigger (NRF_COMP_Type *p_reg, nrf_comp_task_t task) |
| Function for setting the specified COMP task. | |
| NRF_STATIC_INLINE void | nrf_comp_event_clear (NRF_COMP_Type *p_reg, nrf_comp_event_t event) |
| Function for clearing the specified COMP event. | |
| NRF_STATIC_INLINE bool | nrf_comp_event_check (NRF_COMP_Type const *p_reg, nrf_comp_event_t event) |
| Function for retrieving the state of the COMP event. | |
| NRF_STATIC_INLINE void | nrf_comp_reftrim_set (NRF_COMP_Type *p_reg, uint32_t trim) |
| Function for setting COMP trimming value. | |
| NRF_STATIC_INLINE uint32_t | nrf_comp_reftrim_get (NRF_COMP_Type const *p_reg) |
| Function for getting COMP trimming value. | |
Hardware access layer (HAL) for managing the Comparator (COMP) peripheral.
| enum nrf_comp_event_t |
| enum nrf_comp_hyst_t |
COMP comparator hysteresis.
| enum nrf_comp_int_mask_t |
| enum nrf_comp_isource_t |
| enum nrf_comp_main_mode_t |
| enum nrf_comp_ref_t |
COMP reference selection.
| enum nrf_comp_sp_mode_t |
| enum nrf_comp_task_t |
| NRF_STATIC_INLINE void nrf_comp_disable | ( | NRF_COMP_Type * | p_reg | ) |
Function for disabling the COMP peripheral.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| NRF_STATIC_INLINE void nrf_comp_enable | ( | NRF_COMP_Type * | p_reg | ) |
Function for enabling the COMP peripheral.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| NRF_STATIC_INLINE bool nrf_comp_enable_check | ( | NRF_COMP_Type const * | p_reg | ) |
Function for checking if the COMP peripheral is enabled.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| true | The COMP peripheral is enabled. |
| false | The COMP peripheral is not enabled. |
| NRF_STATIC_INLINE uint32_t nrf_comp_event_address_get | ( | NRF_COMP_Type const * | p_reg, |
| nrf_comp_event_t | event ) |
Function for getting the address of the specified COMP event register.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| [in] | event | COMP event. |
| NRF_STATIC_INLINE bool nrf_comp_event_check | ( | NRF_COMP_Type const * | p_reg, |
| nrf_comp_event_t | event ) |
Function for retrieving the state of the COMP 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_comp_event_clear | ( | NRF_COMP_Type * | p_reg, |
| nrf_comp_event_t | event ) |
Function for clearing the specified COMP event.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| [in] | event | COMP event to be cleared. |
| NRF_STATIC_INLINE void nrf_comp_ext_ref_set | ( | NRF_COMP_Type * | p_reg, |
| nrf_comp_ext_ref_t | ext_ref ) |
Function for setting the external analog reference source.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| [in] | ext_ref | COMP external analog reference selection. |
| NRF_STATIC_INLINE void nrf_comp_hysteresis_set | ( | NRF_COMP_Type * | p_reg, |
| nrf_comp_hyst_t | hyst ) |
Function for setting the hysteresis.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| [in] | hyst | COMP comparator hysteresis. |
| NRF_STATIC_INLINE void nrf_comp_input_select | ( | NRF_COMP_Type * | p_reg, |
| nrf_comp_input_t | input ) |
Function for selecting the active input of the COMP.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| [in] | input | Input to be selected. |
| NRF_STATIC_INLINE void nrf_comp_int_disable | ( | NRF_COMP_Type * | p_reg, |
| uint32_t | mask ) |
Function for disabling interrupts from COMP.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| [in] | mask | Mask of interrupts to be disabled. Use nrf_comp_int_mask_t values for bit masking. |
| NRF_STATIC_INLINE void nrf_comp_int_enable | ( | NRF_COMP_Type * | p_reg, |
| uint32_t | mask ) |
Function for enabling interrupts from COMP.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| [in] | mask | Mask of interrupts to be enabled. Use nrf_comp_int_mask_t values for bit masking. |
| NRF_STATIC_INLINE uint32_t nrf_comp_int_enable_check | ( | NRF_COMP_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. Use nrf_comp_int_mask_t values for bit masking. |
| NRF_STATIC_INLINE void nrf_comp_isource_set | ( | NRF_COMP_Type * | p_reg, |
| nrf_comp_isource_t | isource ) |
Function for setting the current source on the analog input.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| [in] | isource | COMP current source selection on analog input. |
| NRF_STATIC_INLINE void nrf_comp_main_mode_set | ( | NRF_COMP_Type * | p_reg, |
| nrf_comp_main_mode_t | main_mode ) |
Function for setting the main mode.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| [in] | main_mode | COMP main operation mode. |
| NRF_STATIC_INLINE void nrf_comp_ref_set | ( | NRF_COMP_Type * | p_reg, |
| nrf_comp_ref_t | reference ) |
Function for setting the reference source.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| [in] | reference | COMP reference selection. |
| NRF_STATIC_INLINE uint32_t nrf_comp_reftrim_get | ( | NRF_COMP_Type const * | p_reg | ) |
Function for getting COMP trimming value.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| NRF_STATIC_INLINE void nrf_comp_reftrim_set | ( | NRF_COMP_Type * | p_reg, |
| uint32_t | trim ) |
Function for setting COMP trimming value.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| [in] | trim | Trimming value |
| NRF_STATIC_INLINE uint32_t nrf_comp_result_get | ( | NRF_COMP_Type const * | p_reg | ) |
Function for getting the last COMP compare result.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| NRF_STATIC_INLINE void nrf_comp_shorts_disable | ( | NRF_COMP_Type * | p_reg, |
| uint32_t | mask ) |
Function for clearing COMP shortcuts by mask.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| [in] | mask | Mask of shortcuts. |
| NRF_STATIC_INLINE void nrf_comp_shorts_enable | ( | NRF_COMP_Type * | p_reg, |
| uint32_t | mask ) |
Function for setting COMP shortcuts.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| [in] | mask | Mask of shortcuts. |
| NRF_STATIC_INLINE void nrf_comp_speed_mode_set | ( | NRF_COMP_Type * | p_reg, |
| nrf_comp_sp_mode_t | speed_mode ) |
Function for setting the speed mode.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| [in] | speed_mode | COMP speed and power mode. |
| NRF_STATIC_INLINE uint32_t nrf_comp_task_address_get | ( | NRF_COMP_Type const * | p_reg, |
| nrf_comp_task_t | task ) |
Function for getting the address of the specified COMP task register.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| [in] | task | COMP task. |
| NRF_STATIC_INLINE void nrf_comp_task_trigger | ( | NRF_COMP_Type * | p_reg, |
| nrf_comp_task_t | task ) |
Function for setting the specified COMP task.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| [in] | task | Task to be activated. |
| NRF_STATIC_INLINE void nrf_comp_th_set | ( | NRF_COMP_Type * | p_reg, |
| nrf_comp_th_t | threshold ) |
Function for setting threshold voltages.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| [in] | threshold | COMP VDOWN and VUP thresholds. |