| nRF5 SDK v12.0.0 |

Choose documentation: | nRF5 SDK | S130 SoftDevice API | S132 SoftDevice API | S212 SoftDevice API | S332 SoftDevice API

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions
SAADC HAL
SAADC HAL and driver

nRF52 only: Hardware access layer for accessing the SAADC peripheral. More...

## Data Structures
struct | nrf_saadc_config_t
| Analog-to-digital converter configuration structure. More...
struct | nrf_saadc_channel_config_t
| Analog-to-digital converter channel configuration structure. More...

## Macros
#define | NRF_SAADC_CHANNEL_COUNT 8

## Typedefs
typedef int16_t | nrf_saadc_value_t
| Type of a single ADC conversion result.

## Enumerations
enum | nrf_saadc_resolution_t { NRF_SAADC_RESOLUTION_8BIT = SAADC_RESOLUTION_VAL_8bit, NRF_SAADC_RESOLUTION_10BIT = SAADC_RESOLUTION_VAL_10bit, NRF_SAADC_RESOLUTION_12BIT = SAADC_RESOLUTION_VAL_12bit, NRF_SAADC_RESOLUTION_14BIT = SAADC_RESOLUTION_VAL_14bit }
| Resolution of the analog-to-digital converter. More...
enum | nrf_saadc_input_t { NRF_SAADC_INPUT_DISABLED = SAADC_CH_PSELP_PSELP_NC, NRF_SAADC_INPUT_AIN0 = SAADC_CH_PSELP_PSELP_AnalogInput0, NRF_SAADC_INPUT_AIN1 = SAADC_CH_PSELP_PSELP_AnalogInput1, NRF_SAADC_INPUT_AIN2 = SAADC_CH_PSELP_PSELP_AnalogInput2, NRF_SAADC_INPUT_AIN3 = SAADC_CH_PSELP_PSELP_AnalogInput3, NRF_SAADC_INPUT_AIN4 = SAADC_CH_PSELP_PSELP_AnalogInput4, NRF_SAADC_INPUT_AIN5 = SAADC_CH_PSELP_PSELP_AnalogInput5, NRF_SAADC_INPUT_AIN6 = SAADC_CH_PSELP_PSELP_AnalogInput6, NRF_SAADC_INPUT_AIN7 = SAADC_CH_PSELP_PSELP_AnalogInput7, NRF_SAADC_INPUT_VDD = SAADC_CH_PSELP_PSELP_VDD }
| Input selection for the analog-to-digital converter. More...
enum | nrf_saadc_oversample_t { NRF_SAADC_OVERSAMPLE_DISABLED = SAADC_OVERSAMPLE_OVERSAMPLE_Bypass, NRF_SAADC_OVERSAMPLE_2X = SAADC_OVERSAMPLE_OVERSAMPLE_Over2x, NRF_SAADC_OVERSAMPLE_4X = SAADC_OVERSAMPLE_OVERSAMPLE_Over4x, NRF_SAADC_OVERSAMPLE_8X = SAADC_OVERSAMPLE_OVERSAMPLE_Over8x, NRF_SAADC_OVERSAMPLE_16X = SAADC_OVERSAMPLE_OVERSAMPLE_Over16x, NRF_SAADC_OVERSAMPLE_32X = SAADC_OVERSAMPLE_OVERSAMPLE_Over32x, NRF_SAADC_OVERSAMPLE_64X = SAADC_OVERSAMPLE_OVERSAMPLE_Over64x, NRF_SAADC_OVERSAMPLE_128X = SAADC_OVERSAMPLE_OVERSAMPLE_Over128x, NRF_SAADC_OVERSAMPLE_256X = SAADC_OVERSAMPLE_OVERSAMPLE_Over256x }
| Analog-to-digital converter oversampling mode. More...
enum | nrf_saadc_resistor_t { NRF_SAADC_RESISTOR_DISABLED = SAADC_CH_CONFIG_RESP_Bypass, NRF_SAADC_RESISTOR_PULLDOWN = SAADC_CH_CONFIG_RESP_Pulldown, NRF_SAADC_RESISTOR_PULLUP = SAADC_CH_CONFIG_RESP_Pullup, NRF_SAADC_RESISTOR_VDD1_2 = SAADC_CH_CONFIG_RESP_VDD1_2 }
| Analog-to-digital converter channel resistor control. More...
enum | nrf_saadc_gain_t { NRF_SAADC_GAIN1_6 = SAADC_CH_CONFIG_GAIN_Gain1_6, NRF_SAADC_GAIN1_5 = SAADC_CH_CONFIG_GAIN_Gain1_5, NRF_SAADC_GAIN1_4 = SAADC_CH_CONFIG_GAIN_Gain1_4, NRF_SAADC_GAIN1_3 = SAADC_CH_CONFIG_GAIN_Gain1_3, NRF_SAADC_GAIN1_2 = SAADC_CH_CONFIG_GAIN_Gain1_2, NRF_SAADC_GAIN1 = SAADC_CH_CONFIG_GAIN_Gain1, NRF_SAADC_GAIN2 = SAADC_CH_CONFIG_GAIN_Gain2, NRF_SAADC_GAIN4 = SAADC_CH_CONFIG_GAIN_Gain4 }
| Gain factor of the analog-to-digital converter input. More...
enum | nrf_saadc_reference_t { NRF_SAADC_REFERENCE_INTERNAL = SAADC_CH_CONFIG_REFSEL_Internal, NRF_SAADC_REFERENCE_VDD4 = SAADC_CH_CONFIG_REFSEL_VDD1_4 }
| Reference selection for the analog-to-digital converter. More...
enum | nrf_saadc_acqtime_t { NRF_SAADC_ACQTIME_3US = SAADC_CH_CONFIG_TACQ_3us, NRF_SAADC_ACQTIME_5US = SAADC_CH_CONFIG_TACQ_5us, NRF_SAADC_ACQTIME_10US = SAADC_CH_CONFIG_TACQ_10us, NRF_SAADC_ACQTIME_15US = SAADC_CH_CONFIG_TACQ_15us, NRF_SAADC_ACQTIME_20US = SAADC_CH_CONFIG_TACQ_20us, NRF_SAADC_ACQTIME_40US = SAADC_CH_CONFIG_TACQ_40us }
| Analog-to-digital converter acquisition time. More...
enum | nrf_saadc_mode_t { NRF_SAADC_MODE_SINGLE_ENDED = SAADC_CH_CONFIG_MODE_SE, NRF_SAADC_MODE_DIFFERENTIAL = SAADC_CH_CONFIG_MODE_Diff }
| Analog-to-digital converter channel mode. More...
enum | nrf_saadc_burst_t { NRF_SAADC_BURST_DISABLED = SAADC_CH_CONFIG_BURST_Disabled, NRF_SAADC_BURST_ENABLED = SAADC_CH_CONFIG_BURST_Enabled }
| Analog-to-digital converter channel burst mode. More...
enum | nrf_saadc_task_t { NRF_SAADC_TASK_START = offsetof(NRF_SAADC_Type, TASKS_START), NRF_SAADC_TASK_SAMPLE = offsetof(NRF_SAADC_Type, TASKS_SAMPLE), NRF_SAADC_TASK_STOP = offsetof(NRF_SAADC_Type, TASKS_STOP), NRF_SAADC_TASK_CALIBRATEOFFSET = offsetof(NRF_SAADC_Type, TASKS_CALIBRATEOFFSET) }
| Analog-to-digital converter tasks. More...
enum | nrf_saadc_event_t { NRF_SAADC_EVENT_STARTED = offsetof(NRF_SAADC_Type, EVENTS_STARTED), NRF_SAADC_EVENT_END = offsetof(NRF_SAADC_Type, EVENTS_END), NRF_SAADC_EVENT_DONE = offsetof(NRF_SAADC_Type, EVENTS_DONE), NRF_SAADC_EVENT_RESULTDONE = offsetof(NRF_SAADC_Type, EVENTS_RESULTDONE), NRF_SAADC_EVENT_CALIBRATEDONE = offsetof(NRF_SAADC_Type, EVENTS_CALIBRATEDONE), NRF_SAADC_EVENT_STOPPED = offsetof(NRF_SAADC_Type, EVENTS_STOPPED), NRF_SAADC_EVENT_CH0_LIMITH = offsetof(NRF_SAADC_Type, EVENTS_CH[0].LIMITH), NRF_SAADC_EVENT_CH0_LIMITL = offsetof(NRF_SAADC_Type, EVENTS_CH[0].LIMITL), NRF_SAADC_EVENT_CH1_LIMITH = offsetof(NRF_SAADC_Type, EVENTS_CH[1].LIMITH), NRF_SAADC_EVENT_CH1_LIMITL = offsetof(NRF_SAADC_Type, EVENTS_CH[1].LIMITL), NRF_SAADC_EVENT_CH2_LIMITH = offsetof(NRF_SAADC_Type, EVENTS_CH[2].LIMITH), NRF_SAADC_EVENT_CH2_LIMITL = offsetof(NRF_SAADC_Type, EVENTS_CH[2].LIMITL), NRF_SAADC_EVENT_CH3_LIMITH = offsetof(NRF_SAADC_Type, EVENTS_CH[3].LIMITH), NRF_SAADC_EVENT_CH3_LIMITL = offsetof(NRF_SAADC_Type, EVENTS_CH[3].LIMITL), NRF_SAADC_EVENT_CH4_LIMITH = offsetof(NRF_SAADC_Type, EVENTS_CH[4].LIMITH), NRF_SAADC_EVENT_CH4_LIMITL = offsetof(NRF_SAADC_Type, EVENTS_CH[4].LIMITL), NRF_SAADC_EVENT_CH5_LIMITH = offsetof(NRF_SAADC_Type, EVENTS_CH[5].LIMITH), NRF_SAADC_EVENT_CH5_LIMITL = offsetof(NRF_SAADC_Type, EVENTS_CH[5].LIMITL), NRF_SAADC_EVENT_CH6_LIMITH = offsetof(NRF_SAADC_Type, EVENTS_CH[6].LIMITH), NRF_SAADC_EVENT_CH6_LIMITL = offsetof(NRF_SAADC_Type, EVENTS_CH[6].LIMITL), NRF_SAADC_EVENT_CH7_LIMITH = offsetof(NRF_SAADC_Type, EVENTS_CH[7].LIMITH), NRF_SAADC_EVENT_CH7_LIMITL = offsetof(NRF_SAADC_Type, EVENTS_CH[7].LIMITL) }
| Analog-to-digital converter events. More...
enum | nrf_saadc_int_mask_t { NRF_SAADC_INT_STARTED = SAADC_INTENSET_STARTED_Msk, NRF_SAADC_INT_END = SAADC_INTENSET_END_Msk, NRF_SAADC_INT_DONE = SAADC_INTENSET_DONE_Msk, NRF_SAADC_INT_RESULTDONE = SAADC_INTENSET_RESULTDONE_Msk, NRF_SAADC_INT_CALIBRATEDONE = SAADC_INTENSET_CALIBRATEDONE_Msk, NRF_SAADC_INT_STOPPED = SAADC_INTENSET_STOPPED_Msk, NRF_SAADC_INT_CH0LIMITH = SAADC_INTENSET_CH0LIMITH_Msk, NRF_SAADC_INT_CH0LIMITL = SAADC_INTENSET_CH0LIMITL_Msk, NRF_SAADC_INT_CH1LIMITH = SAADC_INTENSET_CH1LIMITH_Msk, NRF_SAADC_INT_CH1LIMITL = SAADC_INTENSET_CH1LIMITL_Msk, NRF_SAADC_INT_CH2LIMITH = SAADC_INTENSET_CH2LIMITH_Msk, NRF_SAADC_INT_CH2LIMITL = SAADC_INTENSET_CH2LIMITL_Msk, NRF_SAADC_INT_CH3LIMITH = SAADC_INTENSET_CH3LIMITH_Msk, NRF_SAADC_INT_CH3LIMITL = SAADC_INTENSET_CH3LIMITL_Msk, NRF_SAADC_INT_CH4LIMITH = SAADC_INTENSET_CH4LIMITH_Msk, NRF_SAADC_INT_CH4LIMITL = SAADC_INTENSET_CH4LIMITL_Msk, NRF_SAADC_INT_CH5LIMITH = SAADC_INTENSET_CH5LIMITH_Msk, NRF_SAADC_INT_CH5LIMITL = SAADC_INTENSET_CH5LIMITL_Msk, NRF_SAADC_INT_CH6LIMITH = SAADC_INTENSET_CH6LIMITH_Msk, NRF_SAADC_INT_CH6LIMITL = SAADC_INTENSET_CH6LIMITL_Msk, NRF_SAADC_INT_CH7LIMITH = SAADC_INTENSET_CH7LIMITH_Msk, NRF_SAADC_INT_CH7LIMITL = SAADC_INTENSET_CH7LIMITL_Msk, NRF_SAADC_INT_ALL = 0x7FFFFFFFUL }
| Analog-to-digital converter interrupt masks. More...
enum | nrf_saadc_limit_t { NRF_SAADC_LIMIT_LOW = 0, NRF_SAADC_LIMIT_HIGH = 1 }
| Analog-to-digital converter value limit type.

## Functions
__STATIC_INLINE void | nrf_saadc_task_trigger (nrf_saadc_task_t saadc_task)
| Function for triggering a specific SAADC task. More...
__STATIC_INLINE uint32_t | nrf_saadc_task_address_get (nrf_saadc_task_t saadc_task)
| Function for getting the address of a specific SAADC task register. More...
__STATIC_INLINE bool | nrf_saadc_event_check (nrf_saadc_event_t saadc_event)
| Function for getting the state of a specific SAADC event. More...
__STATIC_INLINE void | nrf_saadc_event_clear (nrf_saadc_event_t saadc_event)
| Function for clearing the specific SAADC event. More...
__STATIC_INLINE uint32_t | nrf_saadc_event_address_get (nrf_saadc_event_t saadc_event)
| Function for getting the address of a specific SAADC event register. More...
__STATIC_INLINE volatile uint32_t * | nrf_saadc_event_limit_address_get (uint8_t channel, nrf_saadc_limit_t limit_type)
| Function for getting the address of a specific SAADC limit event register. More...
__STATIC_INLINE nrf_saadc_event_t | nrf_saadc_event_limit_get (uint8_t channel, nrf_saadc_limit_t limit_type)
| Function for getting the SAADC channel monitoring limit events. More...
__STATIC_INLINE void | nrf_saadc_channel_input_set (uint8_t channel, nrf_saadc_input_t pselp, nrf_saadc_input_t pseln)
| Function for configuring the input pins for a specific SAADC channel. More...
__STATIC_INLINE void | nrf_saadc_channel_limits_set (uint8_t channel, int16_t low, int16_t high)
| Function for setting the SAADC channel monitoring limits. More...
__STATIC_INLINE void | nrf_saadc_int_enable (uint32_t saadc_int_mask)
| Function for enabling specified SAADC interrupts. More...
__STATIC_INLINE bool | nrf_saadc_int_enable_check (uint32_t saadc_int_mask)
| Function for retrieving the state of specified SAADC interrupts. More...
__STATIC_INLINE void | nrf_saadc_int_disable (uint32_t saadc_int_mask)
| Function for disabling specified interrupts. More...
__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. More...
__STATIC_INLINE bool | nrf_saadc_busy_check (void)
| Function for checking whether the SAADC is busy. More...
__STATIC_INLINE void | nrf_saadc_enable (void)
| Function for enabling the SAADC. More...
__STATIC_INLINE void | nrf_saadc_disable (void)
| Function for disabling the SAADC.
__STATIC_INLINE bool | nrf_saadc_enable_check (void)
| Function for checking if the SAADC is enabled. More...
__STATIC_INLINE void | nrf_saadc_buffer_init (nrf_saadc_value_t *buffer, uint32_t num)
| Function for initializing the SAADC result buffer. More...
__STATIC_INLINE uint16_t | nrf_saadc_amount_get (void)
| Function for getting the number of buffer words transferred since last START operation. More...
__STATIC_INLINE void | nrf_saadc_resolution_set (nrf_saadc_resolution_t resolution)
| Function for setting the SAADC sample resolution. More...
__STATIC_INLINE void | nrf_saadc_oversample_set (nrf_saadc_oversample_t oversample)
| Function for configuring the oversampling feature. More...
__STATIC_INLINE nrf_saadc_oversample_t | nrf_saadc_oversample_get (void)
| Function for getting the oversampling feature configuration. More...
void | nrf_saadc_channel_init (uint8_t channel, nrf_saadc_channel_config_t const *const config)
| Function for initializing the SAADC channel. More...

## Detailed Description

nRF52 only: Hardware access layer for accessing the SAADC peripheral.

## Enumeration Type Documentation

enum nrf_saadc_acqtime_t

Analog-to-digital converter acquisition time.

Enumerator
NRF_SAADC_ACQTIME_3US | 3 us.
NRF_SAADC_ACQTIME_5US | 5 us.
NRF_SAADC_ACQTIME_10US | 10 us.
NRF_SAADC_ACQTIME_15US | 15 us.
NRF_SAADC_ACQTIME_20US | 20 us.
NRF_SAADC_ACQTIME_40US | 40 us.

enum nrf_saadc_burst_t

Analog-to-digital converter channel burst mode.

Enumerator
NRF_SAADC_BURST_DISABLED | Burst mode is disabled (normal operation).
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_event_t

Analog-to-digital converter events.

Enumerator
NRF_SAADC_EVENT_STARTED | The ADC has started.
NRF_SAADC_EVENT_END | The ADC has filled up the result buffer.
NRF_SAADC_EVENT_DONE | A conversion task has been completed.
NRF_SAADC_EVENT_RESULTDONE | A result is ready to get transferred to RAM.
NRF_SAADC_EVENT_CALIBRATEDONE | Calibration is complete.
NRF_SAADC_EVENT_STOPPED | The ADC has stopped.
NRF_SAADC_EVENT_CH0_LIMITH | Last result is equal or above CH[0].LIMIT.HIGH.
NRF_SAADC_EVENT_CH0_LIMITL | Last result is equal or below CH[0].LIMIT.LOW.
NRF_SAADC_EVENT_CH1_LIMITH | Last result is equal or above CH[1].LIMIT.HIGH.
NRF_SAADC_EVENT_CH1_LIMITL | Last result is equal or below CH[1].LIMIT.LOW.
NRF_SAADC_EVENT_CH2_LIMITH | Last result is equal or above CH[2].LIMIT.HIGH.
NRF_SAADC_EVENT_CH2_LIMITL | Last result is equal or below CH[2].LIMIT.LOW.
NRF_SAADC_EVENT_CH3_LIMITH | Last result is equal or above CH[3].LIMIT.HIGH.
NRF_SAADC_EVENT_CH3_LIMITL | Last result is equal or below CH[3].LIMIT.LOW.
NRF_SAADC_EVENT_CH4_LIMITH | Last result is equal or above CH[4].LIMIT.HIGH.
NRF_SAADC_EVENT_CH4_LIMITL | Last result is equal or below CH[4].LIMIT.LOW.
NRF_SAADC_EVENT_CH5_LIMITH | Last result is equal or above CH[5].LIMIT.HIGH.
NRF_SAADC_EVENT_CH5_LIMITL | Last result is equal or below CH[5].LIMIT.LOW.
NRF_SAADC_EVENT_CH6_LIMITH | Last result is equal or above CH[6].LIMIT.HIGH.
NRF_SAADC_EVENT_CH6_LIMITL | Last result is equal or below CH[6].LIMIT.LOW.
NRF_SAADC_EVENT_CH7_LIMITH | Last result is equal or above CH[7].LIMIT.HIGH.
NRF_SAADC_EVENT_CH7_LIMITL | Last result is equal or below CH[7].LIMIT.LOW.

enum nrf_saadc_gain_t

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

Enumerator
NRF_SAADC_GAIN1_6 | Gain factor 1/6.
NRF_SAADC_GAIN1_5 | Gain factor 1/5.
NRF_SAADC_GAIN1_4 | Gain factor 1/4.
NRF_SAADC_GAIN1_3 | Gain factor 1/3.
NRF_SAADC_GAIN1_2 | Gain factor 1/2.
NRF_SAADC_GAIN1 | Gain factor 1.
NRF_SAADC_GAIN2 | Gain factor 2.
NRF_SAADC_GAIN4 | Gain factor 4.

enum nrf_saadc_input_t

Input selection for the analog-to-digital converter.

Enumerator
NRF_SAADC_INPUT_DISABLED | Not connected.
NRF_SAADC_INPUT_AIN0 | Analog input 0 (AIN0).
NRF_SAADC_INPUT_AIN1 | Analog input 1 (AIN1).
NRF_SAADC_INPUT_AIN2 | Analog input 2 (AIN2).
NRF_SAADC_INPUT_AIN3 | Analog input 3 (AIN3).
NRF_SAADC_INPUT_AIN4 | Analog input 4 (AIN4).
NRF_SAADC_INPUT_AIN5 | Analog input 5 (AIN5).
NRF_SAADC_INPUT_AIN6 | Analog input 6 (AIN6).
NRF_SAADC_INPUT_AIN7 | Analog input 7 (AIN7).
NRF_SAADC_INPUT_VDD | VDD as input.

enum nrf_saadc_int_mask_t

Analog-to-digital converter interrupt masks.

Enumerator
NRF_SAADC_INT_STARTED | Interrupt on EVENTS_STARTED event.
NRF_SAADC_INT_END | Interrupt on EVENTS_END event.
NRF_SAADC_INT_DONE | Interrupt on EVENTS_DONE event.
NRF_SAADC_INT_RESULTDONE | Interrupt on EVENTS_RESULTDONE event.
NRF_SAADC_INT_CALIBRATEDONE | Interrupt on EVENTS_CALIBRATEDONE event.
NRF_SAADC_INT_STOPPED | Interrupt on EVENTS_STOPPED event.
NRF_SAADC_INT_CH0LIMITH | Interrupt on EVENTS_CH[0].LIMITH event.
NRF_SAADC_INT_CH0LIMITL | Interrupt on EVENTS_CH[0].LIMITL event.
NRF_SAADC_INT_CH1LIMITH | Interrupt on EVENTS_CH[1].LIMITH event.
NRF_SAADC_INT_CH1LIMITL | Interrupt on EVENTS_CH[1].LIMITL event.
NRF_SAADC_INT_CH2LIMITH | Interrupt on EVENTS_CH[2].LIMITH event.
NRF_SAADC_INT_CH2LIMITL | Interrupt on EVENTS_CH[2].LIMITL event.
NRF_SAADC_INT_CH3LIMITH | Interrupt on EVENTS_CH[3].LIMITH event.
NRF_SAADC_INT_CH3LIMITL | Interrupt on EVENTS_CH[3].LIMITL event.
NRF_SAADC_INT_CH4LIMITH | Interrupt on EVENTS_CH[4].LIMITH event.
NRF_SAADC_INT_CH4LIMITL | Interrupt on EVENTS_CH[4].LIMITL event.
NRF_SAADC_INT_CH5LIMITH | Interrupt on EVENTS_CH[5].LIMITH event.
NRF_SAADC_INT_CH5LIMITL | Interrupt on EVENTS_CH[5].LIMITL event.
NRF_SAADC_INT_CH6LIMITH | Interrupt on EVENTS_CH[6].LIMITH event.
NRF_SAADC_INT_CH6LIMITL | Interrupt on EVENTS_CH[6].LIMITL event.
NRF_SAADC_INT_CH7LIMITH | Interrupt on EVENTS_CH[7].LIMITH event.
NRF_SAADC_INT_CH7LIMITL | Interrupt on EVENTS_CH[7].LIMITL event.
NRF_SAADC_INT_ALL | Mask of all interrupts.

enum nrf_saadc_mode_t

Analog-to-digital converter channel mode.

Enumerator
NRF_SAADC_MODE_SINGLE_ENDED | Single ended, PSELN will be ignored, negative input to ADC shorted to GND.
NRF_SAADC_MODE_DIFFERENTIAL | Differential mode.

enum nrf_saadc_oversample_t

Analog-to-digital converter oversampling mode.

Enumerator
NRF_SAADC_OVERSAMPLE_DISABLED | No oversampling.
NRF_SAADC_OVERSAMPLE_2X | Oversample 2x.
NRF_SAADC_OVERSAMPLE_4X | Oversample 4x.
NRF_SAADC_OVERSAMPLE_8X | Oversample 8x.
NRF_SAADC_OVERSAMPLE_16X | Oversample 16x.
NRF_SAADC_OVERSAMPLE_32X | Oversample 32x.
NRF_SAADC_OVERSAMPLE_64X | Oversample 64x.
NRF_SAADC_OVERSAMPLE_128X | Oversample 128x.
NRF_SAADC_OVERSAMPLE_256X | Oversample 256x.

enum nrf_saadc_reference_t

Reference selection for the analog-to-digital converter.

Enumerator
NRF_SAADC_REFERENCE_INTERNAL | Internal reference (0.6 V).
NRF_SAADC_REFERENCE_VDD4 | VDD/4 as reference.

enum nrf_saadc_resistor_t

Analog-to-digital converter channel resistor control.

Enumerator
NRF_SAADC_RESISTOR_DISABLED | Bypass resistor ladder.
NRF_SAADC_RESISTOR_PULLDOWN | Pull-down to GND.
NRF_SAADC_RESISTOR_PULLUP | Pull-up to VDD.
NRF_SAADC_RESISTOR_VDD1_2 | Set input at VDD/2.

enum nrf_saadc_resolution_t

Resolution of the analog-to-digital converter.

Enumerator
NRF_SAADC_RESOLUTION_8BIT | 8 bit resolution.
NRF_SAADC_RESOLUTION_10BIT | 10 bit resolution.
NRF_SAADC_RESOLUTION_12BIT | 12 bit resolution.
NRF_SAADC_RESOLUTION_14BIT | 14 bit resolution.

enum nrf_saadc_task_t

Analog-to-digital converter tasks.

Enumerator
NRF_SAADC_TASK_START | Start the ADC and prepare the result buffer in RAM.
NRF_SAADC_TASK_SAMPLE | Take one ADC sample. If scan is enabled, all channels are sampled.
NRF_SAADC_TASK_STOP | Stop the ADC and terminate any on-going conversion.
NRF_SAADC_TASK_CALIBRATEOFFSET | Starts offset auto-calibration.

## Function Documentation

__STATIC_INLINE uint16_t nrf_saadc_amount_get | ( | void |  | ) |

Function for getting the number of buffer words transferred since last START operation.

Returns
  Number of words transferred.

__STATIC_INLINE void nrf_saadc_buffer_init | ( | nrf_saadc_value_t * | buffer,
|  | uint32_t | num
| ) |  |

Function for initializing the SAADC result buffer.

Parameters

  [in] | buffer | Pointer to the result buffer.
  [in] | num | Size of buffer in words.

__STATIC_INLINE bool nrf_saadc_busy_check | ( | void |  | ) |

Function for checking whether the SAADC is busy.

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

Return values

  true | If the SAADC is busy.
  false | If the SAADC is not busy.

void nrf_saadc_channel_init | ( | uint8_t | channel,
|  | nrf_saadc_channel_config_t const *const | config
| ) |  |

Function for initializing the SAADC channel.

Parameters

  [in] | channel | Channel number.
  [in] | config | Pointer to the channel configuration structure.

__STATIC_INLINE void nrf_saadc_channel_input_set | ( | uint8_t | channel,
|  | nrf_saadc_input_t | pselp,
|  | nrf_saadc_input_t | pseln
| ) |  |

Function for configuring the input pins for a specific SAADC channel.

Parameters

  [in] | channel | Channel number.
  [in] | pselp | Positive input.
  [in] | pseln | Negative input. Set to NRF_SAADC_INPUT_DISABLED in single ended mode.

__STATIC_INLINE void nrf_saadc_channel_limits_set | ( | uint8_t | channel,
|  | int16_t | low,
|  | int16_t | high
| ) |  |

Function for setting the SAADC channel monitoring limits.

Parameters

  [in] | channel | Channel number.
  [in] | low | Low limit.
  [in] | high | High limit.

__STATIC_INLINE void nrf_saadc_enable | ( | void |  | ) |

Function for enabling the SAADC.

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

__STATIC_INLINE bool nrf_saadc_enable_check | ( | void |  | ) |

Function for checking if the SAADC is enabled.

Return values

  true | If the SAADC is enabled.
  false | If the SAADC is not enabled.

__STATIC_INLINE uint32_t nrf_saadc_event_address_get | ( | nrf_saadc_event_t | saadc_event | ) |

Function for getting the address of a specific SAADC event register.

Parameters

  [in] | saadc_event | SAADC event.

Returns
  Address of the specified SAADC event.

__STATIC_INLINE bool nrf_saadc_event_check | ( | nrf_saadc_event_t | saadc_event | ) |

Function for getting the state of a specific SAADC event.

Parameters

  [in] | saadc_event | SAADC event.

Returns
  State of the specified SAADC event.

__STATIC_INLINE void nrf_saadc_event_clear | ( | nrf_saadc_event_t | saadc_event | ) |

Function for clearing the specific SAADC event.

Parameters

  [in] | saadc_event | SAADC event.

__STATIC_INLINE volatile uint32_t* nrf_saadc_event_limit_address_get | ( | uint8_t | channel,
|  | nrf_saadc_limit_t | limit_type
| ) |  |

Function for getting the address of a specific SAADC limit event register.

Parameters

  [in] | channel | Channel number.
  [in] | limit_type | Low limit or high limit.

Returns
  Address of the specified SAADC limit event.

__STATIC_INLINE nrf_saadc_event_t nrf_saadc_event_limit_get | ( | uint8_t | channel,
|  | nrf_saadc_limit_t | limit_type
| ) |  |

Function for getting the SAADC channel monitoring limit events.

Parameters

  [in] | channel | Channel number.
  [in] | limit_type | Low limit or high limit.

__STATIC_INLINE void nrf_saadc_int_disable | ( | uint32_t | saadc_int_mask | ) |

Function for disabling specified interrupts.

Parameters

  saadc_int_mask | Interrupt(s) to disable.

__STATIC_INLINE void nrf_saadc_int_enable | ( | uint32_t | saadc_int_mask | ) |

Function for enabling specified SAADC interrupts.

Parameters

  [in] | saadc_int_mask | Interrupt(s) to enable.

__STATIC_INLINE bool nrf_saadc_int_enable_check | ( | uint32_t | saadc_int_mask | ) |

Function for retrieving the state of specified SAADC interrupts.

Parameters

  [in] | saadc_int_mask | Interrupt(s) to check.

Return values

  true | If all specified interrupts are enabled.
  false | If at least one of the given interrupts is not enabled.

__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

  [in] | channel | SAADC channel number.
  [in] | limit_type | Limit type.

Returns
  Interrupt mask.

__STATIC_INLINE nrf_saadc_oversample_t nrf_saadc_oversample_get | ( | void |  | ) |

Function for getting the oversampling feature configuration.

Returns
  Oversampling configuration.

__STATIC_INLINE void nrf_saadc_oversample_set | ( | nrf_saadc_oversample_t | oversample | ) |

Function for configuring the oversampling feature.

Parameters

  [in] | oversample | Oversampling mode.

__STATIC_INLINE void nrf_saadc_resolution_set | ( | nrf_saadc_resolution_t | resolution | ) |

Function for setting the SAADC sample resolution.

Parameters

  [in] | resolution | Bit resolution.

__STATIC_INLINE uint32_t nrf_saadc_task_address_get | ( | nrf_saadc_task_t | saadc_task | ) |

Function for getting the address of a specific SAADC task register.

Parameters

  [in] | saadc_task | SAADC task.

Returns
  Address of the specified SAADC task.

__STATIC_INLINE void nrf_saadc_task_trigger | ( | nrf_saadc_task_t | saadc_task | ) |

Function for triggering a specific SAADC task.

Parameters

  [in] | saadc_task | SAADC task.