pub const NVIC_PRIO_BITS: u8 = 2;
#[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_STAMP();
fn FLASH();
fn RCC();
fn EXTI0_1();
fn EXTI2_3();
fn EXTI4_15();
fn UCPD1_UCPD2();
fn DMA1_CHANNEL1();
fn DMA1_CHANNEL2_3();
fn DMA1_CHANNEL4_5_6_7_DMAMUX();
fn ADC_COMP();
fn TIM1_BRK_UP_TRG_COM();
fn TIM1_CC();
fn TIM2();
fn TIM3();
fn TIM6_DAC_LPTIM1();
fn TIM7_LPTIM2();
fn TIM14();
fn TIM15();
fn TIM16();
fn TIM17();
fn I2C1();
fn I2C2();
fn SPI1();
fn SPI2();
fn USART1();
fn USART2();
fn USART3_USART4_LPUART1();
fn CEC();
fn AES_RNG();
}
#[doc(hidden)]
#[repr(C)]
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; 32] = [
Vector { _handler: WWDG },
Vector { _handler: PVD },
Vector {
_handler: RTC_STAMP,
},
Vector { _handler: FLASH },
Vector { _handler: RCC },
Vector { _handler: EXTI0_1 },
Vector { _handler: EXTI2_3 },
Vector { _handler: EXTI4_15 },
Vector {
_handler: UCPD1_UCPD2,
},
Vector {
_handler: DMA1_CHANNEL1,
},
Vector {
_handler: DMA1_CHANNEL2_3,
},
Vector {
_handler: DMA1_CHANNEL4_5_6_7_DMAMUX,
},
Vector { _handler: ADC_COMP },
Vector {
_handler: TIM1_BRK_UP_TRG_COM,
},
Vector { _handler: TIM1_CC },
Vector { _handler: TIM2 },
Vector { _handler: TIM3 },
Vector {
_handler: TIM6_DAC_LPTIM1,
},
Vector {
_handler: TIM7_LPTIM2,
},
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_USART4_LPUART1,
},
Vector { _handler: CEC },
Vector { _handler: AES_RNG },
];
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[repr(u16)]
pub enum Interrupt {
WWDG = 0,
PVD = 1,
RTC_STAMP = 2,
FLASH = 3,
RCC = 4,
EXTI0_1 = 5,
EXTI2_3 = 6,
EXTI4_15 = 7,
UCPD1_UCPD2 = 8,
DMA1_CHANNEL1 = 9,
DMA1_CHANNEL2_3 = 10,
DMA1_CHANNEL4_5_6_7_DMAMUX = 11,
ADC_COMP = 12,
TIM1_BRK_UP_TRG_COM = 13,
TIM1_CC = 14,
TIM2 = 15,
TIM3 = 16,
TIM6_DAC_LPTIM1 = 17,
TIM7_LPTIM2 = 18,
TIM14 = 19,
TIM15 = 20,
TIM16 = 21,
TIM17 = 22,
I2C1 = 23,
I2C2 = 24,
SPI1 = 25,
SPI2 = 26,
USART1 = 27,
USART2 = 28,
USART3_USART4_LPUART1 = 29,
CEC = 30,
AES_RNG = 31,
}
unsafe impl cortex_m::interrupt::InterruptNumber for Interrupt {
#[inline(always)]
fn number(self) -> u16 {
self as u16
}
}
pub type IWDG = crate::Periph<iwdg::RegisterBlock, 0x4000_3000>;
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 type WWDG = crate::Periph<wwdg::RegisterBlock, 0x4000_2c00>;
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;
pub type FLASH = crate::Periph<flash::RegisterBlock, 0x4002_2000>;
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 type DBG = crate::Periph<dbg::RegisterBlock, 0x4001_5800>;
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 type RCC = crate::Periph<rcc::RegisterBlock, 0x4002_1000>;
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 type PWR = crate::Periph<pwr::RegisterBlock, 0x4000_7000>;
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 type DMA1 = crate::Periph<dma1::RegisterBlock, 0x4002_0000>;
impl core::fmt::Debug for DMA1 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("DMA1").finish()
}
}
pub mod dma1;
pub type DMAMUX = crate::Periph<dmamux::RegisterBlock, 0x4002_0800>;
impl core::fmt::Debug for DMAMUX {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("DMAMUX").finish()
}
}
pub mod dmamux;
pub type GPIOA = crate::Periph<gpioa::RegisterBlock, 0x5000_0000>;
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 type GPIOB = crate::Periph<gpiob::RegisterBlock, 0x5000_0400>;
impl core::fmt::Debug for GPIOB {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("GPIOB").finish()
}
}
pub mod gpiob;
pub type GPIOC = crate::Periph<gpiob::RegisterBlock, 0x5000_0800>;
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::gpiob as gpioc;
pub type GPIOD = crate::Periph<gpiob::RegisterBlock, 0x5000_0c00>;
impl core::fmt::Debug for GPIOD {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("GPIOD").finish()
}
}
pub use self::gpiob as gpiod;
pub type GPIOF = crate::Periph<gpiob::RegisterBlock, 0x5000_1400>;
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::gpiob as gpiof;
pub type AES = crate::Periph<aes::RegisterBlock, 0x4002_6000>;
impl core::fmt::Debug for AES {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("AES").finish()
}
}
pub mod aes;
pub type RNG = crate::Periph<rng::RegisterBlock, 0x4002_5000>;
impl core::fmt::Debug for RNG {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RNG").finish()
}
}
pub mod rng;
pub type CRC = crate::Periph<crc::RegisterBlock, 0x4002_3000>;
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 type EXTI = crate::Periph<exti::RegisterBlock, 0x4002_1800>;
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 type TIM16 = crate::Periph<tim16::RegisterBlock, 0x4001_4400>;
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 type TIM17 = crate::Periph<tim16::RegisterBlock, 0x4001_4800>;
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 type TIM15 = crate::Periph<tim15::RegisterBlock, 0x4001_4000>;
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 type USART1 = crate::Periph<usart1::RegisterBlock, 0x4001_3800>;
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 type USART2 = crate::Periph<usart1::RegisterBlock, 0x4000_4400>;
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 type USART3 = crate::Periph<usart1::RegisterBlock, 0x4000_4800>;
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 type USART4 = crate::Periph<usart1::RegisterBlock, 0x4000_4c00>;
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 type SPI1 = crate::Periph<spi1::RegisterBlock, 0x4001_3000>;
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 type SPI2 = crate::Periph<spi1::RegisterBlock, 0x4000_3800>;
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 type TIM1 = crate::Periph<tim1::RegisterBlock, 0x4001_2c00>;
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 type ADC = crate::Periph<adc::RegisterBlock, 0x4001_2400>;
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 type COMP = crate::Periph<comp::RegisterBlock, 0x4001_0200>;
impl core::fmt::Debug for COMP {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("COMP").finish()
}
}
pub mod comp;
pub type SYSCFG = crate::Periph<syscfg::RegisterBlock, 0x4001_0000>;
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 type TAMP = crate::Periph<tamp::RegisterBlock, 0x4000_b000>;
impl core::fmt::Debug for TAMP {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("TAMP").finish()
}
}
pub mod tamp;
pub type UCPD1 = crate::Periph<ucpd1::RegisterBlock, 0x4000_a000>;
impl core::fmt::Debug for UCPD1 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("UCPD1").finish()
}
}
pub mod ucpd1;
pub type UCPD2 = crate::Periph<ucpd1::RegisterBlock, 0x4000_a400>;
impl core::fmt::Debug for UCPD2 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("UCPD2").finish()
}
}
pub use self::ucpd1 as ucpd2;
pub type LPTIM1 = crate::Periph<lptim1::RegisterBlock, 0x4000_7c00>;
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 type LPTIM2 = crate::Periph<lptim1::RegisterBlock, 0x4000_9400>;
impl core::fmt::Debug for LPTIM2 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("LPTIM2").finish()
}
}
pub use self::lptim1 as lptim2;
pub type LPUART = crate::Periph<lpuart::RegisterBlock, 0x4000_8000>;
impl core::fmt::Debug for LPUART {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("LPUART").finish()
}
}
pub mod lpuart;
pub type HDMI_CEC = crate::Periph<hdmi_cec::RegisterBlock, 0x4000_7800>;
impl core::fmt::Debug for HDMI_CEC {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("HDMI_CEC").finish()
}
}
pub mod hdmi_cec;
pub type DAC = crate::Periph<dac::RegisterBlock, 0x4000_7400>;
impl core::fmt::Debug for DAC {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("DAC").finish()
}
}
pub mod dac;
pub type I2C1 = crate::Periph<i2c1::RegisterBlock, 0x4000_5400>;
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 type I2C2 = crate::Periph<i2c1::RegisterBlock, 0x4000_5800>;
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 type RTC = crate::Periph<rtc::RegisterBlock, 0x4000_2800>;
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 type TIM14 = crate::Periph<tim14::RegisterBlock, 0x4000_2000>;
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 type TIM6 = crate::Periph<tim6::RegisterBlock, 0x4000_1000>;
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 type TIM7 = crate::Periph<tim6::RegisterBlock, 0x4000_1400>;
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 type TIM2 = crate::Periph<tim2::RegisterBlock, 0x4000_0000>;
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 type TIM3 = crate::Periph<tim3::RegisterBlock, 0x4000_0400>;
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 type VREFBUF = crate::Periph<vrefbuf::RegisterBlock, 0x4001_0030>;
impl core::fmt::Debug for VREFBUF {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("VREFBUF").finish()
}
}
pub mod vrefbuf;
#[no_mangle]
static mut DEVICE_PERIPHERALS: bool = false;
#[allow(non_snake_case)]
pub struct Peripherals {
pub IWDG: IWDG,
pub WWDG: WWDG,
pub FLASH: FLASH,
pub DBG: DBG,
pub RCC: RCC,
pub PWR: PWR,
pub DMA1: DMA1,
pub DMAMUX: DMAMUX,
pub GPIOA: GPIOA,
pub GPIOB: GPIOB,
pub GPIOC: GPIOC,
pub GPIOD: GPIOD,
pub GPIOF: GPIOF,
pub AES: AES,
pub RNG: RNG,
pub CRC: CRC,
pub EXTI: EXTI,
pub TIM16: TIM16,
pub TIM17: TIM17,
pub TIM15: TIM15,
pub USART1: USART1,
pub USART2: USART2,
pub USART3: USART3,
pub USART4: USART4,
pub SPI1: SPI1,
pub SPI2: SPI2,
pub TIM1: TIM1,
pub ADC: ADC,
pub COMP: COMP,
pub SYSCFG: SYSCFG,
pub TAMP: TAMP,
pub UCPD1: UCPD1,
pub UCPD2: UCPD2,
pub LPTIM1: LPTIM1,
pub LPTIM2: LPTIM2,
pub LPUART: LPUART,
pub HDMI_CEC: HDMI_CEC,
pub DAC: DAC,
pub I2C1: I2C1,
pub I2C2: I2C2,
pub RTC: RTC,
pub TIM14: TIM14,
pub TIM6: TIM6,
pub TIM7: TIM7,
pub TIM2: TIM2,
pub TIM3: TIM3,
pub VREFBUF: VREFBUF,
}
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 {
IWDG: IWDG::steal(),
WWDG: WWDG::steal(),
FLASH: FLASH::steal(),
DBG: DBG::steal(),
RCC: RCC::steal(),
PWR: PWR::steal(),
DMA1: DMA1::steal(),
DMAMUX: DMAMUX::steal(),
GPIOA: GPIOA::steal(),
GPIOB: GPIOB::steal(),
GPIOC: GPIOC::steal(),
GPIOD: GPIOD::steal(),
GPIOF: GPIOF::steal(),
AES: AES::steal(),
RNG: RNG::steal(),
CRC: CRC::steal(),
EXTI: EXTI::steal(),
TIM16: TIM16::steal(),
TIM17: TIM17::steal(),
TIM15: TIM15::steal(),
USART1: USART1::steal(),
USART2: USART2::steal(),
USART3: USART3::steal(),
USART4: USART4::steal(),
SPI1: SPI1::steal(),
SPI2: SPI2::steal(),
TIM1: TIM1::steal(),
ADC: ADC::steal(),
COMP: COMP::steal(),
SYSCFG: SYSCFG::steal(),
TAMP: TAMP::steal(),
UCPD1: UCPD1::steal(),
UCPD2: UCPD2::steal(),
LPTIM1: LPTIM1::steal(),
LPTIM2: LPTIM2::steal(),
LPUART: LPUART::steal(),
HDMI_CEC: HDMI_CEC::steal(),
DAC: DAC::steal(),
I2C1: I2C1::steal(),
I2C2: I2C2::steal(),
RTC: RTC::steal(),
TIM14: TIM14::steal(),
TIM6: TIM6::steal(),
TIM7: TIM7::steal(),
TIM2: TIM2::steal(),
TIM3: TIM3::steal(),
VREFBUF: VREFBUF::steal(),
}
}
}