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