tests/stm32: add L1 DAC/ADC test.

This commit is contained in:
Dario Nieuwenhuis
2023-12-08 20:24:15 +01:00
parent c27459c052
commit fe218ed978
4 changed files with 105 additions and 12 deletions

View File

@ -1,7 +1,7 @@
#![no_std]
#![no_main]
// required-features: dac-adc-pin
// required-features: dac
#[path = "../common.rs"]
mod common;
@ -22,12 +22,13 @@ async fn main(_spawner: Spawner) {
// Initialize the board and obtain a Peripherals instance
let p: embassy_stm32::Peripherals = embassy_stm32::init(config());
let adc = peri!(p, ADC);
let dac = peri!(p, DAC);
let dac_pin = peri!(p, DAC_PIN);
let mut adc_pin = unsafe { core::ptr::read(&dac_pin) };
let mut dac = DacCh1::new(dac, NoDma, dac_pin);
let mut adc = Adc::new(p.ADC1, &mut Delay);
let mut adc = Adc::new(adc, &mut Delay);
#[cfg(feature = "stm32h755zi")]
let normalization_factor = 256;