diff --git a/esp-hal-common/src/peripherals/esp32.rs b/esp-hal-common/src/peripherals/esp32.rs index 80eecb42a50..e28570b3a30 100644 --- a/esp-hal-common/src/peripherals/esp32.rs +++ b/esp-hal-common/src/peripherals/esp32.rs @@ -64,5 +64,6 @@ mod peripherals { UART2, DPORT, LEDC, + RMT, } } diff --git a/esp-hal-common/src/peripherals/esp32c3.rs b/esp-hal-common/src/peripherals/esp32c3.rs index 7e904dee5e2..5cc3a97dc05 100644 --- a/esp-hal-common/src/peripherals/esp32c3.rs +++ b/esp-hal-common/src/peripherals/esp32c3.rs @@ -56,5 +56,6 @@ mod peripherals { USB_DEVICE, SYSTEM, LEDC, + RMT, } } diff --git a/esp-hal-common/src/peripherals/esp32s2.rs b/esp-hal-common/src/peripherals/esp32s2.rs index e7355b962b3..efd7817ebe9 100644 --- a/esp-hal-common/src/peripherals/esp32s2.rs +++ b/esp-hal-common/src/peripherals/esp32s2.rs @@ -63,5 +63,6 @@ mod peripherals { UART1, SYSTEM, LEDC, + RMT, } } diff --git a/esp-hal-common/src/peripherals/esp32s3.rs b/esp-hal-common/src/peripherals/esp32s3.rs index 354bf27e739..bfc7827c797 100644 --- a/esp-hal-common/src/peripherals/esp32s3.rs +++ b/esp-hal-common/src/peripherals/esp32s3.rs @@ -75,5 +75,6 @@ mod peripherals { USB_DEVICE, SYSTEM, LEDC, + RMT, } } diff --git a/esp-hal-common/src/pulse_control.rs b/esp-hal-common/src/pulse_control.rs index c36bfc769e0..41fe0b38619 100644 --- a/esp-hal-common/src/pulse_control.rs +++ b/esp-hal-common/src/pulse_control.rs @@ -85,7 +85,8 @@ pub use paste::paste; use crate::{ gpio::{types::OutputSignal, OutputPin}, - pac::RMT, + peripherals::RMT, + peripheral::{Peripheral, PeripheralRef}, system::PeripheralClockControl, }; @@ -822,20 +823,20 @@ macro_rules! rmt { ) => { /// RMT peripheral (RMT) - pub struct PulseControl { + pub struct PulseControl<'d> { /// The underlying register block - reg: RMT, + reg: PeripheralRef<'d, RMT>, $( /// RMT channel $cxi pub $obj_name: $cxi, )+ } - impl PulseControl { + impl<'d> PulseControl<'d> { /// Create a new pulse controller instance #[cfg(any(esp32c3, esp32s3))] pub fn new( - instance: RMT, + instance: impl Peripheral
+ 'd,
peripheral_clock_control: &mut PeripheralClockControl,
clk_source: ClockSource,
div_abs: u8,
@@ -843,6 +844,7 @@ macro_rules! rmt {
div_frac_b: u8,
) -> Result + 'd,
peripheral_clock_control: &mut PeripheralClockControl,
) -> Result