Module nrf52833_hal::saadc

source ·
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_channel(&mut saadc_pin);

Structs§

  • Channel that doesn’t sample a pin, but the internal VDD voltage.
  • The voltage on the VDDH pin, divided by 5.
  • Interface for the SAADC peripheral.
  • Used to configure the SAADC peripheral.

Enums§

Traits§