use core::marker::PhantomData;
use core::ops::Deref;
pub const NVIC_PRIO_BITS: u8 = 4;
#[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;
#[cfg(feature = "rt")]
extern "C" {
fn WWDG();
fn PVD();
fn RTC();
fn FLASH();
fn RCC_CTC();
fn EXTI0_1();
fn EXTI2_3();
fn EXTI4_15();
fn LCD();
fn DMA1_CHANNEL1();
fn DMA1_CHANNEL2_3();
fn DMA1_CHANNEL4_5_6_7();
fn ADC_COMP();
fn TIM1_BRK_UP_TRG_COM();
fn TIM1_CC();
fn TIM2();
fn TIM3();
fn TIM6_LPTIM1();
fn TIM7();
fn TIM14();
fn TIM15();
fn TIM16();
fn TIM17();
fn I2C1();
fn I2C2();
fn SPI1();
fn SPI2();
fn USART1();
fn USART2();
fn USART3_4();
}
#[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_CTC },
Vector { _handler: EXTI0_1 },
Vector { _handler: EXTI2_3 },
Vector { _handler: EXTI4_15 },
Vector { _handler: LCD },
Vector {
_handler: DMA1_CHANNEL1,
},
Vector {
_handler: DMA1_CHANNEL2_3,
},
Vector {
_handler: DMA1_CHANNEL4_5_6_7,
},
Vector { _handler: ADC_COMP },
Vector {
_handler: TIM1_BRK_UP_TRG_COM,
},
Vector { _handler: TIM1_CC },
Vector { _handler: TIM2 },
Vector { _handler: TIM3 },
Vector {
_handler: TIM6_LPTIM1,
},
Vector { _handler: TIM7 },
Vector { _handler: TIM14 },
Vector { _handler: TIM15 },
Vector { _handler: TIM16 },
Vector { _handler: TIM17 },
Vector { _handler: I2C1 },
Vector { _handler: I2C2 },
Vector { _handler: SPI1 },
Vector { _handler: SPI2 },
Vector { _handler: USART1 },
Vector { _handler: USART2 },
Vector { _handler: USART3_4 },
];
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[repr(u16)]
pub enum Interrupt {
WWDG = 0,
PVD = 1,
RTC = 2,
FLASH = 3,
RCC_CTC = 4,
EXTI0_1 = 5,
EXTI2_3 = 6,
EXTI4_15 = 7,
LCD = 8,
DMA1_CHANNEL1 = 9,
DMA1_CHANNEL2_3 = 10,
DMA1_CHANNEL4_5_6_7 = 11,
ADC_COMP = 12,
TIM1_BRK_UP_TRG_COM = 13,
TIM1_CC = 14,
TIM2 = 15,
TIM3 = 16,
TIM6_LPTIM1 = 17,
TIM7 = 18,
TIM14 = 19,
TIM15 = 20,
TIM16 = 21,
TIM17 = 22,
I2C1 = 23,
I2C2 = 24,
SPI1 = 25,
SPI2 = 26,
USART1 = 27,
USART2 = 28,
USART3_4 = 29,
}
unsafe impl cortex_m::interrupt::InterruptNumber for Interrupt {
#[inline(always)]
fn number(self) -> u16 {
self as u16
}
}
pub struct ADC {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for ADC {}
impl ADC {
pub const PTR: *const adc::RegisterBlock = 0x4001_2400 as *const _;
#[inline(always)]
pub const fn ptr() -> *const adc::RegisterBlock {
Self::PTR
}
}
impl Deref for ADC {
type Target = adc::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for ADC {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("ADC").finish()
}
}
pub mod adc;
pub struct COMP1 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for COMP1 {}
impl COMP1 {
pub const PTR: *const comp1::RegisterBlock = 0x4001_0200 as *const _;
#[inline(always)]
pub const fn ptr() -> *const comp1::RegisterBlock {
Self::PTR
}
}
impl Deref for COMP1 {
type Target = comp1::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for COMP1 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("COMP1").finish()
}
}
pub mod comp1;
pub struct COMP2 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for COMP2 {}
impl COMP2 {
pub const PTR: *const comp2::RegisterBlock = 0x4001_0210 as *const _;
#[inline(always)]
pub const fn ptr() -> *const comp2::RegisterBlock {
Self::PTR
}
}
impl Deref for COMP2 {
type Target = comp2::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for COMP2 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("COMP2").finish()
}
}
pub mod comp2;
pub struct CRC {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for CRC {}
impl CRC {
pub const PTR: *const crc::RegisterBlock = 0x4002_3000 as *const _;
#[inline(always)]
pub const fn ptr() -> *const crc::RegisterBlock {
Self::PTR
}
}
impl Deref for CRC {
type Target = crc::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for CRC {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CRC").finish()
}
}
pub mod crc;
pub struct CTC {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for CTC {}
impl CTC {
pub const PTR: *const ctc::RegisterBlock = 0x4000_6c00 as *const _;
#[inline(always)]
pub const fn ptr() -> *const ctc::RegisterBlock {
Self::PTR
}
}
impl Deref for CTC {
type Target = ctc::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for CTC {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CTC").finish()
}
}
pub mod ctc;
pub struct DBG {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for DBG {}
impl DBG {
pub const PTR: *const dbg::RegisterBlock = 0x4001_5800 as *const _;
#[inline(always)]
pub const fn ptr() -> *const dbg::RegisterBlock {
Self::PTR
}
}
impl Deref for DBG {
type Target = dbg::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for DBG {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("DBG").finish()
}
}
pub mod dbg;
pub struct DIV {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for DIV {}
impl DIV {
pub const PTR: *const div::RegisterBlock = 0x4002_3800 as *const _;
#[inline(always)]
pub const fn ptr() -> *const div::RegisterBlock {
Self::PTR
}
}
impl Deref for DIV {
type Target = div::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for DIV {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("DIV").finish()
}
}
pub mod div;
pub struct DMA {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for DMA {}
impl DMA {
pub const PTR: *const dma::RegisterBlock = 0x4002_0000 as *const _;
#[inline(always)]
pub const fn ptr() -> *const dma::RegisterBlock {
Self::PTR
}
}
impl Deref for DMA {
type Target = dma::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for DMA {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("DMA").finish()
}
}
pub mod dma;
pub struct EXTI {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for EXTI {}
impl EXTI {
pub const PTR: *const exti::RegisterBlock = 0x4002_1800 as *const _;
#[inline(always)]
pub const fn ptr() -> *const exti::RegisterBlock {
Self::PTR
}
}
impl Deref for EXTI {
type Target = exti::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for EXTI {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("EXTI").finish()
}
}
pub mod exti;
pub struct FLASH {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for FLASH {}
impl FLASH {
pub const PTR: *const flash::RegisterBlock = 0x4002_2000 as *const _;
#[inline(always)]
pub const fn ptr() -> *const flash::RegisterBlock {
Self::PTR
}
}
impl Deref for FLASH {
type Target = flash::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for FLASH {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("FLASH").finish()
}
}
pub mod flash;
pub struct GPIOA {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for GPIOA {}
impl GPIOA {
pub const PTR: *const gpioa::RegisterBlock = 0x5000_0000 as *const _;
#[inline(always)]
pub const fn ptr() -> *const gpioa::RegisterBlock {
Self::PTR
}
}
impl Deref for GPIOA {
type Target = gpioa::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for GPIOA {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("GPIOA").finish()
}
}
pub mod gpioa;
pub struct GPIOB {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for GPIOB {}
impl GPIOB {
pub const PTR: *const gpioa::RegisterBlock = 0x5000_0400 as *const _;
#[inline(always)]
pub const fn ptr() -> *const gpioa::RegisterBlock {
Self::PTR
}
}
impl Deref for GPIOB {
type Target = gpioa::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for GPIOB {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("GPIOB").finish()
}
}
pub use self::gpioa as gpiob;
pub struct GPIOC {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for GPIOC {}
impl GPIOC {
pub const PTR: *const gpioa::RegisterBlock = 0x5000_0800 as *const _;
#[inline(always)]
pub const fn ptr() -> *const gpioa::RegisterBlock {
Self::PTR
}
}
impl Deref for GPIOC {
type Target = gpioa::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for GPIOC {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("GPIOC").finish()
}
}
pub use self::gpioa as gpioc;
pub struct GPIOF {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for GPIOF {}
impl GPIOF {
pub const PTR: *const gpioa::RegisterBlock = 0x5000_1400 as *const _;
#[inline(always)]
pub const fn ptr() -> *const gpioa::RegisterBlock {
Self::PTR
}
}
impl Deref for GPIOF {
type Target = gpioa::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for GPIOF {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("GPIOF").finish()
}
}
pub use self::gpioa as gpiof;
pub struct I2C1 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for I2C1 {}
impl I2C1 {
pub const PTR: *const i2c1::RegisterBlock = 0x4000_5400 as *const _;
#[inline(always)]
pub const fn ptr() -> *const i2c1::RegisterBlock {
Self::PTR
}
}
impl Deref for I2C1 {
type Target = i2c1::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for I2C1 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("I2C1").finish()
}
}
pub mod i2c1;
pub struct I2C2 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for I2C2 {}
impl I2C2 {
pub const PTR: *const i2c1::RegisterBlock = 0x4000_5800 as *const _;
#[inline(always)]
pub const fn ptr() -> *const i2c1::RegisterBlock {
Self::PTR
}
}
impl Deref for I2C2 {
type Target = i2c1::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for I2C2 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("I2C2").finish()
}
}
pub use self::i2c1 as i2c2;
pub struct IWDG {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for IWDG {}
impl IWDG {
pub const PTR: *const iwdg::RegisterBlock = 0x4000_3000 as *const _;
#[inline(always)]
pub const fn ptr() -> *const iwdg::RegisterBlock {
Self::PTR
}
}
impl Deref for IWDG {
type Target = iwdg::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for IWDG {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("IWDG").finish()
}
}
pub mod iwdg;
pub struct LCD {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for LCD {}
impl LCD {
pub const PTR: *const lcd::RegisterBlock = 0x4000_2400 as *const _;
#[inline(always)]
pub const fn ptr() -> *const lcd::RegisterBlock {
Self::PTR
}
}
impl Deref for LCD {
type Target = lcd::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for LCD {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("LCD").finish()
}
}
pub mod lcd;
pub struct LPTIM1 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for LPTIM1 {}
impl LPTIM1 {
pub const PTR: *const lptim1::RegisterBlock = 0x4000_7c00 as *const _;
#[inline(always)]
pub const fn ptr() -> *const lptim1::RegisterBlock {
Self::PTR
}
}
impl Deref for LPTIM1 {
type Target = lptim1::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for LPTIM1 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("LPTIM1").finish()
}
}
pub mod lptim1;
pub struct OPA {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for OPA {}
impl OPA {
pub const PTR: *const opa::RegisterBlock = 0x4001_0300 as *const _;
#[inline(always)]
pub const fn ptr() -> *const opa::RegisterBlock {
Self::PTR
}
}
impl Deref for OPA {
type Target = opa::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for OPA {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("OPA").finish()
}
}
pub mod opa;
pub struct PWR {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for PWR {}
impl PWR {
pub const PTR: *const pwr::RegisterBlock = 0x4000_7000 as *const _;
#[inline(always)]
pub const fn ptr() -> *const pwr::RegisterBlock {
Self::PTR
}
}
impl Deref for PWR {
type Target = pwr::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for PWR {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("PWR").finish()
}
}
pub mod pwr;
pub struct RCC {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for RCC {}
impl RCC {
pub const PTR: *const rcc::RegisterBlock = 0x4002_1000 as *const _;
#[inline(always)]
pub const fn ptr() -> *const rcc::RegisterBlock {
Self::PTR
}
}
impl Deref for RCC {
type Target = rcc::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for RCC {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RCC").finish()
}
}
pub mod rcc;
pub struct RTC {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for RTC {}
impl RTC {
pub const PTR: *const rtc::RegisterBlock = 0x4000_2800 as *const _;
#[inline(always)]
pub const fn ptr() -> *const rtc::RegisterBlock {
Self::PTR
}
}
impl Deref for RTC {
type Target = rtc::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for RTC {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RTC").finish()
}
}
pub mod rtc;
pub struct SPI1 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for SPI1 {}
impl SPI1 {
pub const PTR: *const spi1::RegisterBlock = 0x4001_3000 as *const _;
#[inline(always)]
pub const fn ptr() -> *const spi1::RegisterBlock {
Self::PTR
}
}
impl Deref for SPI1 {
type Target = spi1::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for SPI1 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("SPI1").finish()
}
}
pub mod spi1;
pub struct SPI2 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for SPI2 {}
impl SPI2 {
pub const PTR: *const spi1::RegisterBlock = 0x4000_3800 as *const _;
#[inline(always)]
pub const fn ptr() -> *const spi1::RegisterBlock {
Self::PTR
}
}
impl Deref for SPI2 {
type Target = spi1::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for SPI2 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("SPI2").finish()
}
}
pub use self::spi1 as spi2;
pub struct SYSCFG {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for SYSCFG {}
impl SYSCFG {
pub const PTR: *const syscfg::RegisterBlock = 0x4001_0000 as *const _;
#[inline(always)]
pub const fn ptr() -> *const syscfg::RegisterBlock {
Self::PTR
}
}
impl Deref for SYSCFG {
type Target = syscfg::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for SYSCFG {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("SYSCFG").finish()
}
}
pub mod syscfg;
pub struct TIM1 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for TIM1 {}
impl TIM1 {
pub const PTR: *const tim1::RegisterBlock = 0x4001_2c00 as *const _;
#[inline(always)]
pub const fn ptr() -> *const tim1::RegisterBlock {
Self::PTR
}
}
impl Deref for TIM1 {
type Target = tim1::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for TIM1 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("TIM1").finish()
}
}
pub mod tim1;
pub struct TIM2 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for TIM2 {}
impl TIM2 {
pub const PTR: *const tim2::RegisterBlock = 0x4000_0000 as *const _;
#[inline(always)]
pub const fn ptr() -> *const tim2::RegisterBlock {
Self::PTR
}
}
impl Deref for TIM2 {
type Target = tim2::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for TIM2 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("TIM2").finish()
}
}
pub mod tim2;
pub struct TIM3 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for TIM3 {}
impl TIM3 {
pub const PTR: *const tim3::RegisterBlock = 0x4000_0400 as *const _;
#[inline(always)]
pub const fn ptr() -> *const tim3::RegisterBlock {
Self::PTR
}
}
impl Deref for TIM3 {
type Target = tim3::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for TIM3 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("TIM3").finish()
}
}
pub mod tim3;
pub struct TIM6 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for TIM6 {}
impl TIM6 {
pub const PTR: *const tim6::RegisterBlock = 0x4000_1000 as *const _;
#[inline(always)]
pub const fn ptr() -> *const tim6::RegisterBlock {
Self::PTR
}
}
impl Deref for TIM6 {
type Target = tim6::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for TIM6 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("TIM6").finish()
}
}
pub mod tim6;
pub struct TIM7 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for TIM7 {}
impl TIM7 {
pub const PTR: *const tim6::RegisterBlock = 0x4000_1400 as *const _;
#[inline(always)]
pub const fn ptr() -> *const tim6::RegisterBlock {
Self::PTR
}
}
impl Deref for TIM7 {
type Target = tim6::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for TIM7 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("TIM7").finish()
}
}
pub use self::tim6 as tim7;
pub struct TIM14 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for TIM14 {}
impl TIM14 {
pub const PTR: *const tim14::RegisterBlock = 0x4000_2000 as *const _;
#[inline(always)]
pub const fn ptr() -> *const tim14::RegisterBlock {
Self::PTR
}
}
impl Deref for TIM14 {
type Target = tim14::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for TIM14 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("TIM14").finish()
}
}
pub mod tim14;
pub struct TIM15 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for TIM15 {}
impl TIM15 {
pub const PTR: *const tim15::RegisterBlock = 0x4001_4000 as *const _;
#[inline(always)]
pub const fn ptr() -> *const tim15::RegisterBlock {
Self::PTR
}
}
impl Deref for TIM15 {
type Target = tim15::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for TIM15 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("TIM15").finish()
}
}
pub mod tim15;
pub struct TIM16 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for TIM16 {}
impl TIM16 {
pub const PTR: *const tim16::RegisterBlock = 0x4001_4400 as *const _;
#[inline(always)]
pub const fn ptr() -> *const tim16::RegisterBlock {
Self::PTR
}
}
impl Deref for TIM16 {
type Target = tim16::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for TIM16 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("TIM16").finish()
}
}
pub mod tim16;
pub struct TIM17 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for TIM17 {}
impl TIM17 {
pub const PTR: *const tim16::RegisterBlock = 0x4001_4800 as *const _;
#[inline(always)]
pub const fn ptr() -> *const tim16::RegisterBlock {
Self::PTR
}
}
impl Deref for TIM17 {
type Target = tim16::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for TIM17 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("TIM17").finish()
}
}
pub use self::tim16 as tim17;
pub struct USART1 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for USART1 {}
impl USART1 {
pub const PTR: *const usart1::RegisterBlock = 0x4001_3800 as *const _;
#[inline(always)]
pub const fn ptr() -> *const usart1::RegisterBlock {
Self::PTR
}
}
impl Deref for USART1 {
type Target = usart1::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for USART1 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("USART1").finish()
}
}
pub mod usart1;
pub struct USART2 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for USART2 {}
impl USART2 {
pub const PTR: *const usart1::RegisterBlock = 0x4000_4400 as *const _;
#[inline(always)]
pub const fn ptr() -> *const usart1::RegisterBlock {
Self::PTR
}
}
impl Deref for USART2 {
type Target = usart1::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for USART2 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("USART2").finish()
}
}
pub use self::usart1 as usart2;
pub struct USART3 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for USART3 {}
impl USART3 {
pub const PTR: *const usart1::RegisterBlock = 0x4000_4800 as *const _;
#[inline(always)]
pub const fn ptr() -> *const usart1::RegisterBlock {
Self::PTR
}
}
impl Deref for USART3 {
type Target = usart1::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for USART3 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("USART3").finish()
}
}
pub use self::usart1 as usart3;
pub struct USART4 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for USART4 {}
impl USART4 {
pub const PTR: *const usart1::RegisterBlock = 0x4000_4c00 as *const _;
#[inline(always)]
pub const fn ptr() -> *const usart1::RegisterBlock {
Self::PTR
}
}
impl Deref for USART4 {
type Target = usart1::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for USART4 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("USART4").finish()
}
}
pub use self::usart1 as usart4;
pub struct WWDG {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for WWDG {}
impl WWDG {
pub const PTR: *const wwdg::RegisterBlock = 0x4000_2c00 as *const _;
#[inline(always)]
pub const fn ptr() -> *const wwdg::RegisterBlock {
Self::PTR
}
}
impl Deref for WWDG {
type Target = wwdg::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for WWDG {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("WWDG").finish()
}
}
pub mod wwdg;
#[no_mangle]
static mut DEVICE_PERIPHERALS: bool = false;
#[allow(non_snake_case)]
pub struct Peripherals {
pub ADC: ADC,
pub COMP1: COMP1,
pub COMP2: COMP2,
pub CRC: CRC,
pub CTC: CTC,
pub DBG: DBG,
pub DIV: DIV,
pub DMA: DMA,
pub EXTI: EXTI,
pub FLASH: FLASH,
pub GPIOA: GPIOA,
pub GPIOB: GPIOB,
pub GPIOC: GPIOC,
pub GPIOF: GPIOF,
pub I2C1: I2C1,
pub I2C2: I2C2,
pub IWDG: IWDG,
pub LCD: LCD,
pub LPTIM1: LPTIM1,
pub OPA: OPA,
pub PWR: PWR,
pub RCC: RCC,
pub RTC: RTC,
pub SPI1: SPI1,
pub SPI2: SPI2,
pub SYSCFG: SYSCFG,
pub TIM1: TIM1,
pub TIM2: TIM2,
pub TIM3: TIM3,
pub TIM6: TIM6,
pub TIM7: TIM7,
pub TIM14: TIM14,
pub TIM15: TIM15,
pub TIM16: TIM16,
pub TIM17: TIM17,
pub USART1: USART1,
pub USART2: USART2,
pub USART3: USART3,
pub USART4: USART4,
pub WWDG: WWDG,
}
impl Peripherals {
#[cfg(feature = "critical-section")]
#[inline]
pub fn take() -> Option<Self> {
critical_section::with(|_| {
if unsafe { DEVICE_PERIPHERALS } {
return None;
}
Some(unsafe { Peripherals::steal() })
})
}
#[inline]
pub unsafe fn steal() -> Self {
DEVICE_PERIPHERALS = true;
Peripherals {
ADC: ADC {
_marker: PhantomData,
},
COMP1: COMP1 {
_marker: PhantomData,
},
COMP2: COMP2 {
_marker: PhantomData,
},
CRC: CRC {
_marker: PhantomData,
},
CTC: CTC {
_marker: PhantomData,
},
DBG: DBG {
_marker: PhantomData,
},
DIV: DIV {
_marker: PhantomData,
},
DMA: DMA {
_marker: PhantomData,
},
EXTI: EXTI {
_marker: PhantomData,
},
FLASH: FLASH {
_marker: PhantomData,
},
GPIOA: GPIOA {
_marker: PhantomData,
},
GPIOB: GPIOB {
_marker: PhantomData,
},
GPIOC: GPIOC {
_marker: PhantomData,
},
GPIOF: GPIOF {
_marker: PhantomData,
},
I2C1: I2C1 {
_marker: PhantomData,
},
I2C2: I2C2 {
_marker: PhantomData,
},
IWDG: IWDG {
_marker: PhantomData,
},
LCD: LCD {
_marker: PhantomData,
},
LPTIM1: LPTIM1 {
_marker: PhantomData,
},
OPA: OPA {
_marker: PhantomData,
},
PWR: PWR {
_marker: PhantomData,
},
RCC: RCC {
_marker: PhantomData,
},
RTC: RTC {
_marker: PhantomData,
},
SPI1: SPI1 {
_marker: PhantomData,
},
SPI2: SPI2 {
_marker: PhantomData,
},
SYSCFG: SYSCFG {
_marker: PhantomData,
},
TIM1: TIM1 {
_marker: PhantomData,
},
TIM2: TIM2 {
_marker: PhantomData,
},
TIM3: TIM3 {
_marker: PhantomData,
},
TIM6: TIM6 {
_marker: PhantomData,
},
TIM7: TIM7 {
_marker: PhantomData,
},
TIM14: TIM14 {
_marker: PhantomData,
},
TIM15: TIM15 {
_marker: PhantomData,
},
TIM16: TIM16 {
_marker: PhantomData,
},
TIM17: TIM17 {
_marker: PhantomData,
},
USART1: USART1 {
_marker: PhantomData,
},
USART2: USART2 {
_marker: PhantomData,
},
USART3: USART3 {
_marker: PhantomData,
},
USART4: USART4 {
_marker: PhantomData,
},
WWDG: WWDG {
_marker: PhantomData,
},
}
}
}