SAADC HALY

group nrfy_saadc

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

Functions

NRFY_STATIC_INLINE void nrfy_saadc_periph_configure(NRF_SAADC_Type *p_reg, nrfy_saadc_config_t const *p_config)

Function for configuring the SAADC.

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

Function for initializing the specified SAADC 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_saadc_int_uninit(NRF_SAADC_Type *p_reg)

Function for uninitializing the SAADC interrupts.

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

NRFY_STATIC_INLINE uint32_t nrfy_saadc_events_process(NRF_SAADC_Type *p_reg, uint32_t mask, nrfy_saadc_buffer_t const *p_desc)

Function for processing the specified SAADC 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().

  • p_desc[in] Pointer to the structure containing buffer associated with the last sampling. Can be NULL.

Returns:

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

NRFY_STATIC_INLINE void nrfy_saadc_channel_configure(NRF_SAADC_Type *p_reg, uint8_t channel, nrf_saadc_channel_config_t const *p_config, nrfy_saadc_channel_input_t const *p_input)

Function for configuring the specified SAADC channel.

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

  • channel[in] Channel number.

  • p_config[in] Pointer to the channel configuration structure. NULL if configuration is to be omitted.

  • p_input[in] Pointer to the channel input configuration structure. NULL if configuration is to be omitted.

NRFY_STATIC_INLINE void nrfy_saadc_buffer_set(NRF_SAADC_Type *p_reg, nrfy_saadc_buffer_t const *p_desc, bool latch, bool wait)

Function for setting the SAADC sampling buffer.

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

  • p_desc[in] Pointer to the structure containing sampling buffer description.

  • latch[in] True if buffer is to be latched, false otherwise.

  • wait[in] True if latching is to be blocking, false otherwise.

NRFY_STATIC_INLINE void nrfy_saadc_buffer_latch(NRF_SAADC_Type *p_reg, bool wait)

Function for latching the SAADC sampling buffer.

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

  • wait[in] True if latching is to be blocking, false otherwise.

NRFY_STATIC_INLINE void nrfy_saadc_sample_start(NRF_SAADC_Type *p_reg, nrfy_saadc_buffer_t const *p_desc)

Function for starting the SAADC sampling.

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

  • p_desc[in] Pointer to the structure containing sampling buffer if the sampling is to be blocking. NULL for non-blocking operation.

NRFY_STATIC_INLINE void nrfy_saadc_abort(NRF_SAADC_Type *p_reg, nrfy_saadc_buffer_t const *p_desc)

Function for aborting the ongoing SAADC sampling.

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

  • p_desc[in] Pointer to the structure containing sampling buffer if the abort is to be blocking. NULL for non-blocking operation.

NRFY_STATIC_INLINE void nrfy_saadc_stop(NRF_SAADC_Type *p_reg, bool wait)

Function for stopping the SAADC.

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

  • wait[in] True if stopping is to be blocking, false otherwise.

NRFY_STATIC_INLINE void nrfy_saadc_calibrate(NRF_SAADC_Type *p_reg, bool wait)

Function for calibrating the SAADC.

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

  • wait[in] True if calibration is to be blocking, false otherwise.

NRFY_STATIC_INLINE void nrfy_saadc_task_trigger(NRF_SAADC_Type *p_reg, nrf_saadc_task_t task)

@refhal{nrf_saadc_task_trigger}

NRFY_STATIC_INLINE uint32_t nrfy_saadc_task_address_get(NRF_SAADC_Type const *p_reg, nrf_saadc_task_t task)

@refhal{nrf_saadc_task_address_get}

NRFY_STATIC_INLINE bool nrfy_saadc_event_check(NRF_SAADC_Type const *p_reg, nrf_saadc_event_t event)

@refhal{nrf_saadc_event_check}

NRFY_STATIC_INLINE void nrfy_saadc_event_clear(NRF_SAADC_Type *p_reg, nrf_saadc_event_t event)

@refhal{nrf_saadc_event_clear}

NRFY_STATIC_INLINE uint32_t nrfy_saadc_event_address_get(NRF_SAADC_Type const *p_reg, nrf_saadc_event_t event)

@refhal{nrf_saadc_event_address_get}

NRFY_STATIC_INLINE void nrfy_saadc_subscribe_set(NRF_SAADC_Type *p_reg, nrf_saadc_task_t task, uint8_t channel)

@refhal{nrf_saadc_subscribe_set}

NRFY_STATIC_INLINE void nrfy_saadc_subscribe_clear(NRF_SAADC_Type *p_reg, nrf_saadc_task_t task)

@refhal{nrf_saadc_subscribe_clear}

NRFY_STATIC_INLINE void nrfy_saadc_publish_set(NRF_SAADC_Type *p_reg, nrf_saadc_event_t event, uint8_t channel)

@refhal{nrf_saadc_publish_set}

NRFY_STATIC_INLINE void nrfy_saadc_publish_clear(NRF_SAADC_Type *p_reg, nrf_saadc_event_t event)

@refhal{nrf_saadc_publish_clear}

NRFY_STATIC_INLINE nrf_saadc_event_t nrfy_saadc_limit_event_get(uint8_t channel, nrf_saadc_limit_t limit_type)

@refhal{nrf_saadc_limit_event_get}

NRFY_STATIC_INLINE void nrfy_saadc_channel_input_set(NRF_SAADC_Type *p_reg, uint8_t channel, nrf_saadc_input_t pselp, nrf_saadc_input_t pseln)

@refhal{nrf_saadc_channel_input_set}

NRFY_STATIC_INLINE void nrfy_saadc_channel_pos_input_set(NRF_SAADC_Type *p_reg, uint8_t channel, nrf_saadc_input_t pselp)

@refhal{nrf_saadc_channel_pos_input_set}

NRFY_STATIC_INLINE void nrfy_saadc_channel_limits_set(NRF_SAADC_Type *p_reg, uint8_t channel, int16_t low, int16_t high)

@refhal{nrf_saadc_channel_limits_set}

NRFY_STATIC_INLINE void nrfy_saadc_int_set(NRF_SAADC_Type *p_reg, uint32_t mask)

@refhal{nrf_saadc_int_set}

NRFY_STATIC_INLINE void nrfy_saadc_int_enable(NRF_SAADC_Type *p_reg, uint32_t mask)

@refhal{nrf_saadc_int_enable}

NRFY_STATIC_INLINE uint32_t nrfy_saadc_int_enable_check(NRF_SAADC_Type const *p_reg, uint32_t mask)

@refhal{nrf_saadc_int_enable_check}

NRFY_STATIC_INLINE void nrfy_saadc_int_disable(NRF_SAADC_Type *p_reg, uint32_t mask)

@refhal{nrf_saadc_int_disable}

NRFY_STATIC_INLINE uint32_t nrfy_saadc_limit_int_get(uint8_t channel, nrf_saadc_limit_t limit_type)

@refhal{nrf_saadc_limit_int_get}

NRFY_STATIC_INLINE bool nrfy_saadc_busy_check(NRF_SAADC_Type const *p_reg)

@refhal{nrf_saadc_busy_check}

NRFY_STATIC_INLINE void nrfy_saadc_enable(NRF_SAADC_Type *p_reg)

@refhal{nrf_saadc_enable}

NRFY_STATIC_INLINE void nrfy_saadc_disable(NRF_SAADC_Type *p_reg)

@refhal{nrf_saadc_disable}

NRFY_STATIC_INLINE bool nrfy_saadc_enable_check(NRF_SAADC_Type const *p_reg)

@refhal{nrf_saadc_enable_check}

NRFY_STATIC_INLINE void nrfy_saadc_buffer_init(NRF_SAADC_Type *p_reg, nrf_saadc_value_t *p_buffer, uint32_t size)

@refhal{nrf_saadc_buffer_init}

NRFY_STATIC_INLINE void nrfy_saadc_buffer_pointer_set(NRF_SAADC_Type *p_reg, nrf_saadc_value_t *p_buffer)

@refhal{nrf_saadc_buffer_pointer_set}

NRFY_STATIC_INLINE nrf_saadc_value_t *nrfy_saadc_buffer_pointer_get(NRF_SAADC_Type const *p_reg)

@refhal{nrf_saadc_buffer_pointer_get}

NRFY_STATIC_INLINE uint16_t nrfy_saadc_amount_get(NRF_SAADC_Type const *p_reg)

@refhal{nrf_saadc_amount_get}

NRFY_STATIC_INLINE void nrfy_saadc_resolution_set(NRF_SAADC_Type *p_reg, nrf_saadc_resolution_t resolution)

@refhal{nrf_saadc_resolution_set}

NRFY_STATIC_INLINE nrf_saadc_resolution_t nrfy_saadc_resolution_get(NRF_SAADC_Type const *p_reg)

@refhal{nrf_saadc_resolution_get}

NRFY_STATIC_INLINE void nrfy_saadc_oversample_set(NRF_SAADC_Type *p_reg, nrf_saadc_oversample_t oversample)

@refhal{nrf_saadc_oversample_set}

NRFY_STATIC_INLINE nrf_saadc_oversample_t nrfy_saadc_oversample_get(NRF_SAADC_Type const *p_reg)

@refhal{nrf_saadc_oversample_get}

NRFY_STATIC_INLINE uint32_t nrfy_saadc_oversample_sample_count_get(nrf_saadc_oversample_t oversample)

@refhal{nrf_saadc_oversample_sample_count_get}

NRFY_STATIC_INLINE void nrfy_saadc_continuous_mode_enable(NRF_SAADC_Type *p_reg, uint16_t cc)

@refhal{nrf_saadc_continuous_mode_enable}

NRFY_STATIC_INLINE bool nrfy_saadc_continuous_mode_enable_check(NRF_SAADC_Type const *p_reg)

@refhal{nrf_saadc_continuous_mode_enable_check}

NRFY_STATIC_INLINE void nrfy_saadc_continuous_mode_disable(NRF_SAADC_Type *p_reg)

@refhal{nrf_saadc_continuous_mode_disable}

NRFY_STATIC_INLINE void nrfy_saadc_channel_init(NRF_SAADC_Type *p_reg, uint8_t channel, nrf_saadc_channel_config_t const *config)

@refhal{nrf_saadc_channel_init}

NRFY_STATIC_INLINE void nrfy_saadc_burst_set(NRF_SAADC_Type *p_reg, uint8_t channel, nrf_saadc_burst_t burst)

@refhal{nrf_saadc_burst_set}

NRFY_STATIC_INLINE nrf_saadc_value_t nrfy_saadc_value_min_get(nrf_saadc_resolution_t resolution)

@refhal{nrf_saadc_value_min_get}

NRFY_STATIC_INLINE nrf_saadc_value_t nrfy_saadc_value_max_get(nrf_saadc_resolution_t resolution)

@refhal{nrf_saadc_value_max_get}

struct nrfy_saadc_buffer_t
#include <nrfy_saadc.h>

Structure describing SAADC sampling buffer.

Public Members

nrf_saadc_value_t *p_buffer

Pointer to the sampling buffer.

size_t length

Sampling buffer length.

struct nrfy_saadc_config_t
#include <nrfy_saadc.h>

SAADC configuration structure.

Public Members

nrf_saadc_resolution_t resolution

Sampling resolution.

nrf_saadc_oversample_t oversampling

Oversampling setting.

struct nrfy_saadc_channel_input_t
#include <nrfy_saadc.h>

SAADC channel input configuration structure.

Public Members

nrf_saadc_input_t input_p

Positive input.

nrf_saadc_input_t input_n

Negative input.