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;
32
33pub use embedded_hal;
34pub use embedded_io;
35pub use nb;
36#[cfg(feature = "stm32f100")]
37pub use stm32f1::stm32f100 as pac;
38#[cfg(feature = "stm32f101")]
39pub use stm32f1::stm32f101 as pac;
40#[cfg(feature = "stm32f103")]
41pub use stm32f1::stm32f103 as pac;
42#[cfg(any(feature = "stm32f105", feature = "stm32f107"))]
43pub use stm32f1::stm32f107 as pac;
44
45pub trait Steal {
46    /// Steal an instance of this peripheral
47    ///
48    /// # Safety
49    ///
50    /// Ensure that the new instance of the peripheral cannot be used in a way
51    /// that may race with any existing instances, for example by only
52    /// accessing read-only or write-only registers, or by consuming the
53    /// original peripheral and using critical sections to coordinate
54    /// access between multiple new instances.
55    ///
56    /// Additionally the HAL may rely on only one
57    /// peripheral instance existing to ensure memory safety; ensure
58    /// no stolen instances are passed to such software.
59    unsafe fn steal(&self) -> Self;
60}