Implement time feature
This commit is contained in:
parent
4ce4131f8b
commit
d99841fea9
@ -82,9 +82,12 @@ memory-x = ["stm32-metapac/memory-x"]
|
||||
subghz = []
|
||||
exti = []
|
||||
|
||||
# Enables additional driver features that depend on embassy-time
|
||||
time = ["dep:embassy-time"]
|
||||
|
||||
# Features starting with `_` are for internal use only. They're not intended
|
||||
# to be enabled by other crates, and are not covered by semver guarantees.
|
||||
_time-driver = ["dep:embassy-time"]
|
||||
_time-driver = ["time"]
|
||||
time-driver-any = ["_time-driver"]
|
||||
time-driver-tim2 = ["_time-driver"]
|
||||
time-driver-tim3 = ["_time-driver"]
|
||||
|
@ -7,7 +7,9 @@ use crate::interrupt::Interrupt;
|
||||
mod _version;
|
||||
pub use _version::*;
|
||||
|
||||
#[cfg(feature = "time")]
|
||||
mod timeout;
|
||||
#[cfg(feature = "time")]
|
||||
pub use timeout::*;
|
||||
|
||||
use crate::peripherals;
|
||||
|
@ -52,7 +52,7 @@ pub mod sdmmc;
|
||||
pub mod spi;
|
||||
#[cfg(usart)]
|
||||
pub mod usart;
|
||||
#[cfg(usb)]
|
||||
#[cfg(all(usb, feature = "time"))]
|
||||
pub mod usb;
|
||||
#[cfg(any(otgfs, otghs))]
|
||||
pub mod usb_otg;
|
||||
|
@ -439,6 +439,7 @@ impl From<Timeout> for [u8; 3] {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "time")]
|
||||
impl From<Timeout> for embassy_time::Duration {
|
||||
fn from(to: Timeout) -> Self {
|
||||
embassy_time::Duration::from_micros(to.as_micros().into())
|
||||
|
@ -44,6 +44,7 @@ impl From<RampTime> for core::time::Duration {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "time")]
|
||||
impl From<RampTime> for embassy_time::Duration {
|
||||
fn from(rt: RampTime) -> Self {
|
||||
match rt {
|
||||
|
Loading…
Reference in New Issue
Block a user