stm32f1_hal/
lib.rs

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