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

embassy-stm32: Add SimplePwmChannel #3317

Merged
merged 10 commits into from
Oct 23, 2024
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
7 changes: 7 additions & 0 deletions embassy-stm32/src/timer/low_level.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
//!
//! The available functionality depends on the timer type.

use core::mem::ManuallyDrop;

use embassy_hal_internal::{into_ref, Peripheral, PeripheralRef};
// Re-export useful enums
pub use stm32_metapac::timer::vals::{FilterValue, Sms as SlaveMode, Ts as TriggerSource};
Expand Down Expand Up @@ -198,6 +200,11 @@ impl<'d, T: CoreInstance> Timer<'d, T> {
Self { tim }
}

pub(crate) unsafe fn clone_unchecked(&self) -> ManuallyDrop<Self> {
let tim = unsafe { self.tim.clone_unchecked() };
ManuallyDrop::new(Self { tim })
}

/// Get access to the virutal core 16bit timer registers.
///
/// Note: This works even if the timer is more capable, because registers
Expand Down
3 changes: 2 additions & 1 deletion embassy-stm32/src/timer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use core::marker::PhantomData;

use embassy_hal_internal::Peripheral;
use embassy_sync::waitqueue::AtomicWaker;

#[cfg(not(stm32l0))]
Expand Down Expand Up @@ -66,7 +67,7 @@ impl State {
}
}

trait SealedInstance: RccPeripheral {
trait SealedInstance: RccPeripheral + Peripheral<P = Self> {
/// Async state for this timer
fn state() -> &'static State;
}
Expand Down
Loading