Run rustfmt.
This commit is contained in:
parent
6199bdea71
commit
a8703b7598
340 changed files with 1326 additions and 3020 deletions
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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() -> ! {
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue