SAADC HAL

group nrf_saadc_hal

Hardware access layer for managing the SAADC peripheral.

Defines

NRF_SAADC_LIMITS_INT_OFFSET

Symbol specifying the offset of interrupt bitmask for limits of all channels.

NRF_SAADC_ALL_CHANNELS_LIMITS_INT_MASK

Symbol specifying the interrupt bitmask for limits of all channels.

NRF_SAADC_HAS_ACQTIME_ENUM

Symbol indicating whether the configuration of acquisition time using predefined values is present.

NRF_SAADC_HAS_CONVTIME

Symbol indicating whether the configuration of conversion time is present.

NRF_SAADC_HAS_LIN_CAL

Symbol indicating whether the configuration of linearity calibration coefficients is present.

NRF_SAADC_HAS_AIN_AS_PIN

Symbol indicating whether configuration of analog input using pin number is present.

NRF_SAADC_HAS_DMA_REG

Symbol indicating whether dedicated DMA register is present.

NRF_SAADC_HAS_DMA_EVENTS

Symbol indicating whether SAADC DMA events are present.

NRF_SAADC_HAS_CH_CONFIG_RES

Symbol indicating whether SAADC channel resistor control is present.

NRF_SAADC_CONVTIME_MAX

Symbol specifying maximum value of conversion time.

NRF_SAADC_LIN_CAL_MAX_COUNT

Symbol specifying maximum count of linearity calibration coefficients.

NRF_SAADC_LIN_CAL_MAX

Symbol specifying maximum value of linearity calibration coefficient.

NRF_SAADC_8BIT_SAMPLE_WIDTH

Symbol specifying width of the 8-bit sample in bits.

NRF_SAADC_INPUT_DISABLED

Symbol specifying disconnected analog input.

Typedefs

typedef uint32_t nrf_saadc_input_t

Analog input type.

typedef void nrf_saadc_value_t

Type of a single ADC conversion result.

Enums

enum nrf_saadc_resolution_t

Resolution of the analog-to-digital converter.

Values:

enumerator NRF_SAADC_RESOLUTION_8BIT

8 bit resolution.

enumerator NRF_SAADC_RESOLUTION_10BIT

10 bit resolution.

enumerator NRF_SAADC_RESOLUTION_12BIT

12 bit resolution.

enumerator NRF_SAADC_RESOLUTION_14BIT

14 bit resolution.

enum nrf_saadc_oversample_t

Analog-to-digital converter oversampling mode.

Values:

enumerator NRF_SAADC_OVERSAMPLE_DISABLED

No oversampling.

enumerator NRF_SAADC_OVERSAMPLE_2X

Oversample 2x.

enumerator NRF_SAADC_OVERSAMPLE_4X

Oversample 4x.

enumerator NRF_SAADC_OVERSAMPLE_8X

Oversample 8x.

enumerator NRF_SAADC_OVERSAMPLE_16X

Oversample 16x.

enumerator NRF_SAADC_OVERSAMPLE_32X

Oversample 32x.

enumerator NRF_SAADC_OVERSAMPLE_64X

Oversample 64x.

enumerator NRF_SAADC_OVERSAMPLE_128X

Oversample 128x.

enumerator NRF_SAADC_OVERSAMPLE_256X

Oversample 256x.

enum nrf_saadc_resistor_t

Analog-to-digital converter channel resistor control.

Values:

enumerator NRF_SAADC_RESISTOR_DISABLED

Bypass resistor ladder.

enumerator NRF_SAADC_RESISTOR_PULLDOWN

Pull-down to GND.

enumerator NRF_SAADC_RESISTOR_PULLUP

Pull-up to VDD.

enumerator NRF_SAADC_RESISTOR_VDD1_2

Set input at VDD/2.

enum nrf_saadc_gain_t

Gain factor of the analog-to-digital converter input.

Values:

enumerator NRF_SAADC_GAIN1_6

Gain factor 1/6.

enumerator NRF_SAADC_GAIN1_5

Gain factor 1/5.

enumerator NRF_SAADC_GAIN1_4

Gain factor 1/4.

enumerator NRF_SAADC_GAIN2_7

Gain factor 2/7.

enumerator NRF_SAADC_GAIN1_3

Gain factor 1/3.

enumerator NRF_SAADC_GAIN2_5

Gain factor 2/5.

enumerator NRF_SAADC_GAIN1_2

Gain factor 1/2.

enumerator NRF_SAADC_GAIN2_3

Gain factor 2/3.

enumerator NRF_SAADC_GAIN1

Gain factor 1.

enumerator NRF_SAADC_GAIN2

Gain factor 2.

enumerator NRF_SAADC_GAIN4

Gain factor 4.

enum nrf_saadc_reference_t

Reference selection for the analog-to-digital converter.

Values:

enumerator NRF_SAADC_REFERENCE_INTERNAL

Internal reference.

enumerator NRF_SAADC_REFERENCE_VDD4

VDD/4 as reference.

External reference.

enum nrf_saadc_acqtime_t

Analog-to-digital converter acquisition time.

Values:

enumerator NRF_SAADC_ACQTIME_3US

3 us.

enumerator NRF_SAADC_ACQTIME_5US

5 us.

enumerator NRF_SAADC_ACQTIME_10US

10 us.

enumerator NRF_SAADC_ACQTIME_15US

15 us.

enumerator NRF_SAADC_ACQTIME_20US

20 us.

enumerator NRF_SAADC_ACQTIME_40US

40 us.

enum nrf_saadc_mode_t

Analog-to-digital converter channel mode.

Values:

enumerator NRF_SAADC_MODE_SINGLE_ENDED

Single-ended mode. PSELN will be ignored, negative input to ADC shorted to GND.

enumerator NRF_SAADC_MODE_DIFFERENTIAL

Differential mode.

enum nrf_saadc_burst_t

Analog-to-digital converter channel burst mode.

Values:

enumerator NRF_SAADC_BURST_DISABLED

Burst mode is disabled (normal operation).

enumerator NRF_SAADC_BURST_ENABLED

Burst mode is enabled. SAADC takes 2^OVERSAMPLE number of samples as fast as it can, and sends the average to Data RAM.

enum nrf_saadc_task_t

Analog-to-digital converter tasks.

Values:

enumerator NRF_SAADC_TASK_START

Start the ADC and prepare the result buffer in RAM.

enumerator NRF_SAADC_TASK_STOP

Stop the ADC and terminate any ongoing conversion.

enumerator NRF_SAADC_TASK_SAMPLE

Take one ADC sample. If scan is enabled, all channels are sampled.

enumerator NRF_SAADC_TASK_CALIBRATEOFFSET

Starts offset auto-calibration.

enum nrf_saadc_event_t

Analog-to-digital converter events.

Values:

enumerator NRF_SAADC_EVENT_STARTED

The ADC has started.

enumerator NRF_SAADC_EVENT_END

The ADC has filled up the result buffer.

enumerator NRF_SAADC_EVENT_DONE

A conversion task has been completed.

enumerator NRF_SAADC_EVENT_RESULTDONE

A result is ready to get transferred to RAM.

enumerator NRF_SAADC_EVENT_CALIBRATEDONE

Calibration is complete.

enumerator NRF_SAADC_EVENT_STOPPED

The ADC has stopped.

enumerator NRF_SAADC_EVENT_CH0_LIMITH

Last result is equal or above CH[0].LIMIT.HIGH.

enumerator NRF_SAADC_EVENT_CH0_LIMITL

Last result is equal or below CH[0].LIMIT.LOW.

enumerator NRF_SAADC_EVENT_CH1_LIMITH

Last result is equal or above CH[1].LIMIT.HIGH.

enumerator NRF_SAADC_EVENT_CH1_LIMITL

Last result is equal or below CH[1].LIMIT.LOW.

enumerator NRF_SAADC_EVENT_CH2_LIMITH

Last result is equal or above CH[2].LIMIT.HIGH.

enumerator NRF_SAADC_EVENT_CH2_LIMITL

Last result is equal or below CH[2].LIMIT.LOW.

enumerator NRF_SAADC_EVENT_CH3_LIMITH

Last result is equal or above CH[3].LIMIT.HIGH.

enumerator NRF_SAADC_EVENT_CH3_LIMITL

Last result is equal or below CH[3].LIMIT.LOW.

enumerator NRF_SAADC_EVENT_CH4_LIMITH

Last result is equal or above CH[4].LIMIT.HIGH.

enumerator NRF_SAADC_EVENT_CH4_LIMITL

Last result is equal or below CH[4].LIMIT.LOW.

enumerator NRF_SAADC_EVENT_CH5_LIMITH

Last result is equal or above CH[5].LIMIT.HIGH.

enumerator NRF_SAADC_EVENT_CH5_LIMITL

Last result is equal or below CH[5].LIMIT.LOW.

enumerator NRF_SAADC_EVENT_CH6_LIMITH

Last result is equal or above CH[6].LIMIT.HIGH.

enumerator NRF_SAADC_EVENT_CH6_LIMITL

Last result is equal or below CH[6].LIMIT.LOW.

enumerator NRF_SAADC_EVENT_CH7_LIMITH

Last result is equal or above CH[7].LIMIT.HIGH.

enumerator NRF_SAADC_EVENT_CH7_LIMITL

Last result is equal or below CH[7].LIMIT.LOW.

enum nrf_saadc_int_mask_t

Analog-to-digital converter interrupt masks.

Values:

enumerator NRF_SAADC_INT_STARTED

Interrupt on EVENTS_STARTED event.

enumerator NRF_SAADC_INT_END

Interrupt on EVENTS_END event.

enumerator NRF_SAADC_INT_DONE

Interrupt on EVENTS_DONE event.

enumerator NRF_SAADC_INT_RESULTDONE

Interrupt on EVENTS_RESULTDONE event.

enumerator NRF_SAADC_INT_CALIBRATEDONE

Interrupt on EVENTS_CALIBRATEDONE event.

enumerator NRF_SAADC_INT_STOPPED

Interrupt on EVENTS_STOPPED event.

enumerator NRF_SAADC_INT_CH0LIMITH

Interrupt on EVENTS_CH[0].LIMITH event.

enumerator NRF_SAADC_INT_CH0LIMITL

Interrupt on EVENTS_CH[0].LIMITL event.

enumerator NRF_SAADC_INT_CH1LIMITH

Interrupt on EVENTS_CH[1].LIMITH event.

enumerator NRF_SAADC_INT_CH1LIMITL

Interrupt on EVENTS_CH[1].LIMITL event.

enumerator NRF_SAADC_INT_CH2LIMITH

Interrupt on EVENTS_CH[2].LIMITH event.

enumerator NRF_SAADC_INT_CH2LIMITL

Interrupt on EVENTS_CH[2].LIMITL event.

enumerator NRF_SAADC_INT_CH3LIMITH

Interrupt on EVENTS_CH[3].LIMITH event.

enumerator NRF_SAADC_INT_CH3LIMITL

Interrupt on EVENTS_CH[3].LIMITL event.

enumerator NRF_SAADC_INT_CH4LIMITH

Interrupt on EVENTS_CH[4].LIMITH event.

enumerator NRF_SAADC_INT_CH4LIMITL

Interrupt on EVENTS_CH[4].LIMITL event.

enumerator NRF_SAADC_INT_CH5LIMITH

Interrupt on EVENTS_CH[5].LIMITH event.

enumerator NRF_SAADC_INT_CH5LIMITL

Interrupt on EVENTS_CH[5].LIMITL event.

enumerator NRF_SAADC_INT_CH6LIMITH

Interrupt on EVENTS_CH[6].LIMITH event.

enumerator NRF_SAADC_INT_CH6LIMITL

Interrupt on EVENTS_CH[6].LIMITL event.

enumerator NRF_SAADC_INT_CH7LIMITH

Interrupt on EVENTS_CH[7].LIMITH event.

enumerator NRF_SAADC_INT_CH7LIMITL

Interrupt on EVENTS_CH[7].LIMITL event.

enumerator NRF_SAADC_INT_ALL

Mask of all interrupts.

enum nrf_saadc_limit_t

Analog-to-digital converter value limit type.

Values:

enumerator NRF_SAADC_LIMIT_LOW

Low limit type.

enumerator NRF_SAADC_LIMIT_HIGH

High limit type.

Functions

NRF_STATIC_INLINE void nrf_saadc_task_trigger(NRF_SAADC_Type *p_reg, nrf_saadc_task_t task)

Function for triggering the specified SAADC task.

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

  • task[in] SAADC task.

NRF_STATIC_INLINE uint32_t nrf_saadc_task_address_get(NRF_SAADC_Type const *p_reg, nrf_saadc_task_t task)

Function for getting the address of the specified SAADC task register.

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

  • task[in] SAADC task.

Returns:

Address of the specified SAADC task.

NRF_STATIC_INLINE bool nrf_saadc_event_check(NRF_SAADC_Type const *p_reg, nrf_saadc_event_t event)

Function for retrieving the state of the SAADC 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.

NRF_STATIC_INLINE void nrf_saadc_event_clear(NRF_SAADC_Type *p_reg, nrf_saadc_event_t event)

Function for clearing the specific SAADC event.

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

  • event[in] SAADC event.

NRF_STATIC_INLINE uint32_t nrf_saadc_event_address_get(NRF_SAADC_Type const *p_reg, nrf_saadc_event_t event)

Function for getting the address of the specified SAADC event register.

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

  • event[in] SAADC event.

Returns:

Address of the specified SAADC event.

NRF_STATIC_INLINE void nrf_saadc_subscribe_set(NRF_SAADC_Type *p_reg, nrf_saadc_task_t task, uint8_t channel)

Function for setting the subscribe configuration for a given SAADC task.

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

  • task[in] Task for which to set the configuration.

  • channel[in] Channel through which to subscribe events.

NRF_STATIC_INLINE void nrf_saadc_subscribe_clear(NRF_SAADC_Type *p_reg, nrf_saadc_task_t task)

Function for clearing the subscribe configuration for a given SAADC task.

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

  • task[in] Task for which to clear the configuration.

NRF_STATIC_INLINE void nrf_saadc_publish_set(NRF_SAADC_Type *p_reg, nrf_saadc_event_t event, uint8_t channel)

Function for setting the publish configuration for a given SAADC event.

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

  • event[in] Event for which to set the configuration.

  • channel[in] Channel through which to publish the event.

NRF_STATIC_INLINE void nrf_saadc_publish_clear(NRF_SAADC_Type *p_reg, nrf_saadc_event_t event)

Function for clearing the publish configuration for a given SAADC event.

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

  • event[in] Event for which to clear the configuration.

NRF_STATIC_INLINE nrf_saadc_event_t nrf_saadc_limit_event_get(uint8_t channel, nrf_saadc_limit_t limit_type)

Function for getting the SAADC channel monitoring limit events.

Parameters:
  • channel[in] Channel number.

  • limit_type[in] Low limit or high limit.

Returns:

The SAADC channel monitoring limit event.

NRF_STATIC_INLINE void nrf_saadc_channel_input_set(NRF_SAADC_Type *p_reg, uint8_t channel, nrf_saadc_input_t pselp, nrf_saadc_input_t pseln)

Function for configuring the input pins for the specified SAADC channel.

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

  • channel[in] Channel number.

  • pselp[in] Positive input.

  • pseln[in] Negative input. Set to NRF_SAADC_INPUT_DISABLED in single ended mode.

NRF_STATIC_INLINE void nrf_saadc_channel_pos_input_set(NRF_SAADC_Type *p_reg, uint8_t channel, nrf_saadc_input_t pselp)

Function for configuring the positive input pin for the specified SAADC channel.

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

  • channel[in] Channel number.

  • pselp[in] Positive input.

NRF_STATIC_INLINE void nrf_saadc_channel_limits_set(NRF_SAADC_Type *p_reg, uint8_t channel, int16_t low, int16_t high)

Function for setting the SAADC channel monitoring limits.

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

  • channel[in] Channel number.

  • low[in] Low limit.

  • high[in] High limit.

NRF_STATIC_INLINE void nrf_saadc_int_set(NRF_SAADC_Type *p_reg, uint32_t mask)

Function for setting the configuration of SAADC interrupts.

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

  • mask[in] Interrupts configuration to be set. Use nrf_saadc_int_mask_t values for bit masking.

NRF_STATIC_INLINE void nrf_saadc_int_enable(NRF_SAADC_Type *p_reg, uint32_t mask)

Function for enabling specified SAADC interrupts.

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

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

NRF_STATIC_INLINE uint32_t nrf_saadc_int_enable_check(NRF_SAADC_Type const *p_reg, uint32_t mask)

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_saadc_int_mask_t values for bit masking.

Returns:

Mask of enabled interrupts.

NRF_STATIC_INLINE void nrf_saadc_int_disable(NRF_SAADC_Type *p_reg, uint32_t mask)

Function for disabling specified interrupts.

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

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

NRF_STATIC_INLINE uint32_t nrf_saadc_limit_int_get(uint8_t channel, nrf_saadc_limit_t limit_type)

Function for generating masks for SAADC channel limit interrupts.

Parameters:
  • channel[in] SAADC channel number.

  • limit_type[in] Limit type.

Returns:

Interrupt mask.

NRF_STATIC_INLINE bool nrf_saadc_busy_check(NRF_SAADC_Type const *p_reg)

Function for checking whether the SAADC is busy.

This function checks whether the analog-to-digital converter is busy with a conversion.

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

Return values:
  • true – The SAADC is busy.

  • false – The SAADC is not busy.

NRF_STATIC_INLINE void nrf_saadc_enable(NRF_SAADC_Type *p_reg)

Function for enabling the SAADC.

The analog-to-digital converter must be enabled before use.

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

NRF_STATIC_INLINE void nrf_saadc_disable(NRF_SAADC_Type *p_reg)

Function for disabling the SAADC.

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

NRF_STATIC_INLINE bool nrf_saadc_enable_check(NRF_SAADC_Type const *p_reg)

Function for checking if the SAADC is enabled.

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

Return values:
  • true – The SAADC is enabled.

  • false – The SAADC is not enabled.

NRF_STATIC_INLINE void nrf_saadc_buffer_init(NRF_SAADC_Type *p_reg, nrf_saadc_value_t *p_buffer, uint32_t size)

Function for initializing the SAADC result buffer.

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

  • p_buffer[in] Pointer to the result buffer.

  • size[in] Size of the buffer (in 8-bit or 16-bit samples).

NRF_STATIC_INLINE void nrf_saadc_buffer_pointer_set(NRF_SAADC_Type *p_reg, nrf_saadc_value_t *p_buffer)

Function for setting the SAADC result buffer pointer.

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

  • p_buffer[in] Pointer to the result buffer.

NRF_STATIC_INLINE nrf_saadc_value_t *nrf_saadc_buffer_pointer_get(NRF_SAADC_Type const *p_reg)

Function for getting the SAADC result buffer pointer.

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

Returns:

Pointer to the result buffer.

NRF_STATIC_INLINE uint16_t nrf_saadc_amount_get(NRF_SAADC_Type const *p_reg)

Function for getting the number of samples written to the result buffer since the previous START task.

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

Returns:

Number of 8-bit or 16-bit samples written to the buffer.

NRF_STATIC_INLINE void nrf_saadc_resolution_set(NRF_SAADC_Type *p_reg, nrf_saadc_resolution_t resolution)

Function for setting the SAADC sample resolution.

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

  • resolution[in] Bit resolution.

NRF_STATIC_INLINE nrf_saadc_resolution_t nrf_saadc_resolution_get(NRF_SAADC_Type const *p_reg)

Function for getting the SAADC sample resolution.

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

Returns:

Sample resolution.

NRF_STATIC_INLINE void nrf_saadc_oversample_set(NRF_SAADC_Type *p_reg, nrf_saadc_oversample_t oversample)

Function for configuring the oversampling feature.

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

  • oversample[in] Oversampling mode.

NRF_STATIC_INLINE nrf_saadc_oversample_t nrf_saadc_oversample_get(NRF_SAADC_Type const *p_reg)

Function for getting the oversampling feature configuration.

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

Returns:

Oversampling configuration.

NRF_STATIC_INLINE uint32_t nrf_saadc_oversample_sample_count_get(nrf_saadc_oversample_t oversample)

Function for getting the sample count needed for one averaged result for a given oversampling configuration.

Parameters:
  • oversample[in] Oversampling configuration.

Returns:

Sample count.

NRF_STATIC_INLINE void nrf_saadc_continuous_mode_enable(NRF_SAADC_Type *p_reg, uint16_t cc)

Function for enabling the continuous sampling.

This function configures the SAADC internal timer to automatically take new samples at a fixed sample rate. Trigger the START task to begin continuous sampling. To stop the sampling, trigger the STOP task.

Note

The internal timer can only be used when a single input channel is enabled.

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

  • cc[in] Capture and compare value. Sample rate is 16 MHz/cc. Valid CC range is from 80 to 2047.

NRF_STATIC_INLINE bool nrf_saadc_continuous_mode_enable_check(NRF_SAADC_Type const *p_reg)

Function for checking if the continuous sampling is enabled.

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

Return values:
  • true – The continuous sampling is enabled.

  • false – The continuous sampling is disabled.

NRF_STATIC_INLINE void nrf_saadc_continuous_mode_disable(NRF_SAADC_Type *p_reg)

Function for disabling the continuous sampling.

New samples can still be acquired by manually triggering the SAMPLE task or by PPI.

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

NRF_STATIC_INLINE void nrf_saadc_linearity_calibration_coeff_set(NRF_SAADC_Type *p_reg, uint8_t index, uint32_t coeff)

Function for setting linearity calibration coefficient.

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

  • index[in] Coefficient number.

  • coeff[in] Value of the coefficient.

NRF_STATIC_INLINE uint32_t nrf_saadc_linearity_calibration_coeff_get(NRF_SAADC_Type const *p_reg, uint8_t index)

Function for getting linearity calibration coefficient.

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

  • index[in] Coefficient number.

Returns:

Value of the coefficient.

NRF_STATIC_INLINE void nrf_saadc_channel_init(NRF_SAADC_Type *p_reg, uint8_t channel, nrf_saadc_channel_config_t const *config)

Function for initializing the SAADC channel.

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

  • channel[in] Channel number.

  • config[in] Pointer to the channel configuration structure.

NRF_STATIC_INLINE void nrf_saadc_burst_set(NRF_SAADC_Type *p_reg, uint8_t channel, nrf_saadc_burst_t burst)

Function for configuring the burst mode for the specified channel.

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

  • channel[in] Channel number.

  • burst[in] Burst mode setting.

NRF_STATIC_INLINE int16_t nrf_saadc_value_min_get(nrf_saadc_resolution_t resolution)

Function for getting the minimum value of the conversion result.

The minimum value of the conversion result depends on the configured resolution.

Parameters:
  • resolution[in] Bit resolution.

Returns:

Minimum value of the conversion result.

NRF_STATIC_INLINE int16_t nrf_saadc_value_max_get(nrf_saadc_resolution_t resolution)

Function for getting the maximum value of the conversion result.

The maximum value of the conversion result depends on the configured resolution.

Parameters:
  • resolution[in] Bit resolution.

Returns:

Maximum value of the conversion result.

struct nrf_saadc_config_t
#include <nrf_saadc.h>

Analog-to-digital converter configuration structure.

Public Members

nrf_saadc_resolution_t resolution

Resolution of samples.

nrf_saadc_oversample_t oversample

Oversampling configuration.

nrf_saadc_value_t *buffer

Pointer to sample buffer.

uint32_t buffer_size

Size of the sample buffer.

struct nrf_saadc_channel_config_t
#include <nrf_saadc.h>

Analog-to-digital converter channel configuration structure.

Public Members

nrf_saadc_resistor_t resistor_p

Resistor value on positive input.

nrf_saadc_resistor_t resistor_n

Resistor value on negative input.

nrf_saadc_gain_t gain

Gain control value.

nrf_saadc_reference_t reference

Reference control value.

nrf_saadc_acqtime_t acq_time

Acquisition time.

nrf_saadc_mode_t mode

SAADC mode. Single-ended or differential.

nrf_saadc_burst_t burst

Burst mode configuration.

uint8_t conv_time

Conversion time.