diff --git a/examples/stm32f1/Cargo.toml b/examples/stm32f1/Cargo.toml index 638f1eff..6e77497a 100644 --- a/examples/stm32f1/Cargo.toml +++ b/examples/stm32f1/Cargo.toml @@ -6,7 +6,7 @@ version = "0.1.0" [dependencies] embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "defmt-timestamp-uptime", "time-tick-32768hz"] } -embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32f103rc", "unstable-pac", "memory-x", "time-driver-any"] } +embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32f103c8", "unstable-pac", "memory-x", "time-driver-any"] } embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] } embassy-usb-serial = { version = "0.1.0", path = "../../embassy-usb-serial", features = ["defmt"] } diff --git a/examples/stm32f1/src/bin/dac.rs b/examples/stm32f1/src/bin/dac.rs deleted file mode 100644 index 392f5bf4..00000000 --- a/examples/stm32f1/src/bin/dac.rs +++ /dev/null @@ -1,37 +0,0 @@ -#![no_std] -#![no_main] -#![feature(type_alias_impl_trait)] - -use defmt::*; -use embassy_executor::executor::Spawner; -use embassy_stm32::dac::{Channel, Dac, Value}; -use embassy_stm32::Peripherals; -use {defmt_rtt as _, panic_probe as _}; - -#[embassy_executor::main] -async fn main(_spawner: Spawner, p: Peripherals) -> ! { - info!("Hello World, dude!"); - - let mut dac = Dac::new_1ch(p.DAC, p.PA4); - - loop { - for v in 0..=255 { - unwrap!(dac.set(Channel::Ch1, Value::Bit8(to_sine_wave(v)))); - unwrap!(dac.trigger(Channel::Ch1)); - } - } -} - -use micromath::F32Ext; - -fn to_sine_wave(v: u8) -> u8 { - if v >= 128 { - // top half - let r = 3.14 * ((v - 128) as f32 / 128.0); - (r.sin() * 128.0 + 127.0) as u8 - } else { - // bottom half - let r = 3.14 + 3.14 * (v as f32 / 128.0); - (r.sin() * 128.0 + 127.0) as u8 - } -}