Skip to content

Commit

Permalink
don't rustfmt the output of gen-examples.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
japaric committed May 12, 2018
1 parent cdee343 commit 29ef307
Show file tree
Hide file tree
Showing 11 changed files with 215 additions and 215 deletions.
20 changes: 10 additions & 10 deletions src/examples/_00_hello.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,34 @@
//! #![deny(warnings)]
//! #![no_main]
//! #![no_std]
//!
//!
//! #[macro_use(entry, exception)]
//! extern crate cortex_m_rt as rt;
//! extern crate cortex_m_semihosting as semihosting;
//! extern crate f3;
//! extern crate panic_semihosting;
//!
//!
//! use core::fmt::Write;
//!
//!
//! use rt::ExceptionFrame;
//! use semihosting::hio;
//!
//!
//! entry!(main);
//!
//!
//! fn main() -> ! {
//! writeln!(hio::hstdout().unwrap(), "Hello, world!").unwrap();
//!
//!
//! loop {}
//! }
//!
//!
//! exception!(HardFault, hard_fault);
//!
//!
//! fn hard_fault(ef: &ExceptionFrame) -> ! {
//! panic!("{:#?}", ef);
//! }
//!
//!
//! exception!(*, default_handler);
//!
//!
//! fn default_handler(irqn: i16) {
//! panic!("Unhandled exception (IRQn = {})", irqn);
//! }
Expand Down
22 changes: 11 additions & 11 deletions src/examples/_01_itm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,38 @@
//! #![deny(warnings)]
//! #![no_main]
//! #![no_std]
//!
//!
//! #[macro_use]
//! extern crate cortex_m;
//! extern crate f3;
//! extern crate panic_semihosting;
//! #[macro_use(entry, exception)]
//! extern crate cortex_m_rt as rt;
//!
//!
//! use cortex_m::asm;
//! use rt::ExceptionFrame;
//!
//!
//! entry!(main);
//!
//!
//! fn main() -> ! {
//! let p = cortex_m::Peripherals::take().unwrap();
//! let mut itm = p.ITM;
//!
//!
//! iprintln!(&mut itm.stim[0], "Hello, world!");
//!
//!
//! asm::bkpt();
//!
//!
//! loop {}
//! }
//!
//!
//! exception!(HardFault, hard_fault);
//!
//!
//! fn hard_fault(ef: &ExceptionFrame) -> ! {
//! panic!("{:#?}", ef);
//! }
//!
//!
//! exception!(*, default_handler);
//!
//!
//! fn default_handler(irqn: i16) {
//! panic!("Unhandled exception (IRQn = {})", irqn);
//! }
Expand Down
24 changes: 12 additions & 12 deletions src/examples/_02_leds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,42 @@
//! #![deny(warnings)]
//! #![no_std]
//! #![no_main]
//!
//!
//! extern crate f3;
//! #[macro_use(entry, exception)]
//! extern crate cortex_m_rt as rt;
//! extern crate panic_semihosting;
//!
//!
//! use f3::hal::prelude::*;
//! use f3::hal::stm32f30x;
//! use f3::led::Leds;
//! use rt::ExceptionFrame;
//!
//!
//! entry!(main);
//!
//!
//! fn main() -> ! {
//! let p = stm32f30x::Peripherals::take().unwrap();
//!
//!
//! let mut rcc = p.RCC.constrain();
//! let gpioe = p.GPIOE.split(&mut rcc.ahb);
//!
//!
//! let mut leds = Leds::new(gpioe);
//!
//!
//! for led in leds.iter_mut() {
//! led.on();
//! }
//!
//!
//! loop {}
//! }
//!
//!
//! exception!(HardFault, hard_fault);
//!
//!
//! fn hard_fault(ef: &ExceptionFrame) -> ! {
//! panic!("{:#?}", ef);
//! }
//!
//!
//! exception!(*, default_handler);
//!
//!
//! fn default_handler(irqn: i16) {
//! panic!("Unhandled exception (IRQn = {})", irqn);
//! }
Expand Down
24 changes: 12 additions & 12 deletions src/examples/_03_blinky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,56 +5,56 @@
//! #![deny(warnings)]
//! #![no_std]
//! #![no_main]
//!
//!
//! extern crate cortex_m;
//! #[macro_use(entry, exception)]
//! extern crate cortex_m_rt as rt;
//! extern crate f3;
//! extern crate panic_semihosting;
//!
//!
//! use f3::hal::delay::Delay;
//! use f3::hal::prelude::*;
//! use f3::hal::stm32f30x;
//! use f3::led::Led;
//! use rt::ExceptionFrame;
//!
//!
//! entry!(main);
//!
//!
//! fn main() -> ! {
//! let cp = cortex_m::Peripherals::take().unwrap();
//! let dp = stm32f30x::Peripherals::take().unwrap();
//!
//!
//! let mut flash = dp.FLASH.constrain();
//! let mut rcc = dp.RCC.constrain();
//! let mut gpioe = dp.GPIOE.split(&mut rcc.ahb);
//!
//!
//! // clock configuration using the default settings (all clocks run at 8 MHz)
//! let clocks = rcc.cfgr.freeze(&mut flash.acr);
//! // TRY this alternate clock configuration (all clocks run at 16 MHz)
//! // let clocks = rcc.cfgr.sysclk(16.mhz()).freeze(&mut flash.acr);
//!
//!
//! let mut led: Led = gpioe
//! .pe9
//! .into_push_pull_output(&mut gpioe.moder, &mut gpioe.otyper)
//! .into();
//! let mut delay = Delay::new(cp.SYST, clocks);
//!
//!
//! loop {
//! led.on();
//! delay.delay_ms(1_000_u16);
//! led.off();
//! delay.delay_ms(1_000_u16);
//! }
//! }
//!
//!
//! exception!(HardFault, hard_fault);
//!
//!
//! fn hard_fault(ef: &ExceptionFrame) -> ! {
//! panic!("{:#?}", ef);
//! }
//!
//!
//! exception!(*, default_handler);
//!
//!
//! fn default_handler(irqn: i16) {
//! panic!("Unhandled exception (IRQn = {})", irqn);
//! }
Expand Down
26 changes: 13 additions & 13 deletions src/examples/_04_roulette.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,57 +5,57 @@
//! #![deny(warnings)]
//! #![no_std]
//! #![no_main]
//!
//!
//! #[macro_use(entry, exception)]
//! extern crate cortex_m_rt as rt;
//! extern crate cortex_m;
//! extern crate f3;
//! extern crate panic_semihosting;
//!
//!
//! use f3::hal::delay::Delay;
//! use f3::hal::prelude::*;
//! use f3::hal::stm32f30x;
//! use f3::led::Leds;
//! use rt::ExceptionFrame;
//!
//!
//! entry!(main);
//!
//!
//! fn main() -> ! {
//! let cp = cortex_m::Peripherals::take().unwrap();
//! let dp = stm32f30x::Peripherals::take().unwrap();
//!
//!
//! let mut flash = dp.FLASH.constrain();
//! let mut rcc = dp.RCC.constrain();
//! let gpioe = dp.GPIOE.split(&mut rcc.ahb);
//!
//!
//! // clock configuration using the default settings (all clocks run at 8 MHz)
//! let clocks = rcc.cfgr.freeze(&mut flash.acr);
//! // TRY this alternate clock configuration (all clocks run at 16 MHz)
//! // let clocks = rcc.cfgr.sysclk(16.mhz()).freeze(&mut flash.acr);
//!
//!
//! let mut leds = Leds::new(gpioe);
//! let mut delay = Delay::new(cp.SYST, clocks);
//!
//!
//! let n = leds.len();
//! loop {
//! for curr in 0..n {
//! let next = (curr + 1) % n;
//! leds[curr].off();
//! leds[next].on();
//!
//!
//! delay.delay_ms(100_u8);
//! }
//! }
//! }
//!
//!
//! exception!(HardFault, hard_fault);
//!
//!
//! fn hard_fault(ef: &ExceptionFrame) -> ! {
//! panic!("{:#?}", ef);
//! }
//!
//!
//! exception!(*, default_handler);
//!
//!
//! fn default_handler(irqn: i16) {
//! panic!("Unhandled exception (IRQn = {})", irqn);
//! }
Expand Down
38 changes: 19 additions & 19 deletions src/examples/_05_serial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,72 +7,72 @@
//! #![deny(warnings)]
//! #![no_main]
//! #![no_std]
//!
//!
//! extern crate cortex_m;
//! #[macro_use(entry, exception)]
//! extern crate cortex_m_rt as rt;
//! extern crate f3;
//! #[macro_use(block)]
//! extern crate nb;
//! extern crate panic_semihosting;
//!
//!
//! use cortex_m::asm;
//! use f3::hal::prelude::*;
//! use f3::hal::serial::Serial;
//! use f3::hal::stm32f30x;
//! use rt::ExceptionFrame;
//!
//!
//! entry!(main);
//!
//!
//! fn main() -> ! {
//! let p = stm32f30x::Peripherals::take().unwrap();
//!
//!
//! let mut flash = p.FLASH.constrain();
//! let mut rcc = p.RCC.constrain();
//! let mut gpioa = p.GPIOA.split(&mut rcc.ahb);
//! let mut gpiob = p.GPIOB.split(&mut rcc.ahb);
//!
//!
//! // clock configuration using the default settings (all clocks run at 8 MHz)
//! let clocks = rcc.cfgr.freeze(&mut flash.acr);
//! // TRY this alternate clock configuration (clocks run at nearly the maximum frequency)
//! // let clocks = rcc.cfgr.sysclk(64.mhz()).pclk1(32.mhz()).freeze(&mut flash.acr);
//!
//!
//! // The Serial API is highly generic
//! // TRY the commented out, different pin configurations
//! let tx = gpioa.pa9.into_af7(&mut gpioa.moder, &mut gpioa.afrh);
//! // let tx = gpiob.pb6.into_af7(&mut gpiob.moder, &mut gpiob.afrl);
//!
//!
//! // let rx = gpioa.pa10.into_af7(&mut gpioa.moder, &mut gpioa.afrh);
//! let rx = gpiob.pb7.into_af7(&mut gpiob.moder, &mut gpiob.afrl);
//!
//!
//! // TRY using a different USART peripheral here
//! let serial = Serial::usart1(p.USART1, (tx, rx), 9_600.bps(), clocks, &mut rcc.apb2);
//! let (mut tx, mut rx) = serial.split();
//!
//!
//! let sent = b'X';
//!
//!
//! // The `block!` macro makes an operation block until it finishes
//! // NOTE the error type is `!`
//! block!(tx.write(sent)).ok();
//!
//!
//! let received = block!(rx.read()).unwrap();
//!
//!
//! assert_eq!(received, sent);
//!
//!
//! // if all goes well you should reach this breakpoint
//! asm::bkpt();
//!
//!
//! loop {}
//! }
//!
//!
//! exception!(HardFault, hard_fault);
//!
//!
//! fn hard_fault(ef: &ExceptionFrame) -> ! {
//! panic!("{:#?}", ef);
//! }
//!
//!
//! exception!(*, default_handler);
//!
//!
//! fn default_handler(irqn: i16) {
//! panic!("Unhandled exception (IRQn = {})", irqn);
//! }
Expand Down
Loading

0 comments on commit 29ef307

Please sign in to comment.