nrfx 4.5.0
Loading...
Searching...
No Matches
SAADC HAL

Hardware access layer for managing 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_LIMITS_INT_OFFSET    NRFX_MIN(SAADC_INTENSET_CH0LIMITH_Pos, SAADC_INTENSET_CH0LIMITL_Pos)
 Symbol specifying the offset of interrupt bitmask for limits of all channels.
 
#define NRF_SAADC_LIMITS_PER_CHANNEL   (2)
 Symbol specifying number of LIMIT events per channel.
 
#define NRF_SAADC_ALL_CHANNELS_LIMITS_INT_MASK
 Symbol specifying the interrupt bitmask for limits of all channels.
 
#define NRF_SAADC_HAS_ACQTIME_ENUM   1
 Symbol indicating whether the configuration of acquisition time using predefined values is present.
 
#define NRF_SAADC_HAS_SHORTS   1
 Symbol indicating whether SHORTS register is present.
 
#define NRF_SAADC_HAS_CONVTIME   1
 Symbol indicating whether the configuration of conversion time is present.
 
#define NRF_SAADC_HAS_LIN_CAL   1
 Symbol indicating whether the configuration of linearity calibration coefficients is present.
 
#define NRF_SAADC_HAS_CAL   1
 Symbol indicating whether SAADC CAL trim config is present.
 
#define NRF_SAADC_HAS_CALREF   1
 Symbol indicating whether SAADC CALREF trim is present.
 
#define NRF_SAADC_HAS_AIN_AS_PIN   1
 Symbol indicating whether configuration of analog input using pin number is present.
 
#define NRF_SAADC_HAS_CH_CONFIG_RES   1
 Symbol indicating whether SAADC channel resistor control is present.
 
#define NRF_SAADC_HAS_CH_PSELP_TEST   1
 Symbol indicating whether SAADC positive test inputs for pin number configurations are present.
 
#define NRF_SAADC_HAS_CH_PSELP_INTERNAL   1
 Symbol indicating whether SAADC positive internal inputs for pin number configurations are present.
 
#define NRF_SAADC_HAS_CH_PSELN_INTERNAL   1
 Symbol indicating whether SAADC negative internal inputs for pin number configurations are present.
 
#define NRF_SAADC_HAS_CH_BURST   1
 Symbol indicating whether SAADC channel specific burst mode configuration is present.
 
#define NRF_SAADC_HAS_BURST   1
 Symbol indicating whether SAADC peripheral burst mode configuration is present.
 
#define NRF_SAADC_HAS_CH_CHOPPING   1
 Symbol indicating whether SAADC channel specific chopping mode configuration is present.
 
#define NRF_SAADC_HAS_INPUT_VDDHDIV5   1
 Symbol indicating whether VDDH/5 can be selected as SAADC input.
 
#define NRF_SAADC_HAS_INPUT_VDD   1
 Symbol indicating whether VDD can be selected as SAADC input.
 
#define NRF_SAADC_HAS_INPUT_AVSS   1
 Symbol indicating whether AVSS can be selected as SAADC input.
 
#define NRF_SAADC_HAS_CH_GAIN   1
 Symbol indicating whether SAADC channel specific gain configuration is present.
 
#define NRF_SAADC_HAS_CH_HIGHSPEED   1
 Symbol indicating whether SAADC channel specific highspeed mode configuration is present.
 
#define NRF_SAADC_HAS_GAIN_1_6   1
 Symbol indicating whether SAADC channel specific gain can be configured to 1/6.
 
#define NRF_SAADC_HAS_GAIN_1_5   1
 Symbol indicating whether SAADC channel specific gain can be configured to 1/5.
 
#define NRF_SAADC_HAS_GAIN_1_4   1
 Symbol indicating whether SAADC channel specific gain can be configured to 1/4.
 
#define NRF_SAADC_HAS_GAIN_2_7   1
 Symbol indicating whether SAADC channel specific gain can be configured to 2/7.
 
#define NRF_SAADC_HAS_GAIN_1_3   1
 Symbol indicating whether SAADC channel specific gain can be configured to 1/3.
 
#define NRF_SAADC_HAS_GAIN_2_5   1
 Symbol indicating whether SAADC channel specific gain can be configured to 2/5.
 
#define NRF_SAADC_HAS_GAIN_1_2   1
 Symbol indicating whether SAADC channel specific gain can be configured to 1/2.
 
#define NRF_SAADC_HAS_GAIN_2_3   1
 Symbol indicating whether SAADC channel specific gain can be configured to 2/3.
 
#define NRF_SAADC_HAS_GAIN_4   1
 Symbol indicating whether SAADC channel specific gain can be configured to 4.
 
#define NRF_SAADC_HAS_REFERENCE_INTERNAL   1
 Symbol indicating whether SAADC channels can be configured to use an internal reference.
 
#define NRF_SAADC_HAS_REFERENCE_VDD4   1
 Symbol indicating whether SAADC channels can be configured to use VDD/4 as a reference.
 
#define NRF_SAADC_HAS_REFERENCE_EXTERNAL   1
 Symbol indicating whether SAADC channels can be configured to use an external reference.
 
#define NRF_SAADC_HAS_REFERENCE_VDD   1
 Symbol indicating whether SAADC channels can be configured to use VDD as a reference.
 
#define NRF_SAADC_HAS_INTERNAL_TIMER_SCAN   1
 Symbol indicating whether SAADC internal timer can be used with scan mode.
 
#define NRF_SAADC_ACQTIME_MAX   SAADC_CH_CONFIG_TACQ_Max
 Maximum value of acquire time.
 
#define NRF_SAADC_CONVTIME_MAX   SAADC_CH_CONFIG_TCONV_Max
 Symbol specifying maximum value of conversion time.
 
#define NRF_SAADC_LIN_CAL_MAX_COUNT   SAADC_TRIM_LINCALCOEFF_MaxCount
 Symbol specifying maximum count of linearity calibration coefficients.
 
#define NRF_SAADC_LIN_CAL_MAX   SAADC_TRIM_LINCALCOEFF_VAL_Max
 Symbol specifying maximum value of linearity calibration coefficient.
 
#define NRF_SAADC_SAMPLERATE_CC_MIN   SAADC_SAMPLERATE_CC_Min
 Symbol specifying minimum capture and compare value for sample rate.
 
#define NRF_SAADC_SAMPLERATE_CC_MAX   SAADC_SAMPLERATE_CC_Max
 Symbol specifying maximum capture and compare value for sample rate.
 
#define NRF_SAADC_INPUT_AVSS   ((SAADC_CH_PSELP_TEST_AVSS + 1) << SAADC_CH_PSELP_TEST_Pos)
 Symbol specifying AVSS as input.
 
#define NRF_SAADC_INPUT_AVDD   ((SAADC_CH_PSELP_INTERNAL_Avdd + 1) << SAADC_CH_PSELP_INTERNAL_Pos)
 Symbol specifying internal 0.9 V analog supply rail as input.
 
#define NRF_SAADC_INPUT_DVDD   ((SAADC_CH_PSELP_INTERNAL_Dvdd + 1) << SAADC_CH_PSELP_INTERNAL_Pos)
 Symbol specifying internal 0.9 V digital supply rail as input.
 
#define NRF_SAADC_INPUT_VDD   ((SAADC_CH_PSELP_INTERNAL_Vdd + 1) << SAADC_CH_PSELP_INTERNAL_Pos)
 Symbol specifying VDD as input.
 
#define NRF_SAADC_INPUT_VDDAO1V8
 Symbol specifying AVDD_AO_1V8 as input.
 
#define NRF_SAADC_INPUT_VDDL   ((SAADC_CH_PSELP_INTERNAL_VddL + 1) << SAADC_CH_PSELP_INTERNAL_Pos)
 Symbol specifying AVDD_AO_1V5 as input.
 
#define NRF_SAADC_INPUT_DECB   ((SAADC_CH_PSELP_INTERNAL_Decb + 1) << SAADC_CH_PSELP_INTERNAL_Pos)
 Symbol specifying DECB as input.
 
#define NRF_SAADC_INPUT_VSS   ((SAADC_CH_PSELP_INTERNAL_Vss + 1) << SAADC_CH_PSELP_INTERNAL_Pos)
 Symbol specifying VSS as input.
 
#define NRF_SAADC_INPUT_VDDAO0V8
 Symbol specifying VDD_AO_0V8 as input.
 
#define NRF_SAADC_INPUT_VDDRF   ((SAADC_CH_PSELP_INTERNAL_VDDRF + 1) << SAADC_CH_PSELP_INTERNAL_Pos)
 Symbol specifying VDDRF as input.
 
#define NRF_SAADC_INPUT_VBAT   ((SAADC_CH_PSELP_INTERNAL_VBAT + 1) << SAADC_CH_PSELP_INTERNAL_Pos)
 Symbol specifying VBat as input.
 
#define NRF_SAADC_INPUT_INTERNAL0
 Symbol specifying Internal0 as input.
 
#define NRF_SAADC_INPUT_INTERNAL1
 Symbol specifying Internal1 as input.
 
#define NRF_SAADC_INPUT_INTERNAL2
 Symbol specifying Internal2 as input.
 
#define NRF_SAADC_INPUT_INTERNAL3
 Symbol specifying Internal3 as input.
 
#define NRF_SAADC_INPUT_DISABLED   ((nrf_saadc_input_t)UINT32_MAX)
 Symbol specifying disconnected analog input.
 

Typedefs

typedef uint32_t nrf_saadc_input_t
 Analog input type.
 
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_short_mask_t {
  NRF_SAADC_SHORT_DONE_SAMPLE_MASK = SAADC_SHORTS_DONE_SAMPLE_Msk ,
  NRF_SAADC_SHORT_END_START_MASK = SAADC_SHORTS_END_START_Msk
}
 SAADC shorts. 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_GAIN2_7 = SAADC_CH_CONFIG_GAIN_Gain2_7 ,
  NRF_SAADC_GAIN1_3 = SAADC_CH_CONFIG_GAIN_Gain1_3 ,
  NRF_SAADC_GAIN2_5 = SAADC_CH_CONFIG_GAIN_Gain2_5 ,
  NRF_SAADC_GAIN1_2 = SAADC_CH_CONFIG_GAIN_Gain1_2 ,
  NRF_SAADC_GAIN2_3 = SAADC_CH_CONFIG_GAIN_Gain2_3 ,
  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 ,
  NRF_SAADC_REFERENCE_EXTERNAL = SAADC_CH_CONFIG_REFSEL_External ,
  NRF_SAADC_REFERENCE_VDD = SAADC_CH_CONFIG_REFSEL_Vdd
}
 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 burst mode. More...
 
enum  nrf_saadc_chopping_t {
  NRF_SAADC_CHOPPING_DISABLED = SAADC_CH_CONFIG_CHOPPING_Disabled ,
  NRF_SAADC_CHOPPING_ENABLED = SAADC_CH_CONFIG_CHOPPING_Enabled
}
 Analog-to-digital converter chopping mode. More...
 
enum  nrf_saadc_highspeed_t {
  NRF_SAADC_HIGHSPEED_DISABLED = SAADC_CH_CONFIG_HIGHSPEED_Disabled ,
  NRF_SAADC_HIGHSPEED_ENABLED = SAADC_CH_CONFIG_HIGHSPEED_Enabled
}
 Analog-to-digital converter highspeed mode. More...
 
enum  nrf_saadc_task_t {
  NRF_SAADC_TASK_START = offsetof(NRF_SAADC_Type, TASKS_START) ,
  NRF_SAADC_TASK_STOP = offsetof(NRF_SAADC_Type, TASKS_STOP) ,
  NRF_SAADC_TASK_SAMPLE = offsetof(NRF_SAADC_Type, TASKS_SAMPLE) ,
  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. More...
 

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.
 
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.
 
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.
 
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.
 
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.
 
NRF_STATIC_INLINE void nrf_saadc_shorts_enable (NRF_SAADC_Type *p_reg, uint32_t mask)
 Function for enabling the specified shortcuts.
 
NRF_STATIC_INLINE void nrf_saadc_shorts_disable (NRF_SAADC_Type *p_reg, uint32_t mask)
 Function for disabling the specified shortcuts.
 
NRF_STATIC_INLINE uint32_t nrf_saadc_shorts_get (NRF_SAADC_Type const *p_reg)
 Function for getting the shortcut setting.
 
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.
 
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.
 
NRF_STATIC_INLINE uint32_t nrf_saadc_subscribe_get (NRF_SAADC_Type const *p_reg, nrf_saadc_task_t task)
 Function for getting the subscribe configuration for a given SAADC task.
 
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.
 
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.
 
NRF_STATIC_INLINE uint32_t nrf_saadc_publish_get (NRF_SAADC_Type const *p_reg, nrf_saadc_event_t event)
 Function for getting the publish configuration for a given SAADC event.
 
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.
 
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.
 
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.
 
NRF_STATIC_INLINE void nrf_saadc_channel_neg_input_set (NRF_SAADC_Type *p_reg, uint8_t channel, nrf_saadc_input_t pseln)
 Function for configuring the negative input pin for the specified SAADC channel.
 
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.
 
NRF_STATIC_INLINE void nrf_saadc_int_set (NRF_SAADC_Type *p_reg, uint32_t mask)
 Function for setting the configuration of SAADC interrupts.
 
NRF_STATIC_INLINE void nrf_saadc_int_enable (NRF_SAADC_Type *p_reg, uint32_t mask)
 Function for enabling specified SAADC interrupts.
 
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.
 
NRF_STATIC_INLINE void nrf_saadc_int_disable (NRF_SAADC_Type *p_reg, uint32_t mask)
 Function for disabling specified interrupts.
 
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.
 
NRF_STATIC_INLINE bool nrf_saadc_busy_check (NRF_SAADC_Type const *p_reg)
 Function for checking whether the SAADC is busy.
 
NRF_STATIC_INLINE void nrf_saadc_enable (NRF_SAADC_Type *p_reg)
 Function for enabling the SAADC.
 
NRF_STATIC_INLINE void nrf_saadc_disable (NRF_SAADC_Type *p_reg)
 Function for disabling the SAADC.
 
NRF_STATIC_INLINE bool nrf_saadc_enable_check (NRF_SAADC_Type const *p_reg)
 Function for checking if the SAADC is 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.
 
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.
 
NRF_STATIC_INLINE nrf_saadc_value_tnrf_saadc_buffer_pointer_get (NRF_SAADC_Type const *p_reg)
 Function for getting the SAADC result buffer pointer.
 
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.
 
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.
 
NRF_STATIC_INLINE nrf_saadc_resolution_t nrf_saadc_resolution_get (NRF_SAADC_Type const *p_reg)
 Function for getting the SAADC 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.
 
NRF_STATIC_INLINE nrf_saadc_oversample_t nrf_saadc_oversample_get (NRF_SAADC_Type const *p_reg)
 Function for getting the oversampling feature 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.
 
NRF_STATIC_INLINE void nrf_saadc_continuous_mode_enable (NRF_SAADC_Type *p_reg, uint16_t cc)
 Function for enabling the continuous sampling.
 
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.
 
NRF_STATIC_INLINE void nrf_saadc_continuous_mode_disable (NRF_SAADC_Type *p_reg)
 Function for disabling the continuous sampling.
 
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.
 
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.
 
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.
 
NRF_STATIC_INLINE void nrf_saadc_channel_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.
 
NRF_STATIC_INLINE void nrf_saadc_burst_set (NRF_SAADC_Type *p_reg, nrf_saadc_burst_t burst)
 Function for configuring peripheral burst mode.
 
NRF_STATIC_INLINE nrf_saadc_value_t nrf_saadc_value_min_get (nrf_saadc_resolution_t resolution)
 Function for getting the minimum value of the conversion result.
 
NRF_STATIC_INLINE nrf_saadc_value_t nrf_saadc_value_max_get (nrf_saadc_resolution_t resolution)
 Function for getting the maximum value of the conversion result.
 
NRF_STATIC_INLINE void nrf_saadc_cal_set (NRF_SAADC_Type *p_reg, uint32_t trim)
 Function for setting SAADC CAL trimming value.
 
NRF_STATIC_INLINE uint32_t nrf_saadc_cal_get (NRF_SAADC_Type const *p_reg)
 Function for getting SAADC CAL trimming value.
 
NRF_STATIC_INLINE void nrf_saadc_calref_set (NRF_SAADC_Type *p_reg, uint32_t trim)
 Function for setting SAADC CALREF trimming value.
 
NRF_STATIC_INLINE uint32_t nrf_saadc_calref_get (NRF_SAADC_Type const *p_reg)
 Function for getting SAADC CALREF trimming value.
 

Detailed Description

Hardware access layer for managing the SAADC peripheral.

Macro Definition Documentation

◆ NRF_SAADC_ALL_CHANNELS_LIMITS_INT_MASK

#define NRF_SAADC_ALL_CHANNELS_LIMITS_INT_MASK
Value:
((uint32_t)(NRFX_BIT_MASK(SAADC_CH_NUM * NRF_SAADC_LIMITS_PER_CHANNEL) \
#define NRF_SAADC_LIMITS_INT_OFFSET
Symbol specifying the offset of interrupt bitmask for limits of all channels.
Definition nrf_saadc.h:51
#define NRF_SAADC_LIMITS_PER_CHANNEL
Symbol specifying number of LIMIT events per channel.
Definition nrf_saadc.h:55
#define NRFX_BIT_MASK(x)
Macro for returning bit mask or 0 if x is 0.
Definition nrfx_utils.h:117

Symbol specifying the interrupt bitmask for limits of all channels.

◆ NRF_SAADC_INPUT_INTERNAL0

#define NRF_SAADC_INPUT_INTERNAL0
Value:
((SAADC_CH_PSELP_INTERNAL_Internal0 + 1) \
<< SAADC_CH_PSELP_INTERNAL_Pos)

Symbol specifying Internal0 as input.

◆ NRF_SAADC_INPUT_INTERNAL1

#define NRF_SAADC_INPUT_INTERNAL1
Value:
((SAADC_CH_PSELP_INTERNAL_Internal1 + 1) \
<< SAADC_CH_PSELP_INTERNAL_Pos)

Symbol specifying Internal1 as input.

◆ NRF_SAADC_INPUT_INTERNAL2

#define NRF_SAADC_INPUT_INTERNAL2
Value:
((SAADC_CH_PSELP_INTERNAL_Internal2 + 1) \
<< SAADC_CH_PSELP_INTERNAL_Pos)

Symbol specifying Internal2 as input.

◆ NRF_SAADC_INPUT_INTERNAL3

#define NRF_SAADC_INPUT_INTERNAL3
Value:
((SAADC_CH_PSELP_INTERNAL_Internal3 + 1) \
<< SAADC_CH_PSELP_INTERNAL_Pos)

Symbol specifying Internal3 as input.

◆ NRF_SAADC_INPUT_VDDAO0V8

#define NRF_SAADC_INPUT_VDDAO0V8
Value:
((SAADC_CH_PSELP_INTERNAL_VDDAO0V8 + 1) \
<< SAADC_CH_PSELP_INTERNAL_Pos)

Symbol specifying VDD_AO_0V8 as input.

◆ NRF_SAADC_INPUT_VDDAO1V8

#define NRF_SAADC_INPUT_VDDAO1V8
Value:
((SAADC_CH_PSELP_INTERNAL_VDDAO1V8 + 1) \
<< SAADC_CH_PSELP_INTERNAL_Pos)

Symbol specifying AVDD_AO_1V8 as input.

Enumeration Type Documentation

◆ 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.

◆ nrf_saadc_burst_t

Analog-to-digital converter 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.

◆ nrf_saadc_chopping_t

Analog-to-digital converter chopping mode.

Enumerator
NRF_SAADC_CHOPPING_DISABLED 

Chopping mode is disabled.

NRF_SAADC_CHOPPING_ENABLED 

Chopping mode is enabled, inputs will be switched on every second sample.

◆ 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.

◆ 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_GAIN2_7 

Gain factor 2/7.

NRF_SAADC_GAIN1_3 

Gain factor 1/3.

NRF_SAADC_GAIN2_5 

Gain factor 2/5.

NRF_SAADC_GAIN1_2 

Gain factor 1/2.

NRF_SAADC_GAIN2_3 

Gain factor 2/3.

NRF_SAADC_GAIN1 

Gain factor 1.

NRF_SAADC_GAIN2 

Gain factor 2.

NRF_SAADC_GAIN4 

Gain factor 4.

◆ nrf_saadc_highspeed_t

Analog-to-digital converter highspeed mode.

Enumerator
NRF_SAADC_HIGHSPEED_DISABLED 

Highspeed mode is disabled.

NRF_SAADC_HIGHSPEED_ENABLED 

Highspeed mode is enabled.

◆ 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.

◆ nrf_saadc_limit_t

Analog-to-digital converter value limit type.

Enumerator
NRF_SAADC_LIMIT_LOW 

Low limit type.

NRF_SAADC_LIMIT_HIGH 

High limit type.

◆ nrf_saadc_mode_t

Analog-to-digital converter channel mode.

Enumerator
NRF_SAADC_MODE_SINGLE_ENDED 

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

NRF_SAADC_MODE_DIFFERENTIAL 

Differential mode.

◆ 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.

◆ nrf_saadc_reference_t

Reference selection for the analog-to-digital converter.

Enumerator
NRF_SAADC_REFERENCE_INTERNAL 

Internal reference.

NRF_SAADC_REFERENCE_VDD4 

VDD/4 as reference.

NRF_SAADC_REFERENCE_EXTERNAL 

External reference.

NRF_SAADC_REFERENCE_VDD 

VDD as reference.

◆ 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.

◆ 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.

◆ nrf_saadc_short_mask_t

SAADC shorts.

Enumerator
NRF_SAADC_SHORT_DONE_SAMPLE_MASK 

Shortcut between event DONE and task SAMPLE.

NRF_SAADC_SHORT_END_START_MASK 

Shortcut between event END and task START.

◆ 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_STOP 

Stop the ADC and terminate any ongoing conversion.

NRF_SAADC_TASK_SAMPLE 

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

NRF_SAADC_TASK_CALIBRATEOFFSET 

Starts offset auto-calibration.

Function Documentation

◆ nrf_saadc_amount_get()

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
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Number of samples written to the buffer.

◆ nrf_saadc_buffer_init()

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
[in]p_regPointer to the structure of registers of the peripheral.
[in]p_bufferPointer to the result buffer.
[in]sizeSize of the buffer (in samples).

◆ nrf_saadc_buffer_pointer_get()

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
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Pointer to the result buffer.

◆ nrf_saadc_buffer_pointer_set()

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
[in]p_regPointer to the structure of registers of the peripheral.
[in]p_bufferPointer to the result buffer.

◆ nrf_saadc_burst_set()

NRF_STATIC_INLINE void nrf_saadc_burst_set ( NRF_SAADC_Type * p_reg,
nrf_saadc_burst_t burst )

Function for configuring peripheral burst mode.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]burstBurst mode setting.

◆ nrf_saadc_busy_check()

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
[in]p_regPointer to the structure of registers of the peripheral.
Return values
trueThe SAADC is busy.
falseThe SAADC is not busy.

◆ nrf_saadc_cal_get()

NRF_STATIC_INLINE uint32_t nrf_saadc_cal_get ( NRF_SAADC_Type const * p_reg)

Function for getting SAADC CAL trimming value.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Trimming value

◆ nrf_saadc_cal_set()

NRF_STATIC_INLINE void nrf_saadc_cal_set ( NRF_SAADC_Type * p_reg,
uint32_t trim )

Function for setting SAADC CAL trimming value.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]trimTrimming value

◆ nrf_saadc_calref_get()

NRF_STATIC_INLINE uint32_t nrf_saadc_calref_get ( NRF_SAADC_Type const * p_reg)

Function for getting SAADC CALREF trimming value.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Trimming value

◆ nrf_saadc_calref_set()

NRF_STATIC_INLINE void nrf_saadc_calref_set ( NRF_SAADC_Type * p_reg,
uint32_t trim )

Function for setting SAADC CALREF trimming value.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]trimTrimming value

◆ nrf_saadc_channel_burst_set()

NRF_STATIC_INLINE void nrf_saadc_channel_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
[in]p_regPointer to the structure of registers of the peripheral.
[in]channelChannel number.
[in]burstBurst mode setting.

◆ nrf_saadc_channel_init()

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
[in]p_regPointer to the structure of registers of the peripheral.
[in]channelChannel number.
[in]configPointer to the channel configuration structure.

◆ nrf_saadc_channel_input_set()

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
[in]p_regPointer to the structure of registers of the peripheral.
[in]channelChannel number.
[in]pselpPositive input.
[in]pselnNegative input. Set to NRF_SAADC_INPUT_DISABLED in single ended mode.

◆ nrf_saadc_channel_limits_set()

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
[in]p_regPointer to the structure of registers of the peripheral.
[in]channelChannel number.
[in]lowLow limit.
[in]highHigh limit.

◆ nrf_saadc_channel_neg_input_set()

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

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

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]channelChannel number.
[in]pselnNegative input.

◆ nrf_saadc_channel_pos_input_set()

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
[in]p_regPointer to the structure of registers of the peripheral.
[in]channelChannel number.
[in]pselpPositive input.

◆ nrf_saadc_continuous_mode_disable()

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
[in]p_regPointer to the structure of registers of the peripheral.

◆ nrf_saadc_continuous_mode_enable()

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
[in]p_regPointer to the structure of registers of the peripheral.
[in]ccCapture and compare value. Sample rate is 16 MHz/cc. Valid CC range is from NRF_SAADC_SAMPLERATE_CC_MIN to NRF_SAADC_SAMPLERATE_CC_MAX.

◆ nrf_saadc_continuous_mode_enable_check()

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
[in]p_regPointer to the structure of registers of the peripheral.
Return values
trueThe continuous sampling is enabled.
falseThe continuous sampling is disabled.

◆ nrf_saadc_disable()

NRF_STATIC_INLINE void nrf_saadc_disable ( NRF_SAADC_Type * p_reg)

Function for disabling the SAADC.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.

◆ nrf_saadc_enable()

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
[in]p_regPointer to the structure of registers of the peripheral.

◆ nrf_saadc_enable_check()

NRF_STATIC_INLINE bool nrf_saadc_enable_check ( NRF_SAADC_Type const * p_reg)

Function for checking if the SAADC is enabled.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Return values
trueThe SAADC is enabled.
falseThe SAADC is not enabled.

◆ nrf_saadc_event_address_get()

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
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventSAADC event.
Returns
Address of the specified SAADC event.

◆ nrf_saadc_event_check()

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
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventEvent to be checked.
Return values
trueThe event has been generated.
falseThe event has not been generated.

◆ nrf_saadc_event_clear()

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
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventSAADC event.

◆ nrf_saadc_int_disable()

NRF_STATIC_INLINE void nrf_saadc_int_disable ( NRF_SAADC_Type * p_reg,
uint32_t mask )

Function for disabling specified interrupts.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskMask of interrupts to be disabled. Use nrf_saadc_int_mask_t values for bit masking.

◆ nrf_saadc_int_enable()

NRF_STATIC_INLINE void nrf_saadc_int_enable ( NRF_SAADC_Type * p_reg,
uint32_t mask )

Function for enabling specified SAADC interrupts.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskMask of interrupts to be enabled. Use nrf_saadc_int_mask_t values for bit masking.

◆ nrf_saadc_int_enable_check()

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
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskMask of interrupts to be checked. Use nrf_saadc_int_mask_t values for bit masking.
Returns
Mask of enabled interrupts.

◆ nrf_saadc_int_set()

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
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskInterrupts configuration to be set. Use nrf_saadc_int_mask_t values for bit masking.

◆ nrf_saadc_limit_event_get()

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
[in]channelChannel number.
[in]limit_typeLow limit or high limit.
Returns
The SAADC channel monitoring limit event.

◆ nrf_saadc_limit_int_get()

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
[in]channelSAADC channel number.
[in]limit_typeLimit type.
Returns
Interrupt mask.

◆ nrf_saadc_linearity_calibration_coeff_get()

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
[in]p_regPointer to the structure of registers of the peripheral.
[in]indexCoefficient number.
Returns
Value of the coefficient.

◆ nrf_saadc_linearity_calibration_coeff_set()

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
[in]p_regPointer to the structure of registers of the peripheral.
[in]indexCoefficient number.
[in]coeffValue of the coefficient.

◆ nrf_saadc_oversample_get()

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
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Oversampling configuration.

◆ nrf_saadc_oversample_sample_count_get()

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
[in]oversampleOversampling configuration.
Returns
Sample count.

◆ nrf_saadc_oversample_set()

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
[in]p_regPointer to the structure of registers of the peripheral.
[in]oversampleOversampling mode.

◆ nrf_saadc_publish_clear()

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
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventEvent for which to clear the configuration.

◆ nrf_saadc_publish_get()

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

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

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventEvent for which to read the configuration.
Returns
SAADC publish configuration.

◆ nrf_saadc_publish_set()

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
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventEvent for which to set the configuration.
[in]channelChannel through which to publish the event.

◆ nrf_saadc_resolution_get()

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
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Sample resolution.

◆ nrf_saadc_resolution_set()

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
[in]p_regPointer to the structure of registers of the peripheral.
[in]resolutionBit resolution.

◆ nrf_saadc_shorts_disable()

NRF_STATIC_INLINE void nrf_saadc_shorts_disable ( NRF_SAADC_Type * p_reg,
uint32_t mask )

Function for disabling the specified shortcuts.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskShortcuts to be disabled.

◆ nrf_saadc_shorts_enable()

NRF_STATIC_INLINE void nrf_saadc_shorts_enable ( NRF_SAADC_Type * p_reg,
uint32_t mask )

Function for enabling the specified shortcuts.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskShortcuts to be enabled.

◆ nrf_saadc_shorts_get()

NRF_STATIC_INLINE uint32_t nrf_saadc_shorts_get ( NRF_SAADC_Type const * p_reg)

Function for getting the shortcut setting.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Current shortcut configuration.

◆ nrf_saadc_subscribe_clear()

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
[in]p_regPointer to the structure of registers of the peripheral.
[in]taskTask for which to clear the configuration.

◆ nrf_saadc_subscribe_get()

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

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

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]taskTask for which to read the configuration.
Returns
SAADC subscribe configuration.

◆ nrf_saadc_subscribe_set()

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
[in]p_regPointer to the structure of registers of the peripheral.
[in]taskTask for which to set the configuration.
[in]channelChannel through which to subscribe events.

◆ nrf_saadc_task_address_get()

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
[in]p_regPointer to the structure of registers of the peripheral.
[in]taskSAADC task.
Returns
Address of the specified SAADC task.

◆ nrf_saadc_task_trigger()

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
[in]p_regPointer to the structure of registers of the peripheral.
[in]taskSAADC task.

◆ nrf_saadc_value_max_get()

NRF_STATIC_INLINE nrf_saadc_value_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
[in]resolutionBit resolution.
Returns
Maximum value of the conversion result.

◆ nrf_saadc_value_min_get()

NRF_STATIC_INLINE nrf_saadc_value_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
[in]resolutionBit resolution.
Returns
Minimum value of the conversion result.