Rename Unborrowed -> PeripheralRef, Unborrow -> Peripheral

This commit is contained in:
Dario Nieuwenhuis
2022-07-23 14:00:19 +02:00
parent 8a9d2f59af
commit 4901c34d9c
62 changed files with 970 additions and 918 deletions

View File

@ -9,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, Unborrowed};
use embassy_stm32::{into_ref, Config, Peripheral, PeripheralRef, Peripherals};
use {defmt_rtt as _, panic_probe as _};
pub fn config() -> Config {
@ -47,19 +47,19 @@ async fn main(_spawner: Spawner, p: Peripherals) {
}
}
pub struct SimplePwm32<'d, T: CaptureCompare32bitInstance> {
inner: Unborrowed<'d, T>,
inner: PeripheralRef<'d, T>,
}
impl<'d, T: CaptureCompare32bitInstance> SimplePwm32<'d, T> {
pub fn new(
tim: impl Unborrow<Target = T> + 'd,
ch1: impl Unborrow<Target = impl Channel1Pin<T>> + 'd,
ch2: impl Unborrow<Target = impl Channel2Pin<T>> + 'd,
ch3: impl Unborrow<Target = impl Channel3Pin<T>> + 'd,
ch4: impl Unborrow<Target = impl Channel4Pin<T>> + 'd,
tim: impl Peripheral<P = T> + 'd,
ch1: impl Peripheral<P = impl Channel1Pin<T>> + 'd,
ch2: impl Peripheral<P = impl Channel2Pin<T>> + 'd,
ch3: impl Peripheral<P = impl Channel3Pin<T>> + 'd,
ch4: impl Peripheral<P = impl Channel4Pin<T>> + 'd,
freq: Hertz,
) -> Self {
unborrow!(tim, ch1, ch2, ch3, ch4);
into_ref!(tim, ch1, ch2, ch3, ch4);
T::enable();
<T as embassy_stm32::rcc::low_level::RccPeripheral>::reset();