Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions esp-hal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Peripheral driver constructors don't take `InterruptHandler`s anymore. Use `set_interrupt_handler` to explicitly set the interrupt handler now. (#1819)
- Use the peripheral ref pattern for `OneShotTimer` and `PeriodicTimer` (#1855)
- Improve SYSTIMER API (#1870)
- DMA: don't require `Sealed` to implement `ReadBuffer` and `WriteBuffer` (#1921)
- Allow DMA to/from psram for esp32s3 (#1827)
- DMA buffers now don't require a static lifetime. Make sure to never `mem::forget` an in-progress DMA transfer (consider using `#[deny(clippy::mem_forget)]`) (#1837)
Expand Down
64 changes: 10 additions & 54 deletions esp-hal/src/timer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,17 +374,9 @@ pub enum ErasedTimer {
#[cfg(all(timg1, timg_timer1))]
Timg1Timer1(timg::Timer<timg::Timer1<crate::peripherals::TIMG1>, Blocking>),
#[cfg(systimer)]
SystimerAlarm0Periodic(systimer::Alarm<systimer::Periodic, Blocking, 0>),
SystimerAlarmPeriodic(systimer::Alarm<'static, systimer::Periodic, Blocking>),
#[cfg(systimer)]
SystimerAlarm1Periodic(systimer::Alarm<systimer::Periodic, Blocking, 1>),
#[cfg(systimer)]
SystimerAlarm2Periodic(systimer::Alarm<systimer::Periodic, Blocking, 2>),
#[cfg(systimer)]
SystimerAlarm0Target(systimer::Alarm<systimer::Target, Blocking, 0>),
#[cfg(systimer)]
SystimerAlarm1Target(systimer::Alarm<systimer::Target, Blocking, 1>),
#[cfg(systimer)]
SystimerAlarm2Target(systimer::Alarm<systimer::Target, Blocking, 2>),
SystimerAlarmTarget(systimer::Alarm<'static, systimer::Target, Blocking>),
}

impl crate::private::Sealed for ErasedTimer {}
Expand Down Expand Up @@ -417,44 +409,16 @@ impl From<timg::Timer<timg::Timer1<crate::peripherals::TIMG1>, Blocking>> for Er
}

#[cfg(systimer)]
impl From<systimer::Alarm<systimer::Periodic, Blocking, 0>> for ErasedTimer {
fn from(value: systimer::Alarm<systimer::Periodic, Blocking, 0>) -> Self {
Self::SystimerAlarm0Periodic(value)
}
}

#[cfg(systimer)]
impl From<systimer::Alarm<systimer::Periodic, Blocking, 1>> for ErasedTimer {
fn from(value: systimer::Alarm<systimer::Periodic, Blocking, 1>) -> Self {
Self::SystimerAlarm1Periodic(value)
}
}

#[cfg(systimer)]
impl From<systimer::Alarm<systimer::Periodic, Blocking, 2>> for ErasedTimer {
fn from(value: systimer::Alarm<systimer::Periodic, Blocking, 2>) -> Self {
Self::SystimerAlarm2Periodic(value)
impl From<systimer::Alarm<'static, systimer::Periodic, Blocking>> for ErasedTimer {
fn from(value: systimer::Alarm<'static, systimer::Periodic, Blocking>) -> Self {
Self::SystimerAlarmPeriodic(value)
}
}

#[cfg(systimer)]
impl From<systimer::Alarm<systimer::Target, Blocking, 0>> for ErasedTimer {
fn from(value: systimer::Alarm<systimer::Target, Blocking, 0>) -> Self {
Self::SystimerAlarm0Target(value)
}
}

#[cfg(systimer)]
impl From<systimer::Alarm<systimer::Target, Blocking, 1>> for ErasedTimer {
fn from(value: systimer::Alarm<systimer::Target, Blocking, 1>) -> Self {
Self::SystimerAlarm1Target(value)
}
}

#[cfg(systimer)]
impl From<systimer::Alarm<systimer::Target, Blocking, 2>> for ErasedTimer {
fn from(value: systimer::Alarm<systimer::Target, Blocking, 2>) -> Self {
Self::SystimerAlarm2Target(value)
impl From<systimer::Alarm<'static, systimer::Target, Blocking>> for ErasedTimer {
fn from(value: systimer::Alarm<'static, systimer::Target, Blocking>) -> Self {
Self::SystimerAlarmTarget(value)
}
}

Expand All @@ -473,17 +437,9 @@ impl Timer for ErasedTimer {
#[cfg(all(timg1,timg_timer1))]
ErasedTimer::Timg1Timer1(inner) => inner,
#[cfg(systimer)]
ErasedTimer::SystimerAlarm0Periodic(inner) => inner,
#[cfg(systimer)]
ErasedTimer::SystimerAlarm1Periodic(inner) => inner,
#[cfg(systimer)]
ErasedTimer::SystimerAlarm2Periodic(inner) => inner,
#[cfg(systimer)]
ErasedTimer::SystimerAlarm0Target(inner) => inner,
#[cfg(systimer)]
ErasedTimer::SystimerAlarm1Target(inner) => inner,
ErasedTimer::SystimerAlarmPeriodic(inner) => inner,
#[cfg(systimer)]
ErasedTimer::SystimerAlarm2Target(inner) => inner,
ErasedTimer::SystimerAlarmTarget(inner) => inner,
} {
fn start(&self);
fn stop(&self);
Expand Down
Loading