Module nrf52840_hal::saadc[][src]

Expand description

HAL interface to the SAADC peripheral.

Example usage:

// substitute `hal` with the HAL of your board, e.g. `nrf52840_hal`
use hal::{
   pac::Peripherals,
   prelude::*,
   gpio::p0::Parts as P0Parts,
   saadc::{SaadcConfig, Saadc},
};

let board = Peripherals::take().unwrap();
let gpios = P0Parts::new(board.P0);

// initialize saadc interface
let saadc_config = SaadcConfig::default();
let mut saadc = Saadc::new(board.SAADC, saadc_config);
let mut saadc_pin = gpios.p0_02; // the pin your analog device is connected to

// blocking read from saadc for `saadc_config.time` microseconds
let _saadc_result = saadc.read(&mut saadc_pin);

Structs

InternalVdd

Channel that doesn’t sample a pin, but the internal VDD voltage.

InternalVddHdiv5

The voltage on the VDDH pin, divided by 5.

Saadc

Interface for the SAADC peripheral.

SaadcConfig

Used to configure the SAADC peripheral.

Enums

Gain

Gain control

Oversample

Oversample control

Reference

Reference control

Resistor

Positive channel resistor control

Resolution

Set the resolution

Time

Acquisition time, the time the SAADC uses to sample the input voltage