stm32f1_hal/
lib.rs

1#![cfg_attr(not(feature = "std"), no_std)]
2
3cfg_if::cfg_if! {
4    if #[cfg(feature = "mcu")] {
5        extern crate alloc;
6
7        pub mod afio;
8        pub mod backup_domain;
9        pub mod bb;
10        pub mod dma;
11        pub mod flash;
12        pub mod gpio;
13        pub mod interrupt;
14        pub mod nvic_scb;
15        pub mod prelude;
16        pub mod rcc;
17        pub mod time;
18        pub mod timer;
19        pub mod uart;
20        pub mod mcu;
21        pub use mcu::Mcu;
22        pub use cortex_m;
23        pub use cortex_m_rt;
24    }
25}
26
27pub mod common;
28
29pub use common::os;
30pub use common::ringbuf;
31pub use common::simplest_heap::Heap;
32pub use waiter_trait;
33
34pub use embedded_hal;
35pub use embedded_io;
36pub use nb;
37#[cfg(feature = "stm32f100")]
38pub use stm32f1::stm32f100 as pac;
39#[cfg(feature = "stm32f101")]
40pub use stm32f1::stm32f101 as pac;
41#[cfg(feature = "stm32f103")]
42pub use stm32f1::stm32f103 as pac;
43#[cfg(any(feature = "stm32f105", feature = "stm32f107"))]
44pub use stm32f1::stm32f107 as pac;
45
46pub trait Steal {
47    /// Steal an instance of this peripheral
48    ///
49    /// # Safety
50    ///
51    /// Ensure that the new instance of the peripheral cannot be used in a way
52    /// that may race with any existing instances, for example by only
53    /// accessing read-only or write-only registers, or by consuming the
54    /// original peripheral and using critical sections to coordinate
55    /// access between multiple new instances.
56    ///
57    /// Additionally the HAL may rely on only one
58    /// peripheral instance existing to ensure memory safety; ensure
59    /// no stolen instances are passed to such software.
60    unsafe fn steal(&self) -> Self;
61}