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