#![no_std] #![no_main] #![allow(incomplete_features)] #![feature(trait_alias)] #![feature(min_type_alias_impl_trait)] #![feature(impl_trait_in_bindings)] #![feature(type_alias_impl_trait)] #[path = "../example_common.rs"] mod example_common; use defmt::panic; use embassy::executor::Spawner; use embassy::time::Delay; use embassy_stm32::adc::{Adc, Resolution}; use embassy_stm32::{pac, Peripherals}; use example_common::*; #[embassy::main] async fn main(_spawner: Spawner, p: Peripherals) { info!("Hello World!"); unsafe { pac::RCC.ccipr().modify(|w| { w.set_adcsel(0b11); }); pac::DBGMCU.cr().modify(|w| { w.set_dbg_sleep(true); w.set_dbg_standby(true); w.set_dbg_stop(true); }); pac::RCC.ahb2enr().modify(|w| w.set_adcen(true)); } let mut adc = Adc::new(p.ADC1, &mut Delay); //adc.enable_vref(); adc.set_resolution(Resolution::EightBit); let mut channel = p.PC0; loop { let v = adc.read(&mut channel); info!("--> {}", v); } }