stm32f1_hal/common/
mod.rs

1pub mod atomic_cell;
2pub mod atomic_mutex;
3pub mod bus_device;
4pub mod dma;
5pub mod i2c;
6pub mod prelude;
7pub mod ringbuf;
8pub mod simplest_heap;
9pub mod timer;
10pub mod uart;
11pub mod wrap_trait;
12
13pub use critical_section;
14pub use embedded_hal;
15pub use embedded_hal_nb;
16pub use embedded_io;
17pub use fugit::{self, HertzU32, KilohertzU32, MicrosDurationU32};
18pub use os_trait;
19pub use rtrb;
20
21use atomic_cell::AtomicCellMember;
22
23impl AtomicCellMember for MicrosDurationU32 {
24    fn to_num(self) -> usize {
25        self.ticks() as usize
26    }
27
28    unsafe fn from_num(value: usize) -> Self {
29        Self::from_ticks(value as u32)
30    }
31}
32
33impl AtomicCellMember for KilohertzU32 {
34    fn to_num(self) -> usize {
35        self.raw() as usize
36    }
37
38    unsafe fn from_num(value: usize) -> Self {
39        Self::from_raw(value as u32)
40    }
41}
42
43impl AtomicCellMember for HertzU32 {
44    fn to_num(self) -> usize {
45        self.raw() as usize
46    }
47
48    unsafe fn from_num(value: usize) -> Self {
49        Self::from_raw(value as u32)
50    }
51}