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 embedded_hal;
23pub use embedded_io;
24pub use nb;
25pub use rtrb::{self, Consumer, Producer, RingBuffer};
26#[cfg(feature = "stm32f100")]
27pub use stm32f1::stm32f100 as pac;
28#[cfg(feature = "stm32f101")]
29pub use stm32f1::stm32f101 as pac;
30#[cfg(feature = "stm32f103")]
31pub use stm32f1::stm32f103 as pac;
32#[cfg(any(feature = "stm32f105", feature = "stm32f107"))]
33pub use stm32f1::stm32f107 as pac;
34
35pub(crate) trait Steal {
36    /// Steal an instance of this peripheral
37    ///
38    /// # Safety
39    ///
40    /// Ensure that the new instance of the peripheral cannot be used in a way
41    /// that may race with any existing instances, for example by only
42    /// accessing read-only or write-only registers, or by consuming the
43    /// original peripheral and using critical sections to coordinate
44    /// access between multiple new instances.
45    ///
46    /// Additionally the HAL may rely on only one
47    /// peripheral instance existing to ensure memory safety; ensure
48    /// no stolen instances are passed to such software.
49    unsafe fn steal(&self) -> Self;
50}
51
52impl<RB, const A: usize> Steal for stm32f1::Periph<RB, A> {
53    unsafe fn steal(&self) -> Self {
54        unsafe { Self::steal() }
55    }
56}
57
58pub struct Mcu {
59    // pub apb1: APB1,
60    // pub apb2: APB2,
61    // pub flash: pac::flash::Parts,
62    pub scb: nvic_scb::Scb,
63    pub nvic: nvic_scb::Nvic,
64    pub rcc: rcc::Rcc,
65    pub afio: afio::Afio,
66}