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