Guest User

Untitled

a guest
Jan 16th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. //! Initialization code
  2.  
  3. #![no_std]
  4.  
  5. #[allow(unused_extern_crates)] // NOTE(allow) bug rust-lang/rust#53964
  6. extern crate panic_itm; // panic handler
  7.  
  8. pub use cortex_m::{asm::bkpt, iprint, iprintln, peripheral::ITM};
  9. pub use cortex_m_rt::entry;
  10. pub use f3::hal::stm32f30x::{gpioa, gpioc, rcc};
  11.  
  12. use f3::hal::stm32f30x::{self, GPIOA, GPIOE, RCC};
  13.  
  14. pub fn init() -> (
  15. &'static gpioa::RegisterBlock,
  16. &'static gpioc::RegisterBlock,
  17. &'static rcc::RegisterBlock,
  18. ITM
  19. ) {
  20. // restrict access to the other peripherals
  21. (stm32f30x::Peripherals::take().unwrap());
  22.  
  23. let p = cortex_m::Peripherals::take().unwrap();
  24.  
  25. unsafe { (&*GPIOA::ptr(), &*GPIOE::ptr(), &*RCC::ptr(), p.ITM) }
  26. }
Add Comment
Please, Sign In to add comment