#![doc = "Peripheral access API for MKE06Z4 microcontrollers (generated using svd2rust v0.17.0)\n\nYou can find an overview of the API [here].\n\n[here]: https://docs.rs/svd2rust/0.17.0/svd2rust/#peripheral-api"]
#![deny(const_err)]
#![deny(dead_code)]
#![deny(improper_ctypes)]
#![deny(missing_docs)]
#![deny(no_mangle_generic_items)]
#![deny(non_shorthand_field_patterns)]
#![deny(overflowing_literals)]
#![deny(path_statements)]
#![deny(patterns_in_fns_without_body)]
#![deny(private_in_public)]
#![deny(unconditional_recursion)]
#![deny(unused_allocation)]
#![deny(unused_comparisons)]
#![deny(unused_parens)]
#![deny(while_true)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![no_std]
extern crate cortex_m;
#[cfg(feature = "rt")]
extern crate cortex_m_rt;
extern crate vcell;
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 FTMRE();
fn PMC();
fn IRQ();
fn I2C0();
fn I2C1();
fn SPI0();
fn SPI1();
fn UART0();
fn UART1();
fn UART2();
fn ADC();
fn ACMP0();
fn FTM0();
fn FTM1();
fn FTM2();
fn RTC();
fn ACMP1();
fn PIT_CH0();
fn PIT_CH1();
fn KBI0();
fn KBI1();
fn ICS();
fn WDOG();
fn PWT();
fn MSCAN_1();
fn MSCAN_2();
}
#[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; 32] = [
Vector { _reserved: 0 },
Vector { _reserved: 0 },
Vector { _reserved: 0 },
Vector { _reserved: 0 },
Vector { _reserved: 0 },
Vector { _handler: FTMRE },
Vector { _handler: PMC },
Vector { _handler: IRQ },
Vector { _handler: I2C0 },
Vector { _handler: I2C1 },
Vector { _handler: SPI0 },
Vector { _handler: SPI1 },
Vector { _handler: UART0 },
Vector { _handler: UART1 },
Vector { _handler: UART2 },
Vector { _handler: ADC },
Vector { _handler: ACMP0 },
Vector { _handler: FTM0 },
Vector { _handler: FTM1 },
Vector { _handler: FTM2 },
Vector { _handler: RTC },
Vector { _handler: ACMP1 },
Vector { _handler: PIT_CH0 },
Vector { _handler: PIT_CH1 },
Vector { _handler: KBI0 },
Vector { _handler: KBI1 },
Vector { _reserved: 0 },
Vector { _handler: ICS },
Vector { _handler: WDOG },
Vector { _handler: PWT },
Vector { _handler: MSCAN_1 },
Vector { _handler: MSCAN_2 },
];
#[doc = r"Enumeration of all the interrupts"]
#[derive(Copy, Clone, Debug)]
#[repr(u8)]
pub enum Interrupt {
#[doc = "5 - FTMRE"]
FTMRE = 5,
#[doc = "6 - PMC"]
PMC = 6,
#[doc = "7 - IRQ"]
IRQ = 7,
#[doc = "8 - I2C0"]
I2C0 = 8,
#[doc = "9 - I2C1"]
I2C1 = 9,
#[doc = "10 - SPI0"]
SPI0 = 10,
#[doc = "11 - SPI1"]
SPI1 = 11,
#[doc = "12 - UART0"]
UART0 = 12,
#[doc = "13 - UART1"]
UART1 = 13,
#[doc = "14 - UART2"]
UART2 = 14,
#[doc = "15 - ADC"]
ADC = 15,
#[doc = "16 - ACMP0"]
ACMP0 = 16,
#[doc = "17 - FTM0"]
FTM0 = 17,
#[doc = "18 - FTM1"]
FTM1 = 18,
#[doc = "19 - FTM2"]
FTM2 = 19,
#[doc = "20 - RTC"]
RTC = 20,
#[doc = "21 - ACMP1"]
ACMP1 = 21,
#[doc = "22 - PIT_CH0"]
PIT_CH0 = 22,
#[doc = "23 - PIT_CH1"]
PIT_CH1 = 23,
#[doc = "24 - KBI0"]
KBI0 = 24,
#[doc = "25 - KBI1"]
KBI1 = 25,
#[doc = "27 - ICS"]
ICS = 27,
#[doc = "28 - WDOG"]
WDOG = 28,
#[doc = "29 - PWT"]
PWT = 29,
#[doc = "30 - MSCAN_1"]
MSCAN_1 = 30,
#[doc = "31 - MSCAN_2"]
MSCAN_2 = 31,
}
unsafe impl cortex_m::interrupt::Nr for Interrupt {
#[inline(always)]
fn nr(&self) -> u8 {
*self as u8
}
}
#[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;
#[allow(unused_imports)]
use generic::*;
#[doc = r"Common register and bit access and modify traits"]
pub mod generic;
#[doc = "Flash Memory"]
pub struct FTMRE {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for FTMRE {}
impl FTMRE {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const ftmre::RegisterBlock {
0x4002_0000 as *const _
}
}
impl Deref for FTMRE {
type Target = ftmre::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*FTMRE::ptr() }
}
}
#[doc = "Flash Memory"]
pub mod ftmre;
#[doc = "Freescale's Scalable Controller Area Network"]
pub struct MSCAN {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for MSCAN {}
impl MSCAN {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const mscan::RegisterBlock {
0x4002_4000 as *const _
}
}
impl Deref for MSCAN {
type Target = mscan::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*MSCAN::ptr() }
}
}
#[doc = "Freescale's Scalable Controller Area Network"]
pub mod mscan;
#[doc = "Interrupt"]
pub struct IRQ {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for IRQ {}
impl IRQ {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const irq::RegisterBlock {
0x4003_1000 as *const _
}
}
impl Deref for IRQ {
type Target = irq::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*IRQ::ptr() }
}
}
#[doc = "Interrupt"]
pub mod irq;
#[doc = "Cyclic Redundancy Check"]
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 {
0x4003_2000 as *const _
}
}
impl Deref for CRC {
type Target = crc::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*CRC::ptr() }
}
}
#[doc = "Cyclic Redundancy Check"]
pub mod crc;
#[doc = "Pulse Width Timer"]
pub struct PWT {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for PWT {}
impl PWT {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const pwt::RegisterBlock {
0x4003_3000 as *const _
}
}
impl Deref for PWT {
type Target = pwt::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*PWT::ptr() }
}
}
#[doc = "Pulse Width Timer"]
pub mod pwt;
#[doc = "Periodic Interrupt Timer"]
pub struct PIT {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for PIT {}
impl PIT {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const pit::RegisterBlock {
0x4003_7000 as *const _
}
}
impl Deref for PIT {
type Target = pit::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*PIT::ptr() }
}
}
#[doc = "Periodic Interrupt Timer"]
pub mod pit;
#[doc = "FlexTimer Module"]
pub struct FTM0 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for FTM0 {}
impl FTM0 {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const ftm0::RegisterBlock {
0x4003_8000 as *const _
}
}
impl Deref for FTM0 {
type Target = ftm0::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*FTM0::ptr() }
}
}
#[doc = "FlexTimer Module"]
pub mod ftm0;
#[doc = "FlexTimer Module"]
pub struct FTM1 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for FTM1 {}
impl FTM1 {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const ftm1::RegisterBlock {
0x4003_9000 as *const _
}
}
impl Deref for FTM1 {
type Target = ftm1::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*FTM1::ptr() }
}
}
#[doc = "FlexTimer Module"]
pub mod ftm1;
#[doc = "FlexTimer Module"]
pub struct FTM2 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for FTM2 {}
impl FTM2 {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const ftm2::RegisterBlock {
0x4003_a000 as *const _
}
}
impl Deref for FTM2 {
type Target = ftm2::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*FTM2::ptr() }
}
}
#[doc = "FlexTimer Module"]
pub mod ftm2;
#[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 {
0x4003_b000 as *const _
}
}
impl Deref for ADC {
type Target = adc::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*ADC::ptr() }
}
}
#[doc = "Analog-to-digital converter"]
pub mod adc;
#[doc = "Real-time counter"]
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 {
0x4003_d000 as *const _
}
}
impl Deref for RTC {
type Target = rtc::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*RTC::ptr() }
}
}
#[doc = "Real-time counter"]
pub mod rtc;
#[doc = "System Integration Module"]
pub struct SIM {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for SIM {}
impl SIM {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const sim::RegisterBlock {
0x4004_8000 as *const _
}
}
impl Deref for SIM {
type Target = sim::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*SIM::ptr() }
}
}
#[doc = "System Integration Module"]
pub mod sim;
#[doc = "Port control and interrupts"]
pub struct PORT {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for PORT {}
impl PORT {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const port::RegisterBlock {
0x4004_9000 as *const _
}
}
impl Deref for PORT {
type Target = port::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*PORT::ptr() }
}
}
#[doc = "Port control and interrupts"]
pub mod port;
#[doc = "Watchdog timer"]
pub struct WDOG {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for WDOG {}
impl WDOG {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const wdog::RegisterBlock {
0x4005_2000 as *const _
}
}
impl Deref for WDOG {
type Target = wdog::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*WDOG::ptr() }
}
}
#[doc = "Watchdog timer"]
pub mod wdog;
#[doc = "Clock management"]
pub struct ICS {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for ICS {}
impl ICS {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const ics::RegisterBlock {
0x4006_4000 as *const _
}
}
impl Deref for ICS {
type Target = ics::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*ICS::ptr() }
}
}
#[doc = "Clock management"]
pub mod ics;
#[doc = "Oscillator"]
pub struct OSC {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for OSC {}
impl OSC {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const osc::RegisterBlock {
0x4006_5000 as *const _
}
}
impl Deref for OSC {
type Target = osc::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*OSC::ptr() }
}
}
#[doc = "Oscillator"]
pub mod osc;
#[doc = "Inter-Integrated Circuit"]
pub struct I2C0 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for I2C0 {}
impl I2C0 {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const i2c0::RegisterBlock {
0x4006_6000 as *const _
}
}
impl Deref for I2C0 {
type Target = i2c0::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*I2C0::ptr() }
}
}
#[doc = "Inter-Integrated Circuit"]
pub mod i2c0;
#[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 {
0x4006_7000 as *const _
}
}
impl Deref for I2C1 {
type Target = i2c1::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*I2C1::ptr() }
}
}
#[doc = "Inter-Integrated Circuit"]
pub mod i2c1;
#[doc = "Universal Asynchronous Receiver/Transmitter (UART)"]
pub struct UART0 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for UART0 {}
impl UART0 {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const uart0::RegisterBlock {
0x4006_a000 as *const _
}
}
impl Deref for UART0 {
type Target = uart0::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*UART0::ptr() }
}
}
#[doc = "Universal Asynchronous Receiver/Transmitter (UART)"]
pub mod uart0;
#[doc = "Universal Asynchronous Receiver/Transmitter (UART)"]
pub struct UART1 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for UART1 {}
impl UART1 {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const uart1::RegisterBlock {
0x4006_b000 as *const _
}
}
impl Deref for UART1 {
type Target = uart1::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*UART1::ptr() }
}
}
#[doc = "Universal Asynchronous Receiver/Transmitter (UART)"]
pub mod uart1;
#[doc = "Universal Asynchronous Receiver/Transmitter (UART)"]
pub struct UART2 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for UART2 {}
impl UART2 {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const uart2::RegisterBlock {
0x4006_c000 as *const _
}
}
impl Deref for UART2 {
type Target = uart2::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*UART2::ptr() }
}
}
#[doc = "Universal Asynchronous Receiver/Transmitter (UART)"]
pub mod uart2;
#[doc = "Analog comparator"]
pub struct ACMP0 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for ACMP0 {}
impl ACMP0 {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const acmp0::RegisterBlock {
0x4007_3000 as *const _
}
}
impl Deref for ACMP0 {
type Target = acmp0::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*ACMP0::ptr() }
}
}
#[doc = "Analog comparator"]
pub mod acmp0;
#[doc = "Analog comparator"]
pub struct ACMP1 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for ACMP1 {}
impl ACMP1 {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const acmp1::RegisterBlock {
0x4007_4000 as *const _
}
}
impl Deref for ACMP1 {
type Target = acmp1::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*ACMP1::ptr() }
}
}
#[doc = "Analog comparator"]
pub mod acmp1;
#[doc = "Serial Peripheral Interface"]
pub struct SPI0 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for SPI0 {}
impl SPI0 {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const spi0::RegisterBlock {
0x4007_6000 as *const _
}
}
impl Deref for SPI0 {
type Target = spi0::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*SPI0::ptr() }
}
}
#[doc = "Serial Peripheral Interface"]
pub mod spi0;
#[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 {
0x4007_7000 as *const _
}
}
impl Deref for SPI1 {
type Target = spi1::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*SPI1::ptr() }
}
}
#[doc = "Serial Peripheral Interface"]
pub mod spi1;
#[doc = "Keyboard interrupts"]
pub struct KBI0 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for KBI0 {}
impl KBI0 {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const kbi0::RegisterBlock {
0x4007_9000 as *const _
}
}
impl Deref for KBI0 {
type Target = kbi0::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*KBI0::ptr() }
}
}
#[doc = "Keyboard interrupts"]
pub mod kbi0;
#[doc = "Keyboard interrupts"]
pub struct KBI1 {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for KBI1 {}
impl KBI1 {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const kbi1::RegisterBlock {
0x4007_a000 as *const _
}
}
impl Deref for KBI1 {
type Target = kbi1::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*KBI1::ptr() }
}
}
#[doc = "Keyboard interrupts"]
pub mod kbi1;
#[doc = "Power management"]
pub struct PMC {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for PMC {}
impl PMC {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const pmc::RegisterBlock {
0x4007_d000 as *const _
}
}
impl Deref for PMC {
type Target = pmc::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*PMC::ptr() }
}
}
#[doc = "Power management"]
pub mod pmc;
#[doc = "General Purpose Input/Output"]
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 {
0x400f_f000 as *const _
}
}
impl Deref for GPIOA {
type Target = gpioa::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*GPIOA::ptr() }
}
}
#[doc = "General Purpose Input/Output"]
pub mod gpioa;
#[doc = "General Purpose Input/Output"]
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 {
0x400f_f040 as *const _
}
}
impl Deref for GPIOB {
type Target = gpiob::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*GPIOB::ptr() }
}
}
#[doc = "General Purpose Input/Output"]
pub mod gpiob;
#[doc = "General Purpose Input/Output"]
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 gpioc::RegisterBlock {
0x400f_f080 as *const _
}
}
impl Deref for GPIOC {
type Target = gpioc::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*GPIOC::ptr() }
}
}
#[doc = "General Purpose Input/Output"]
pub mod gpioc;
#[doc = "System ROM"]
pub struct ROM {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for ROM {}
impl ROM {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const rom::RegisterBlock {
0xf000_2000 as *const _
}
}
impl Deref for ROM {
type Target = rom::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*ROM::ptr() }
}
}
#[doc = "System ROM"]
pub mod rom;
#[doc = "Core Platform Miscellaneous Control Module"]
pub struct MCM {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for MCM {}
impl MCM {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const mcm::RegisterBlock {
0xf000_3000 as *const _
}
}
impl Deref for MCM {
type Target = mcm::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*MCM::ptr() }
}
}
#[doc = "Core Platform Miscellaneous Control Module"]
pub mod mcm;
#[doc = "General Purpose Input/Output"]
pub struct FGPIOA {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for FGPIOA {}
impl FGPIOA {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const fgpioa::RegisterBlock {
0xf800_0000 as *const _
}
}
impl Deref for FGPIOA {
type Target = fgpioa::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*FGPIOA::ptr() }
}
}
#[doc = "General Purpose Input/Output"]
pub mod fgpioa;
#[doc = "General Purpose Input/Output"]
pub struct FGPIOB {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for FGPIOB {}
impl FGPIOB {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const fgpiob::RegisterBlock {
0xf800_0040 as *const _
}
}
impl Deref for FGPIOB {
type Target = fgpiob::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*FGPIOB::ptr() }
}
}
#[doc = "General Purpose Input/Output"]
pub mod fgpiob;
#[doc = "General Purpose Input/Output"]
pub struct FGPIOC {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for FGPIOC {}
impl FGPIOC {
#[doc = r"Returns a pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const fgpioc::RegisterBlock {
0xf800_0080 as *const _
}
}
impl Deref for FGPIOC {
type Target = fgpioc::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*FGPIOC::ptr() }
}
}
#[doc = "General Purpose Input/Output"]
pub mod fgpioc;
#[no_mangle]
static mut DEVICE_PERIPHERALS: bool = false;
#[doc = r"All the peripherals"]
#[allow(non_snake_case)]
pub struct Peripherals {
#[doc = "FTMRE"]
pub FTMRE: FTMRE,
#[doc = "MSCAN"]
pub MSCAN: MSCAN,
#[doc = "IRQ"]
pub IRQ: IRQ,
#[doc = "CRC"]
pub CRC: CRC,
#[doc = "PWT"]
pub PWT: PWT,
#[doc = "PIT"]
pub PIT: PIT,
#[doc = "FTM0"]
pub FTM0: FTM0,
#[doc = "FTM1"]
pub FTM1: FTM1,
#[doc = "FTM2"]
pub FTM2: FTM2,
#[doc = "ADC"]
pub ADC: ADC,
#[doc = "RTC"]
pub RTC: RTC,
#[doc = "SIM"]
pub SIM: SIM,
#[doc = "PORT"]
pub PORT: PORT,
#[doc = "WDOG"]
pub WDOG: WDOG,
#[doc = "ICS"]
pub ICS: ICS,
#[doc = "OSC"]
pub OSC: OSC,
#[doc = "I2C0"]
pub I2C0: I2C0,
#[doc = "I2C1"]
pub I2C1: I2C1,
#[doc = "UART0"]
pub UART0: UART0,
#[doc = "UART1"]
pub UART1: UART1,
#[doc = "UART2"]
pub UART2: UART2,
#[doc = "ACMP0"]
pub ACMP0: ACMP0,
#[doc = "ACMP1"]
pub ACMP1: ACMP1,
#[doc = "SPI0"]
pub SPI0: SPI0,
#[doc = "SPI1"]
pub SPI1: SPI1,
#[doc = "KBI0"]
pub KBI0: KBI0,
#[doc = "KBI1"]
pub KBI1: KBI1,
#[doc = "PMC"]
pub PMC: PMC,
#[doc = "GPIOA"]
pub GPIOA: GPIOA,
#[doc = "GPIOB"]
pub GPIOB: GPIOB,
#[doc = "GPIOC"]
pub GPIOC: GPIOC,
#[doc = "ROM"]
pub ROM: ROM,
#[doc = "MCM"]
pub MCM: MCM,
#[doc = "FGPIOA"]
pub FGPIOA: FGPIOA,
#[doc = "FGPIOB"]
pub FGPIOB: FGPIOB,
#[doc = "FGPIOC"]
pub FGPIOC: FGPIOC,
}
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`"]
#[inline]
pub unsafe fn steal() -> Self {
DEVICE_PERIPHERALS = true;
Peripherals {
FTMRE: FTMRE {
_marker: PhantomData,
},
MSCAN: MSCAN {
_marker: PhantomData,
},
IRQ: IRQ {
_marker: PhantomData,
},
CRC: CRC {
_marker: PhantomData,
},
PWT: PWT {
_marker: PhantomData,
},
PIT: PIT {
_marker: PhantomData,
},
FTM0: FTM0 {
_marker: PhantomData,
},
FTM1: FTM1 {
_marker: PhantomData,
},
FTM2: FTM2 {
_marker: PhantomData,
},
ADC: ADC {
_marker: PhantomData,
},
RTC: RTC {
_marker: PhantomData,
},
SIM: SIM {
_marker: PhantomData,
},
PORT: PORT {
_marker: PhantomData,
},
WDOG: WDOG {
_marker: PhantomData,
},
ICS: ICS {
_marker: PhantomData,
},
OSC: OSC {
_marker: PhantomData,
},
I2C0: I2C0 {
_marker: PhantomData,
},
I2C1: I2C1 {
_marker: PhantomData,
},
UART0: UART0 {
_marker: PhantomData,
},
UART1: UART1 {
_marker: PhantomData,
},
UART2: UART2 {
_marker: PhantomData,
},
ACMP0: ACMP0 {
_marker: PhantomData,
},
ACMP1: ACMP1 {
_marker: PhantomData,
},
SPI0: SPI0 {
_marker: PhantomData,
},
SPI1: SPI1 {
_marker: PhantomData,
},
KBI0: KBI0 {
_marker: PhantomData,
},
KBI1: KBI1 {
_marker: PhantomData,
},
PMC: PMC {
_marker: PhantomData,
},
GPIOA: GPIOA {
_marker: PhantomData,
},
GPIOB: GPIOB {
_marker: PhantomData,
},
GPIOC: GPIOC {
_marker: PhantomData,
},
ROM: ROM {
_marker: PhantomData,
},
MCM: MCM {
_marker: PhantomData,
},
FGPIOA: FGPIOA {
_marker: PhantomData,
},
FGPIOB: FGPIOB {
_marker: PhantomData,
},
FGPIOC: FGPIOC {
_marker: PhantomData,
},
}
}
}