Module nrf9160_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

Interface for the SAADC peripheral.

Used to configure the SAADC peripheral.

Enums

Gain control

Oversample control

Reference control

Positive channel resistor control

Set the resolution

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