diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-06-12 22:15:44 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-06-12 22:22:31 +0200 |
| commit | a8703b75988e1e700af701116464025679d2feb8 (patch) | |
| tree | f4ec5de70ec05e793a774049e010935ac45853ed /docs/modules/ROOT/examples/layer-by-layer/blinky-pac/src | |
| parent | 6199bdea710cde33e5d5381b6d6abfc8af46df19 (diff) | |
Run rustfmt.
Diffstat (limited to 'docs/modules/ROOT/examples/layer-by-layer/blinky-pac/src')
| -rw-r--r-- | docs/modules/ROOT/examples/layer-by-layer/blinky-pac/src/main.rs | 30 |
1 files changed, 7 insertions, 23 deletions
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 239eac188..990d46cb6 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 @@ | |||
| 1 | #![no_std] | 1 | #![no_std] |
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | 3 | ||
| 4 | use defmt_rtt as _; | ||
| 5 | use panic_probe as _; | ||
| 6 | |||
| 7 | use stm32_metapac as pac; | ||
| 8 | |||
| 9 | use pac::gpio::vals; | 4 | use pac::gpio::vals; |
| 5 | use {defmt_rtt as _, panic_probe as _, stm32_metapac as pac}; | ||
| 10 | 6 | ||
| 11 | #[cortex_m_rt::entry] | 7 | #[cortex_m_rt::entry] |
| 12 | fn main() -> ! { | 8 | fn main() -> ! { |
| @@ -30,30 +26,18 @@ fn main() -> ! { | |||
| 30 | let gpioc = pac::GPIOC; | 26 | let gpioc = pac::GPIOC; |
| 31 | const BUTTON_PIN: usize = 13; | 27 | const BUTTON_PIN: usize = 13; |
| 32 | unsafe { | 28 | unsafe { |
| 33 | gpioc | 29 | gpioc.pupdr().modify(|w| w.set_pupdr(BUTTON_PIN, vals::Pupdr::PULLUP)); |
| 34 | .pupdr() | 30 | gpioc.otyper().modify(|w| w.set_ot(BUTTON_PIN, vals::Ot::PUSHPULL)); |
| 35 | .modify(|w| w.set_pupdr(BUTTON_PIN, vals::Pupdr::PULLUP)); | 31 | gpioc.moder().modify(|w| w.set_moder(BUTTON_PIN, vals::Moder::INPUT)); |
| 36 | gpioc | ||
| 37 | .otyper() | ||
| 38 | .modify(|w| w.set_ot(BUTTON_PIN, vals::Ot::PUSHPULL)); | ||
| 39 | gpioc | ||
| 40 | .moder() | ||
| 41 | .modify(|w| w.set_moder(BUTTON_PIN, vals::Moder::INPUT)); | ||
| 42 | } | 32 | } |
| 43 | 33 | ||
| 44 | // Setup LED | 34 | // Setup LED |
| 45 | let gpiob = pac::GPIOB; | 35 | let gpiob = pac::GPIOB; |
| 46 | const LED_PIN: usize = 14; | 36 | const LED_PIN: usize = 14; |
| 47 | unsafe { | 37 | unsafe { |
| 48 | gpiob | 38 | gpiob.pupdr().modify(|w| w.set_pupdr(LED_PIN, vals::Pupdr::FLOATING)); |
| 49 | .pupdr() | 39 | gpiob.otyper().modify(|w| w.set_ot(LED_PIN, vals::Ot::PUSHPULL)); |
| 50 | .modify(|w| w.set_pupdr(LED_PIN, vals::Pupdr::FLOATING)); | 40 | gpiob.moder().modify(|w| w.set_moder(LED_PIN, vals::Moder::OUTPUT)); |
| 51 | gpiob | ||
| 52 | .otyper() | ||
| 53 | .modify(|w| w.set_ot(LED_PIN, vals::Ot::PUSHPULL)); | ||
| 54 | gpiob | ||
| 55 | .moder() | ||
| 56 | .modify(|w| w.set_moder(LED_PIN, vals::Moder::OUTPUT)); | ||
| 57 | } | 41 | } |
| 58 | 42 | ||
| 59 | // Main loop | 43 | // Main loop |
