diff options
author | Dario Nieuwenhuis <dirbaio@dirbaio.net> | 2022-06-12 22:15:44 +0200 |
---|---|---|
committer | Dario Nieuwenhuis <dirbaio@dirbaio.net> | 2022-06-12 22:22:31 +0200 |
commit | a8703b75988e1e700af701116464025679d2feb8 (patch) | |
tree | f4ec5de70ec05e793a774049e010935ac45853ed /docs/modules/ROOT | |
parent | 6199bdea710cde33e5d5381b6d6abfc8af46df19 (diff) | |
download | embassy-a8703b75988e1e700af701116464025679d2feb8.zip |
Run rustfmt.
Diffstat (limited to 'docs/modules/ROOT')
5 files changed, 21 insertions, 51 deletions
diff --git a/docs/modules/ROOT/examples/basic/src/main.rs b/docs/modules/ROOT/examples/basic/src/main.rs index 8394f73b..461741fd 100644 --- a/docs/modules/ROOT/examples/basic/src/main.rs +++ b/docs/modules/ROOT/examples/basic/src/main.rs @@ -2,18 +2,13 @@ #![no_main] #![feature(type_alias_impl_trait)] -use defmt_rtt as _; // global logger -use panic_probe as _; - use defmt::*; - use embassy::executor::Spawner; use embassy::time::{Duration, Timer}; -use embassy_nrf::{ - gpio::{Level, Output, OutputDrive}, - peripherals::P0_13, - Peripherals, -}; +use embassy_nrf::gpio::{Level, Output, OutputDrive}; +use embassy_nrf::peripherals::P0_13; +use embassy_nrf::Peripherals; +use {defmt_rtt as _, panic_probe as _}; // global logger #[embassy::task] async fn blinker(mut led: Output<'static, P0_13>, interval: Duration) { diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-async/src/main.rs b/docs/modules/ROOT/examples/layer-by-layer/blinky-async/src/main.rs index 35726be6..56bc698d 100644 --- a/docs/modules/ROOT/examples/layer-by-layer/blinky-async/src/main.rs +++ b/docs/modules/ROOT/examples/layer-by-layer/blinky-async/src/main.rs @@ -2,15 +2,11 @@ #![no_main] #![feature(type_alias_impl_trait)] -use defmt_rtt as _; -use panic_probe as _; - use embassy::executor::Spawner; -use embassy_stm32::{ - exti::ExtiInput, - gpio::{Input, Level, Output, Pull, Speed}, - Peripherals, -}; +use embassy_stm32::exti::ExtiInput; +use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; +use embassy_stm32::Peripherals; +use {defmt_rtt as _, panic_probe as _}; #[embassy::main] async fn main(_s: Spawner, p: Peripherals) { diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-hal/src/main.rs b/docs/modules/ROOT/examples/layer-by-layer/blinky-hal/src/main.rs index 2064ea61..d0c9f490 100644 --- a/docs/modules/ROOT/examples/layer-by-layer/blinky-hal/src/main.rs +++ b/docs/modules/ROOT/examples/layer-by-layer/blinky-hal/src/main.rs @@ -2,10 +2,8 @@ #![no_main] use cortex_m_rt::entry; -use defmt_rtt as _; -use panic_probe as _; - use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; +use {defmt_rtt as _, panic_probe as _}; #[entry] fn main() -> ! { diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-irq/src/main.rs b/docs/modules/ROOT/examples/layer-by-layer/blinky-irq/src/main.rs index 6a75384c..743d0c34 100644 --- a/docs/modules/ROOT/examples/layer-by-layer/blinky-irq/src/main.rs +++ b/docs/modules/ROOT/examples/layer-by-layer/blinky-irq/src/main.rs @@ -1,18 +1,15 @@ #![no_std] #![no_main] -use defmt_rtt as _; -use panic_probe as _; - use core::cell::RefCell; + use cortex_m::interrupt::Mutex; use cortex_m::peripheral::NVIC; use cortex_m_rt::entry; -use embassy_stm32::{ - gpio::{Input, Level, Output, Pin, Pull, Speed}, - interrupt, pac, - peripherals::{PB14, PC13}, -}; +use embassy_stm32::gpio::{Input, Level, Output, Pin, Pull, Speed}; +use embassy_stm32::peripherals::{PB14, PC13}; +use embassy_stm32::{interrupt, pac}; +use {defmt_rtt as _, panic_probe as _}; static BUTTON: Mutex<RefCell<Option<Input<'static, PC13>>>> = Mutex::new(RefCell::new(None)); static LED: Mutex<RefCell<Option<Output<'static, PB14>>>> = Mutex::new(RefCell::new(None)); diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-pac/src/main.rs b/docs/modules/ROOT/examples/layer-by-layer/blinky-pac/src/main.rs index 239eac18..990d46cb 100644 --- a/docs/modules/ROOT/examples/layer-by-layer/blinky-pac/src/main.rs +++ b/docs/modules/ROOT/examples/layer-by-layer/blinky-pac/src/main.rs @@ -1,12 +1,8 @@ #![no_std] #![no_main] -use defmt_rtt as _; -use panic_probe as _; - -use stm32_metapac as pac; - use pac::gpio::vals; +use {defmt_rtt as _, panic_probe as _, stm32_metapac as pac}; #[cortex_m_rt::entry] fn main() -> ! { @@ -30,30 +26,18 @@ fn main() -> ! { let gpioc = pac::GPIOC; const BUTTON_PIN: usize = 13; unsafe { - gpioc - .pupdr() - .modify(|w| w.set_pupdr(BUTTON_PIN, vals::Pupdr::PULLUP)); - gpioc - .otyper() - .modify(|w| w.set_ot(BUTTON_PIN, vals::Ot::PUSHPULL)); - gpioc - .moder() - .modify(|w| w.set_moder(BUTTON_PIN, vals::Moder::INPUT)); + gpioc.pupdr().modify(|w| w.set_pupdr(BUTTON_PIN, vals::Pupdr::PULLUP)); + gpioc.otyper().modify(|w| w.set_ot(BUTTON_PIN, vals::Ot::PUSHPULL)); + gpioc.moder().modify(|w| w.set_moder(BUTTON_PIN, vals::Moder::INPUT)); } // Setup LED let gpiob = pac::GPIOB; const LED_PIN: usize = 14; unsafe { - gpiob - .pupdr() - .modify(|w| w.set_pupdr(LED_PIN, vals::Pupdr::FLOATING)); - gpiob - .otyper() - .modify(|w| w.set_ot(LED_PIN, vals::Ot::PUSHPULL)); - gpiob - .moder() - .modify(|w| w.set_moder(LED_PIN, vals::Moder::OUTPUT)); + gpiob.pupdr().modify(|w| w.set_pupdr(LED_PIN, vals::Pupdr::FLOATING)); + gpiob.otyper().modify(|w| w.set_ot(LED_PIN, vals::Ot::PUSHPULL)); + gpiob.moder().modify(|w| w.set_moder(LED_PIN, vals::Moder::OUTPUT)); } // Main loop |