![]() |
nRF5 SDK
v16.0.0
|
| Choose documentation: | nRF5 SDK | S112 SoftDevice API | S113 SoftDevice API | S132 SoftDevice API | S140 SoftDevice API | S212 SoftDevice API | S312 SoftDevice API | S332 SoftDevice API | S340 SoftDevice API |
Hardware access layer for managing the Analog-to-Digital Converter (ADC) peripheral. More...
Data Structures | |
| struct | nrf_adc_config_t |
| Analog-to-digital converter configuration. More... | |
Typedefs | |
| typedef uint16_t | nrf_adc_value_t |
| Analog-to-digital value type. | |
Enumerations | |
| enum | nrf_adc_int_mask_t { NRF_ADC_INT_END_MASK = ADC_INTENSET_END_Msk } |
| ADC interrupts. More... | |
| enum | nrf_adc_config_resolution_t { NRF_ADC_CONFIG_RES_8BIT = ADC_CONFIG_RES_8bit, NRF_ADC_CONFIG_RES_9BIT = ADC_CONFIG_RES_9bit, NRF_ADC_CONFIG_RES_10BIT = ADC_CONFIG_RES_10bit } |
| Resolution of the analog-to-digital converter. More... | |
| enum | nrf_adc_config_scaling_t { NRF_ADC_CONFIG_SCALING_INPUT_FULL_SCALE = ADC_CONFIG_INPSEL_AnalogInputNoPrescaling, NRF_ADC_CONFIG_SCALING_INPUT_TWO_THIRDS = ADC_CONFIG_INPSEL_AnalogInputTwoThirdsPrescaling, NRF_ADC_CONFIG_SCALING_INPUT_ONE_THIRD = ADC_CONFIG_INPSEL_AnalogInputOneThirdPrescaling, NRF_ADC_CONFIG_SCALING_SUPPLY_TWO_THIRDS = ADC_CONFIG_INPSEL_SupplyTwoThirdsPrescaling, NRF_ADC_CONFIG_SCALING_SUPPLY_ONE_THIRD = ADC_CONFIG_INPSEL_SupplyOneThirdPrescaling } |
| Scaling factor of the analog-to-digital conversion. More... | |
| enum | nrf_adc_config_extref_t { NRF_ADC_CONFIG_EXTREFSEL_NONE = ADC_CONFIG_EXTREFSEL_None, NRF_ADC_CONFIG_EXTREFSEL_AREF0 = ADC_CONFIG_EXTREFSEL_AnalogReference0, NRF_ADC_CONFIG_EXTREFSEL_AREF1 = ADC_CONFIG_EXTREFSEL_AnalogReference1 } |
| External reference selection of the analog-to-digital converter. More... | |
| enum | nrf_adc_config_reference_t { NRF_ADC_CONFIG_REF_VBG = ADC_CONFIG_REFSEL_VBG, NRF_ADC_CONFIG_REF_SUPPLY_ONE_HALF = ADC_CONFIG_REFSEL_SupplyOneHalfPrescaling, NRF_ADC_CONFIG_REF_SUPPLY_ONE_THIRD = ADC_CONFIG_REFSEL_SupplyOneThirdPrescaling, NRF_ADC_CONFIG_REF_EXT = ADC_CONFIG_REFSEL_External } |
| Reference selection of the analog-to-digital converter. More... | |
| enum | nrf_adc_config_input_t { NRF_ADC_CONFIG_INPUT_DISABLED = ADC_CONFIG_PSEL_Disabled, NRF_ADC_CONFIG_INPUT_0 = ADC_CONFIG_PSEL_AnalogInput0, NRF_ADC_CONFIG_INPUT_1 = ADC_CONFIG_PSEL_AnalogInput1, NRF_ADC_CONFIG_INPUT_2 = ADC_CONFIG_PSEL_AnalogInput2, NRF_ADC_CONFIG_INPUT_3 = ADC_CONFIG_PSEL_AnalogInput3, NRF_ADC_CONFIG_INPUT_4 = ADC_CONFIG_PSEL_AnalogInput4, NRF_ADC_CONFIG_INPUT_5 = ADC_CONFIG_PSEL_AnalogInput5, NRF_ADC_CONFIG_INPUT_6 = ADC_CONFIG_PSEL_AnalogInput6, NRF_ADC_CONFIG_INPUT_7 = ADC_CONFIG_PSEL_AnalogInput7 } |
| Input selection of the analog-to-digital converter. More... | |
| enum | nrf_adc_task_t { NRF_ADC_TASK_START = offsetof(NRF_ADC_Type, TASKS_START), NRF_ADC_TASK_STOP = offsetof(NRF_ADC_Type, TASKS_STOP) } |
| Analog-to-digital converter tasks. More... | |
| enum | nrf_adc_event_t { NRF_ADC_EVENT_END = offsetof(NRF_ADC_Type, EVENTS_END) } |
| Analog-to-digital converter events. More... | |
Functions | |
| __STATIC_INLINE void | nrf_adc_task_trigger (nrf_adc_task_t task) |
| Function for activating the specified ADC task. More... | |
| __STATIC_INLINE uint32_t | nrf_adc_task_address_get (nrf_adc_task_t task) |
| Function for getting the address of an ADC task register. More... | |
| __STATIC_INLINE bool | nrf_adc_event_check (nrf_adc_event_t event) |
| Function for retrieving the state of an ADC event. More... | |
| __STATIC_INLINE void | nrf_adc_event_clear (nrf_adc_event_t event) |
| Function for clearing an ADC event. More... | |
| __STATIC_INLINE uint32_t | nrf_adc_event_address_get (nrf_adc_event_t adc_event) |
| Function for getting the address of the specified ADC event register. More... | |
| __STATIC_INLINE void | nrf_adc_int_enable (uint32_t mask) |
| Function for enabling the specified interrupts. More... | |
| __STATIC_INLINE void | nrf_adc_int_disable (uint32_t mask) |
| Function for disabling the specified interrupts. More... | |
| __STATIC_INLINE bool | nrf_adc_int_enable_check (uint32_t mask) |
| Function for retrieving the state of the specified ADC interrupts. More... | |
| __STATIC_INLINE bool | nrf_adc_busy_check (void) |
| Function for checking whether the ADC is busy. More... | |
| __STATIC_INLINE void | nrf_adc_enable (void) |
| Function for enabling the ADC. | |
| __STATIC_INLINE void | nrf_adc_disable (void) |
| Function for disabling the ADC. | |
| __STATIC_INLINE bool | nrf_adc_enable_check (void) |
| Function for checking if the ADC is enabled. More... | |
| __STATIC_INLINE nrf_adc_value_t | nrf_adc_result_get (void) |
| Function for retrieving the ADC conversion result. More... | |
| __STATIC_INLINE void | nrf_adc_init (nrf_adc_config_t const *p_config) |
| Function for initializing the ADC. More... | |
Hardware access layer for managing the Analog-to-Digital Converter (ADC) peripheral.
Input selection of the analog-to-digital converter.
Reference selection of the analog-to-digital converter.
| Enumerator | |
|---|---|
| NRF_ADC_CONFIG_REF_VBG |
1.2 V reference. |
| NRF_ADC_CONFIG_REF_SUPPLY_ONE_HALF |
1/2 of power supply. |
| NRF_ADC_CONFIG_REF_SUPPLY_ONE_THIRD |
1/3 of power supply. |
| NRF_ADC_CONFIG_REF_EXT |
External reference. See nrf_adc_config_extref_t for further configuration. |
Scaling factor of the analog-to-digital conversion.
| enum nrf_adc_event_t |
| enum nrf_adc_int_mask_t |
| enum nrf_adc_task_t |
| __STATIC_INLINE bool nrf_adc_busy_check | ( | void | ) |
Function for checking whether the ADC is busy.
This function checks whether the ADC converter is busy with a conversion.
| true | The ADC is busy. |
| false | The ADC is not busy. |
| __STATIC_INLINE bool nrf_adc_enable_check | ( | void | ) |
Function for checking if the ADC is enabled.
| true | The ADC is enabled. |
| false | The ADC is not enabled. |
| __STATIC_INLINE uint32_t nrf_adc_event_address_get | ( | nrf_adc_event_t | adc_event | ) |
Function for getting the address of the specified ADC event register.
| [in] | adc_event | ADC event. |
| __STATIC_INLINE bool nrf_adc_event_check | ( | nrf_adc_event_t | event | ) |
Function for retrieving the state of an ADC event.
| [in] | event | Event to be checked. |
| true | The event has been generated. |
| false | The event has not been generated. |
| __STATIC_INLINE void nrf_adc_event_clear | ( | nrf_adc_event_t | event | ) |
Function for clearing an ADC event.
| [in] | event | Event to clear. |
| __STATIC_INLINE void nrf_adc_init | ( | nrf_adc_config_t const * | p_config | ) |
Function for initializing the ADC.
This function writes data to ADC's CONFIG register. After the configuration, the ADC is in DISABLE state and must be enabled before using it.
| [in] | p_config | Configuration parameters. |
| __STATIC_INLINE void nrf_adc_int_disable | ( | uint32_t | mask | ) |
Function for disabling the specified interrupts.
| [in] | mask | Mask of interrupts to be disabled. |
| __STATIC_INLINE void nrf_adc_int_enable | ( | uint32_t | mask | ) |
Function for enabling the specified interrupts.
| [in] | mask | Mask of interrupts to be enabled. |
| __STATIC_INLINE bool nrf_adc_int_enable_check | ( | uint32_t | mask | ) |
Function for retrieving the state of the specified ADC interrupts.
| [in] | mask | Mask of interrupts to be checked. |
| true | All specified interrupts are enabled. |
| false | At least one of the given interrupts is not enabled. |
| __STATIC_INLINE nrf_adc_value_t nrf_adc_result_get | ( | void | ) |
Function for retrieving the ADC conversion result.
This function retrieves and returns the last analog-to-digital conversion result.
| __STATIC_INLINE uint32_t nrf_adc_task_address_get | ( | nrf_adc_task_t | task | ) |
Function for getting the address of an ADC task register.
| [in] | task | ADC task. |
| __STATIC_INLINE void nrf_adc_task_trigger | ( | nrf_adc_task_t | task | ) |
Function for activating the specified ADC task.
| [in] | task | Task to be activated. |