Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve SYSTIMER API #1871

Merged
merged 7 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion esp-hal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,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)
- 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
36 changes: 18 additions & 18 deletions esp-hal/src/timer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,17 +376,17 @@ 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>),
SystimerAlarm0Periodic(systimer::Alarm<'static, systimer::Periodic, Blocking, 0, 0>),
#[cfg(systimer)]
SystimerAlarm1Periodic(systimer::Alarm<systimer::Periodic, Blocking, 1>),
SystimerAlarm1Periodic(systimer::Alarm<'static, systimer::Periodic, Blocking, 1, 0>),
#[cfg(systimer)]
SystimerAlarm2Periodic(systimer::Alarm<systimer::Periodic, Blocking, 2>),
SystimerAlarm2Periodic(systimer::Alarm<'static, systimer::Periodic, Blocking, 2, 0>),
#[cfg(systimer)]
SystimerAlarm0Target(systimer::Alarm<systimer::Target, Blocking, 0>),
SystimerAlarm0Target(systimer::Alarm<'static, systimer::Target, Blocking, 0, 0>),
#[cfg(systimer)]
SystimerAlarm1Target(systimer::Alarm<systimer::Target, Blocking, 1>),
SystimerAlarm1Target(systimer::Alarm<'static, systimer::Target, Blocking, 1, 0>),
#[cfg(systimer)]
SystimerAlarm2Target(systimer::Alarm<systimer::Target, Blocking, 2>),
SystimerAlarm2Target(systimer::Alarm<'static, systimer::Target, Blocking, 2, 0>),
}

impl crate::private::Sealed for ErasedTimer {}
Expand Down Expand Up @@ -419,43 +419,43 @@ 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 {
impl From<systimer::Alarm<'static, systimer::Periodic, Blocking, 0, 0>> for ErasedTimer {
fn from(value: systimer::Alarm<'static, systimer::Periodic, Blocking, 0, 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 {
impl From<systimer::Alarm<'static, systimer::Periodic, Blocking, 1, 0>> for ErasedTimer {
fn from(value: systimer::Alarm<'static, systimer::Periodic, Blocking, 1, 0>) -> 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 {
impl From<systimer::Alarm<'static, systimer::Periodic, Blocking, 2, 0>> for ErasedTimer {
fn from(value: systimer::Alarm<'static, systimer::Periodic, Blocking, 2, 0>) -> Self {
Self::SystimerAlarm2Periodic(value)
}
}

#[cfg(systimer)]
impl From<systimer::Alarm<systimer::Target, Blocking, 0>> for ErasedTimer {
fn from(value: systimer::Alarm<systimer::Target, Blocking, 0>) -> Self {
impl From<systimer::Alarm<'static, systimer::Target, Blocking, 0, 0>> for ErasedTimer {
fn from(value: systimer::Alarm<'static, systimer::Target, Blocking, 0, 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 {
impl From<systimer::Alarm<'static, systimer::Target, Blocking, 1, 0>> for ErasedTimer {
fn from(value: systimer::Alarm<'static, systimer::Target, Blocking, 1, 0>) -> 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 {
impl From<systimer::Alarm<'static, systimer::Target, Blocking, 2, 0>> for ErasedTimer {
fn from(value: systimer::Alarm<'static, systimer::Target, Blocking, 2, 0>) -> Self {
Self::SystimerAlarm2Target(value)
}
}
Expand Down
Loading