diff --git a/esp-hal/src/timer/timg.rs b/esp-hal/src/timer/timg.rs index 40be2cd2b..d51eec9e2 100644 --- a/esp-hal/src/timer/timg.rs +++ b/esp-hal/src/timer/timg.rs @@ -81,7 +81,7 @@ use crate::{ peripherals::{timg0::RegisterBlock, Interrupt, TIMG0}, private::Sealed, sync::{lock, Lock}, - system::{Peripheral as PeripheralEnable, PeripheralClockControl}, + system::PeripheralClockControl, Async, Blocking, InterruptConfigurable, @@ -152,7 +152,7 @@ impl TimerGroupInstance for TIMG0 { } fn enable_peripheral() { - crate::system::PeripheralClockControl::enable(crate::system::Peripheral::Timg0) + PeripheralClockControl::enable(crate::system::Peripheral::Timg0) } fn reset_peripheral() { @@ -215,11 +215,11 @@ impl TimerGroupInstance for crate::peripherals::TIMG1 { } fn enable_peripheral() { - crate::system::PeripheralClockControl::enable(crate::system::Peripheral::Timg1) + PeripheralClockControl::enable(crate::system::Peripheral::Timg1) } fn reset_peripheral() { - crate::system::PeripheralClockControl::reset(crate::system::Peripheral::Timg1) + PeripheralClockControl::reset(crate::system::Peripheral::Timg1) } fn configure_wdt_src_clk() { @@ -377,7 +377,6 @@ where { /// Construct a new instance of [`Timer`] pub fn new(timg: T, apb_clk_freq: HertzU32) -> Self { - timg.enable_peripheral(); timg.set_counter_active(true); Self { @@ -599,7 +598,7 @@ where } #[doc(hidden)] -pub trait Instance: Sealed + Enable { +pub trait Instance: Sealed { fn register_block(&self) -> &RegisterBlock; fn timer_group(&self) -> u8; @@ -637,11 +636,6 @@ pub trait Instance: Sealed + Enable { fn is_interrupt_set(&self) -> bool; } -#[doc(hidden)] -pub trait Enable: Sealed { - fn enable_peripheral(&self); -} - /// A timer within a Timer Group. pub struct TimerX { phantom: PhantomData, @@ -674,7 +668,6 @@ where impl Instance for TimerX where TG: TimerGroupInstance, - Self: Enable, { fn register_block(&self) -> &RegisterBlock { unsafe { &*TG::register_block() } @@ -815,25 +808,6 @@ pub type Timer0 = TimerX; #[cfg(timg_timer1)] pub type Timer1 = TimerX; -impl Enable for Timer0 -where - TG: TimerGroupInstance, -{ - fn enable_peripheral(&self) { - PeripheralClockControl::enable(PeripheralEnable::Timg0); - } -} - -#[cfg(timg_timer1)] -impl Enable for Timer1 -where - TG: TimerGroupInstance, -{ - fn enable_peripheral(&self) { - PeripheralClockControl::enable(PeripheralEnable::Timg1); - } -} - fn ticks_to_timeout(ticks: u64, clock: F, divider: u32) -> u64 where F: Into, @@ -956,7 +930,7 @@ where /// Construct a new instance of [`Wdt`] pub fn new() -> Self { #[cfg(lp_wdt)] - PeripheralClockControl::enable(PeripheralEnable::Wdt); + PeripheralClockControl::enable(crate::system::Peripheral::Wdt); TG::configure_wdt_src_clk();