28 lines
659 B
Rust
28 lines
659 B
Rust
//! Initialization code
|
|
|
|
|
|
pub use f3::hal::stm32f30x::{gpioa, gpioc, rcc};
|
|
|
|
use f3::hal::stm32f30x::{self, GPIOA, GPIOD, GPIOE, RCC};
|
|
|
|
pub struct Peripherals {
|
|
pub gpioa: &'static gpioa::RegisterBlock,
|
|
pub gpiod: &'static gpioc::RegisterBlock,
|
|
pub gpioe: &'static gpioc::RegisterBlock,
|
|
pub rcc: &'static rcc::RegisterBlock,
|
|
}
|
|
|
|
pub fn init() -> Peripherals {
|
|
// restrict access to the other peripherals
|
|
(stm32f30x::Peripherals::take().unwrap());
|
|
|
|
unsafe {
|
|
Peripherals {
|
|
gpioa: &*GPIOA::ptr(),
|
|
gpiod: &*GPIOD::ptr(),
|
|
gpioe: &*GPIOE::ptr(),
|
|
rcc: &*RCC::ptr(),
|
|
}
|
|
}
|
|
}
|