Update embassy-stm32

This commit is contained in:
Dario Nieuwenhuis
2022-07-23 01:29:35 +02:00
parent e0521ea249
commit 8a9d2f59af
26 changed files with 433 additions and 361 deletions

View File

@ -2,8 +2,6 @@
#![no_main]
#![feature(type_alias_impl_trait)]
use core::marker::PhantomData;
use defmt::*;
use embassy::executor::Spawner;
use embassy::time::{Duration, Timer};
@ -11,7 +9,7 @@ use embassy_stm32::gpio::low_level::AFType;
use embassy_stm32::gpio::Speed;
use embassy_stm32::pwm::*;
use embassy_stm32::time::{khz, mhz, Hertz};
use embassy_stm32::{unborrow, Config, Peripherals, Unborrow};
use embassy_stm32::{unborrow, Config, Peripherals, Unborrow, Unborrowed};
use {defmt_rtt as _, panic_probe as _};
pub fn config() -> Config {
@ -49,8 +47,7 @@ async fn main(_spawner: Spawner, p: Peripherals) {
}
}
pub struct SimplePwm32<'d, T: CaptureCompare32bitInstance> {
phantom: PhantomData<&'d mut T>,
inner: T,
inner: Unborrowed<'d, T>,
}
impl<'d, T: CaptureCompare32bitInstance> SimplePwm32<'d, T> {
@ -78,10 +75,7 @@ impl<'d, T: CaptureCompare32bitInstance> SimplePwm32<'d, T> {
ch4.set_as_af(ch1.af_num(), AFType::OutputPushPull);
}
let mut this = Self {
inner: tim,
phantom: PhantomData,
};
let mut this = Self { inner: tim };
this.set_freq(freq);
this.inner.start();

View File

@ -21,10 +21,15 @@ async fn main(_spawner: Spawner, p: Peripherals) -> ! {
let irq = interrupt::take!(SDMMC1);
let mut sdmmc = Sdmmc::new(
let mut sdmmc = Sdmmc::new_4bit(
p.SDMMC1,
(p.PC12, p.PD2, p.PC8, p.PC9, p.PC10, p.PC11),
irq,
p.PC12,
p.PD2,
p.PC8,
p.PC9,
p.PC10,
p.PC11,
Default::default(),
);