use core::marker::PhantomData;
use core::ops::Deref;
#[doc = r"Number available in the NVIC for configuring priority"]
pub const NVIC_PRIO_BITS: u8 = 2;
#[cfg(feature = "rt")]
extern "C" {
fn WWDG();
fn PVD();
fn RTC();
fn FLASH();
fn RCC();
fn EXTI0_1();
fn EXTI2_3();
fn EXTI4_15();
fn DMA1_CHANNEL1();
fn DMA1_CHANNEL2_3();
fn DMA1_CHANNEL4_7();
fn ADC_COMP();
fn LPTIM1();
fn USART4_USART5();
fn TIM2();
fn TIM3();
fn TIM6();
fn TIM7();
fn TIM21();
fn I2C3();
fn TIM22();
fn I2C1();
fn I2C2();
fn SPI1();
fn SPI2();
fn USART1();
fn USART2();
fn AES_RNG_LPUART1();
}
#[doc(hidden)]
pub union Vector {
_handler: unsafe extern "C" fn(),
_reserved: u32,
}
#[cfg(feature = "rt")]
#[doc(hidden)]
#[link_section = ".vector_table.interrupts"]
#[no_mangle]
pub static __INTERRUPTS: [Vector; 30] = [
Vector { _handler: WWDG },
Vector { _handler: PVD },
Vector { _handler: RTC },
Vector { _handler: FLASH },
Vector { _handler: RCC },
Vector { _handler: EXTI0_1 },
Vector { _handler: EXTI2_3 },
Vector { _handler: EXTI4_15 },
Vector { _reserved: 0 },
Vector {
_handler: DMA1_CHANNEL1,
},
Vector {
_handler: DMA1_CHANNEL2_3,
},
Vector {
_handler: DMA1_CHANNEL4_7,
},
Vector { _handler: ADC_COMP },
Vector { _handler: LPTIM1 },
Vector {
_handler: USART4_USART5,
},
Vector { _handler: TIM2 },
Vector { _handler: TIM3 },
Vector { _handler: TIM6 },
Vector { _handler: TIM7 },
Vector { _reserved: 0 },
Vector { _handler: TIM21 },
Vector { _handler: I2C3 },
Vector { _handler: TIM22 },
Vector { _handler: I2C1 },
Vector { _handler: I2C2 },
Vector { _handler: SPI1 },
Vector { _handler: SPI2 },
Vector { _handler: USART1 },
Vector { _handler: USART2 },
Vector {
_handler: AES_RNG_LPUART1,
},
];
#[doc = r"Enumeration of all the interrupts"]
#[derive(Copy, Clone, Debug)]
pub enum Interrupt {
#[doc = "0 - Window Watchdog interrupt"]
WWDG,
#[doc = "1 - PVD through EXTI line detection"]
PVD,
#[doc = "2 - RTC global interrupt"]
RTC,
#[doc = "3 - Flash global interrupt"]
FLASH,
#[doc = "4 - RCC global interrupt"]
RCC,
#[doc = "5 - EXTI Line\\[1:0\\] interrupts"]
EXTI0_1,
#[doc = "6 - EXTI Line\\[3:2\\] interrupts"]
EXTI2_3,
#[doc = "7 - EXTI Line15 and EXTI4 interrupts"]
EXTI4_15,
#[doc = "9 - DMA1 Channel1 global interrupt"]
DMA1_CHANNEL1,
#[doc = "10 - DMA1 Channel2 and 3 interrupts"]
DMA1_CHANNEL2_3,
#[doc = "11 - DMA1 Channel4 to 7 interrupts"]
DMA1_CHANNEL4_7,
#[doc = "12 - ADC and comparator 1 and 2"]
ADC_COMP,
#[doc = "13 - LPTIMER1 interrupt through EXTI29"]
LPTIM1,
#[doc = "14 - USART4/USART5 global interrupt"]
USART4_USART5,
#[doc = "15 - TIM2 global interrupt"]
TIM2,
#[doc = "16 - TIM3 global interrupt"]
TIM3,
#[doc = "17 - TIM6 global interrupt and DAC"]
TIM6,
#[doc = "18 - TIM7 global interrupt and DAC"]
TIM7,
#[doc = "20 - TIMER21 global interrupt"]
TIM21,
#[doc = "21 - I2C3 global interrupt"]
I2C3,
#[doc = "22 - TIMER22 global interrupt"]
TIM22,
#[doc = "23 - I2C1 global interrupt"]
I2C1,
#[doc = "24 - I2C2 global interrupt"]
I2C2,
#[doc = "25 - SPI1_global_interrupt"]
SPI1,
#[doc = "26 - SPI2 global interrupt"]
SPI2,
#[doc = "27 - USART1 global interrupt"]
USART1,
#[doc = "28 - USART2 global interrupt"]
USART2,
#[doc = "29 - AES global interrupt RNG global interrupt and LPUART1 global interrupt through"]
AES_RNG_LPUART1,
}
unsafe impl bare_metal::Nr for Interrupt {
#[inline]
fn nr(&self) -> u8 {
match *self {
Interrupt::WWDG => 0,
Interrupt::PVD => 1,
Interrupt::RTC => 2,
Interrupt::FLASH => 3,
Interrupt::RCC => 4,
Interrupt::EXTI0_1 => 5,
Interrupt::EXTI2_3 => 6,
Interrupt::EXTI4_15 => 7,
Interrupt::DMA1_CHANNEL1 => 9,
Interrupt::DMA1_CHANNEL2_3 => 10,
Interrupt::DMA1_CHANNEL4_7 => 11,
Interrupt::ADC_COMP => 12,
Interrupt::LPTIM1 => 13,
Interrupt::USART4_USART5 => 14,
Interrupt::TIM2 => 15,
Interrupt::TIM3 => 16,
Interrupt::TIM6 => 17,
Interrupt::TIM7 => 18,
Interrupt::TIM21 => 20,
Interrupt::I2C3 => 21,
Interrupt::TIM22 => 22,
Interrupt::I2C1 => 23,
Interrupt::I2C2 => 24,
Interrupt::SPI1 => 25,
Interrupt::SPI2 => 26,
Interrupt::USART1 => 27,
Interrupt::USART2 => 28,
Interrupt::AES_RNG_LPUART1 => 29,
}
}
}
#[cfg(feature = "rt")]
pub use self::Interrupt as interrupt;
pub use cortex_m::peripheral::Peripherals as CorePeripherals;
pub use cortex_m::peripheral::{CBP, CPUID, DCB, DWT, FPB, ITM, MPU, NVIC, SCB, SYST, TPIU};
#[cfg(feature = "rt")]
pub use cortex_m_rt::interrupt;
#[doc = "Advanced encryption standard hardware accelerator"]
pub struct AES {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for AES {}
impl AES {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const aes::RegisterBlock {
0x4002_6000 as *const _
}
}
impl Deref for AES {
type Target = aes::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*AES::ptr() }
}
}
#[doc = "Advanced encryption standard hardware accelerator"]
pub mod aes;
#[doc = "Direct memory access controller"]
pub struct DMA1 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for DMA1 {}
impl DMA1 {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const dma1::RegisterBlock {
0x4002_0000 as *const _
}
}
impl Deref for DMA1 {
type Target = dma1::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*DMA1::ptr() }
}
}
#[doc = "Direct memory access controller"]
pub mod dma1;
#[doc = "Cyclic redundancy check calculation unit"]
pub struct CRC {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for CRC {}
impl CRC {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const crc::RegisterBlock {
0x4002_3000 as *const _
}
}
impl Deref for CRC {
type Target = crc::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*CRC::ptr() }
}
}
#[doc = "Cyclic redundancy check calculation unit"]
pub mod crc;
#[doc = "General-purpose I/Os"]
pub struct GPIOA {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for GPIOA {}
impl GPIOA {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const gpioa::RegisterBlock {
0x5000_0000 as *const _
}
}
impl Deref for GPIOA {
type Target = gpioa::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*GPIOA::ptr() }
}
}
#[doc = "General-purpose I/Os"]
pub mod gpioa;
#[doc = "General-purpose I/Os"]
pub struct GPIOB {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for GPIOB {}
impl GPIOB {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const gpiob::RegisterBlock {
0x5000_0400 as *const _
}
}
impl Deref for GPIOB {
type Target = gpiob::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*GPIOB::ptr() }
}
}
#[doc = "General-purpose I/Os"]
pub mod gpiob;
#[doc = "General-purpose I/Os"]
pub struct GPIOC {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for GPIOC {}
impl GPIOC {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const gpiob::RegisterBlock {
0x5000_0800 as *const _
}
}
impl Deref for GPIOC {
type Target = gpiob::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*GPIOC::ptr() }
}
}
#[doc = "General-purpose I/Os"]
pub struct GPIOD {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for GPIOD {}
impl GPIOD {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const gpiob::RegisterBlock {
0x5000_0c00 as *const _
}
}
impl Deref for GPIOD {
type Target = gpiob::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*GPIOD::ptr() }
}
}
#[doc = "General-purpose I/Os"]
pub struct GPIOH {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for GPIOH {}
impl GPIOH {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const gpiob::RegisterBlock {
0x5000_1c00 as *const _
}
}
impl Deref for GPIOH {
type Target = gpiob::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*GPIOH::ptr() }
}
}
#[doc = "General-purpose I/Os"]
pub struct GPIOE {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for GPIOE {}
impl GPIOE {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const gpiob::RegisterBlock {
0x5000_1000 as *const _
}
}
impl Deref for GPIOE {
type Target = gpiob::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*GPIOE::ptr() }
}
}
#[doc = "Low power timer"]
pub struct LPTIM {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for LPTIM {}
impl LPTIM {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const lptim::RegisterBlock {
0x4000_7c00 as *const _
}
}
impl Deref for LPTIM {
type Target = lptim::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*LPTIM::ptr() }
}
}
#[doc = "Low power timer"]
pub mod lptim;
#[doc = "Real-time clock"]
pub struct RTC {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for RTC {}
impl RTC {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const rtc::RegisterBlock {
0x4000_2800 as *const _
}
}
impl Deref for RTC {
type Target = rtc::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*RTC::ptr() }
}
}
#[doc = "Real-time clock"]
pub mod rtc;
#[doc = "Universal synchronous asynchronous receiver transmitter"]
pub struct USART1 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for USART1 {}
impl USART1 {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const usart1::RegisterBlock {
0x4001_3800 as *const _
}
}
impl Deref for USART1 {
type Target = usart1::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*USART1::ptr() }
}
}
#[doc = "Universal synchronous asynchronous receiver transmitter"]
pub mod usart1;
#[doc = "Universal synchronous asynchronous receiver transmitter"]
pub struct USART2 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for USART2 {}
impl USART2 {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const usart1::RegisterBlock {
0x4000_4400 as *const _
}
}
impl Deref for USART2 {
type Target = usart1::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*USART2::ptr() }
}
}
#[doc = "Universal synchronous asynchronous receiver transmitter"]
pub struct USART4 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for USART4 {}
impl USART4 {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const usart1::RegisterBlock {
0x4000_4c00 as *const _
}
}
impl Deref for USART4 {
type Target = usart1::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*USART4::ptr() }
}
}
#[doc = "Universal synchronous asynchronous receiver transmitter"]
pub struct USART5 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for USART5 {}
impl USART5 {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const usart1::RegisterBlock {
0x4000_5000 as *const _
}
}
impl Deref for USART5 {
type Target = usart1::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*USART5::ptr() }
}
}
#[doc = "Independent watchdog"]
pub struct IWDG {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for IWDG {}
impl IWDG {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const iwdg::RegisterBlock {
0x4000_3000 as *const _
}
}
impl Deref for IWDG {
type Target = iwdg::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*IWDG::ptr() }
}
}
#[doc = "Independent watchdog"]
pub mod iwdg;
#[doc = "System window watchdog"]
pub struct WWDG {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for WWDG {}
impl WWDG {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const wwdg::RegisterBlock {
0x4000_2c00 as *const _
}
}
impl Deref for WWDG {
type Target = wwdg::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*WWDG::ptr() }
}
}
#[doc = "System window watchdog"]
pub mod wwdg;
#[doc = "Firewall"]
pub struct FW {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for FW {}
impl FW {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const fw::RegisterBlock {
0x4001_1c00 as *const _
}
}
impl Deref for FW {
type Target = fw::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*FW::ptr() }
}
}
#[doc = "Firewall"]
pub mod fw;
#[doc = "Reset and clock control"]
pub struct RCC {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for RCC {}
impl RCC {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const rcc::RegisterBlock {
0x4002_1000 as *const _
}
}
impl Deref for RCC {
type Target = rcc::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*RCC::ptr() }
}
}
#[doc = "Reset and clock control"]
pub mod rcc;
#[doc = "System configuration controller and COMP register"]
pub struct SYSCFG {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for SYSCFG {}
impl SYSCFG {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const syscfg::RegisterBlock {
0x4001_0000 as *const _
}
}
impl Deref for SYSCFG {
type Target = syscfg::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*SYSCFG::ptr() }
}
}
#[doc = "System configuration controller and COMP register"]
pub mod syscfg;
#[doc = "Serial peripheral interface"]
pub struct SPI1 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for SPI1 {}
impl SPI1 {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const spi1::RegisterBlock {
0x4001_3000 as *const _
}
}
impl Deref for SPI1 {
type Target = spi1::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*SPI1::ptr() }
}
}
#[doc = "Serial peripheral interface"]
pub mod spi1;
#[doc = "Serial peripheral interface"]
pub struct SPI2 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for SPI2 {}
impl SPI2 {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const spi1::RegisterBlock {
0x4000_3800 as *const _
}
}
impl Deref for SPI2 {
type Target = spi1::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*SPI2::ptr() }
}
}
#[doc = "Inter-integrated circuit"]
pub struct I2C1 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for I2C1 {}
impl I2C1 {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const i2c1::RegisterBlock {
0x4000_5400 as *const _
}
}
impl Deref for I2C1 {
type Target = i2c1::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*I2C1::ptr() }
}
}
#[doc = "Inter-integrated circuit"]
pub mod i2c1;
#[doc = "Inter-integrated circuit"]
pub struct I2C2 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for I2C2 {}
impl I2C2 {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const i2c1::RegisterBlock {
0x4000_5800 as *const _
}
}
impl Deref for I2C2 {
type Target = i2c1::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*I2C2::ptr() }
}
}
#[doc = "Inter-integrated circuit"]
pub struct I2C3 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for I2C3 {}
impl I2C3 {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const i2c1::RegisterBlock {
0x4000_7800 as *const _
}
}
impl Deref for I2C3 {
type Target = i2c1::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*I2C3::ptr() }
}
}
#[doc = "Power control"]
pub struct PWR {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for PWR {}
impl PWR {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const pwr::RegisterBlock {
0x4000_7000 as *const _
}
}
impl Deref for PWR {
type Target = pwr::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*PWR::ptr() }
}
}
#[doc = "Power control"]
pub mod pwr;
#[doc = "Flash"]
pub struct FLASH {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for FLASH {}
impl FLASH {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const flash::RegisterBlock {
0x4002_2000 as *const _
}
}
impl Deref for FLASH {
type Target = flash::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*FLASH::ptr() }
}
}
#[doc = "Flash"]
pub mod flash;
#[doc = "External interrupt/event controller"]
pub struct EXTI {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for EXTI {}
impl EXTI {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const exti::RegisterBlock {
0x4001_0400 as *const _
}
}
impl Deref for EXTI {
type Target = exti::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*EXTI::ptr() }
}
}
#[doc = "External interrupt/event controller"]
pub mod exti;
#[doc = "Analog-to-digital converter"]
pub struct ADC {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for ADC {}
impl ADC {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const adc::RegisterBlock {
0x4001_2400 as *const _
}
}
impl Deref for ADC {
type Target = adc::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*ADC::ptr() }
}
}
#[doc = "Analog-to-digital converter"]
pub mod adc;
#[doc = "Debug support"]
pub struct DBG {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for DBG {}
impl DBG {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const dbg::RegisterBlock {
0x4001_5800 as *const _
}
}
impl Deref for DBG {
type Target = dbg::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*DBG::ptr() }
}
}
#[doc = "Debug support"]
pub mod dbg;
#[doc = "General-purpose-timers"]
pub struct TIM2 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for TIM2 {}
impl TIM2 {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const tim2::RegisterBlock {
0x4000_0000 as *const _
}
}
impl Deref for TIM2 {
type Target = tim2::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*TIM2::ptr() }
}
}
#[doc = "General-purpose-timers"]
pub mod tim2;
#[doc = "General-purpose-timers"]
pub struct TIM3 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for TIM3 {}
impl TIM3 {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const tim2::RegisterBlock {
0x4000_0400 as *const _
}
}
impl Deref for TIM3 {
type Target = tim2::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*TIM3::ptr() }
}
}
#[doc = "Basic-timers"]
pub struct TIM6 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for TIM6 {}
impl TIM6 {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const tim6::RegisterBlock {
0x4000_1000 as *const _
}
}
impl Deref for TIM6 {
type Target = tim6::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*TIM6::ptr() }
}
}
#[doc = "Basic-timers"]
pub mod tim6;
#[doc = "Basic-timers"]
pub struct TIM7 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for TIM7 {}
impl TIM7 {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const tim6::RegisterBlock {
0x4000_1400 as *const _
}
}
impl Deref for TIM7 {
type Target = tim6::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*TIM7::ptr() }
}
}
#[doc = "General-purpose-timers"]
pub struct TIM21 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for TIM21 {}
impl TIM21 {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const tim21::RegisterBlock {
0x4001_0800 as *const _
}
}
impl Deref for TIM21 {
type Target = tim21::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*TIM21::ptr() }
}
}
#[doc = "General-purpose-timers"]
pub mod tim21;
#[doc = "General-purpose-timers"]
pub struct TIM22 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for TIM22 {}
impl TIM22 {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const tim22::RegisterBlock {
0x4001_1400 as *const _
}
}
impl Deref for TIM22 {
type Target = tim22::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*TIM22::ptr() }
}
}
#[doc = "General-purpose-timers"]
pub mod tim22;
#[doc = "Lower power Universal asynchronous receiver transmitter"]
pub struct LPUART1 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for LPUART1 {}
impl LPUART1 {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const lpuart1::RegisterBlock {
0x4000_4800 as *const _
}
}
impl Deref for LPUART1 {
type Target = lpuart1::RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*LPUART1::ptr() }
}
}
#[doc = "Lower power Universal asynchronous receiver transmitter"]
pub mod lpuart1;
#[no_mangle]
static mut DEVICE_PERIPHERALS: bool = false;
#[doc = r"All the peripherals"]
#[allow(non_snake_case)]
pub struct Peripherals {
#[doc = "AES"]
pub AES: AES,
#[doc = "DMA1"]
pub DMA1: DMA1,
#[doc = "CRC"]
pub CRC: CRC,
#[doc = "GPIOA"]
pub GPIOA: GPIOA,
#[doc = "GPIOB"]
pub GPIOB: GPIOB,
#[doc = "GPIOC"]
pub GPIOC: GPIOC,
#[doc = "GPIOD"]
pub GPIOD: GPIOD,
#[doc = "GPIOH"]
pub GPIOH: GPIOH,
#[doc = "GPIOE"]
pub GPIOE: GPIOE,
#[doc = "LPTIM"]
pub LPTIM: LPTIM,
#[doc = "RTC"]
pub RTC: RTC,
#[doc = "USART1"]
pub USART1: USART1,
#[doc = "USART2"]
pub USART2: USART2,
#[doc = "USART4"]
pub USART4: USART4,
#[doc = "USART5"]
pub USART5: USART5,
#[doc = "IWDG"]
pub IWDG: IWDG,
#[doc = "WWDG"]
pub WWDG: WWDG,
#[doc = "FW"]
pub FW: FW,
#[doc = "RCC"]
pub RCC: RCC,
#[doc = "SYSCFG"]
pub SYSCFG: SYSCFG,
#[doc = "SPI1"]
pub SPI1: SPI1,
#[doc = "SPI2"]
pub SPI2: SPI2,
#[doc = "I2C1"]
pub I2C1: I2C1,
#[doc = "I2C2"]
pub I2C2: I2C2,
#[doc = "I2C3"]
pub I2C3: I2C3,
#[doc = "PWR"]
pub PWR: PWR,
#[doc = "FLASH"]
pub FLASH: FLASH,
#[doc = "EXTI"]
pub EXTI: EXTI,
#[doc = "ADC"]
pub ADC: ADC,
#[doc = "DBG"]
pub DBG: DBG,
#[doc = "TIM2"]
pub TIM2: TIM2,
#[doc = "TIM3"]
pub TIM3: TIM3,
#[doc = "TIM6"]
pub TIM6: TIM6,
#[doc = "TIM7"]
pub TIM7: TIM7,
#[doc = "TIM21"]
pub TIM21: TIM21,
#[doc = "TIM22"]
pub TIM22: TIM22,
#[doc = "LPUART1"]
pub LPUART1: LPUART1,
}
impl Peripherals {
#[doc = r"Returns all the peripherals *once*"]
#[inline]
pub fn take() -> Option<Self> {
cortex_m::interrupt::free(|_| {
if unsafe { DEVICE_PERIPHERALS } {
None
} else {
Some(unsafe { Peripherals::steal() })
}
})
}
#[doc = r"Unchecked version of `Peripherals::take`"]
pub unsafe fn steal() -> Self {
DEVICE_PERIPHERALS = true;
Peripherals {
AES: AES {
_marker: PhantomData,
},
DMA1: DMA1 {
_marker: PhantomData,
},
CRC: CRC {
_marker: PhantomData,
},
GPIOA: GPIOA {
_marker: PhantomData,
},
GPIOB: GPIOB {
_marker: PhantomData,
},
GPIOC: GPIOC {
_marker: PhantomData,
},
GPIOD: GPIOD {
_marker: PhantomData,
},
GPIOH: GPIOH {
_marker: PhantomData,
},
GPIOE: GPIOE {
_marker: PhantomData,
},
LPTIM: LPTIM {
_marker: PhantomData,
},
RTC: RTC {
_marker: PhantomData,
},
USART1: USART1 {
_marker: PhantomData,
},
USART2: USART2 {
_marker: PhantomData,
},
USART4: USART4 {
_marker: PhantomData,
},
USART5: USART5 {
_marker: PhantomData,
},
IWDG: IWDG {
_marker: PhantomData,
},
WWDG: WWDG {
_marker: PhantomData,
},
FW: FW {
_marker: PhantomData,
},
RCC: RCC {
_marker: PhantomData,
},
SYSCFG: SYSCFG {
_marker: PhantomData,
},
SPI1: SPI1 {
_marker: PhantomData,
},
SPI2: SPI2 {
_marker: PhantomData,
},
I2C1: I2C1 {
_marker: PhantomData,
},
I2C2: I2C2 {
_marker: PhantomData,
},
I2C3: I2C3 {
_marker: PhantomData,
},
PWR: PWR {
_marker: PhantomData,
},
FLASH: FLASH {
_marker: PhantomData,
},
EXTI: EXTI {
_marker: PhantomData,
},
ADC: ADC {
_marker: PhantomData,
},
DBG: DBG {
_marker: PhantomData,
},
TIM2: TIM2 {
_marker: PhantomData,
},
TIM3: TIM3 {
_marker: PhantomData,
},
TIM6: TIM6 {
_marker: PhantomData,
},
TIM7: TIM7 {
_marker: PhantomData,
},
TIM21: TIM21 {
_marker: PhantomData,
},
TIM22: TIM22 {
_marker: PhantomData,
},
LPUART1: LPUART1 {
_marker: PhantomData,
},
}
}
}