This commit is contained in:
2025-06-27 16:41:18 +02:00
parent 1188995b80
commit ed701e8580
29 changed files with 3329 additions and 376 deletions

33
blinky/Cargo.toml Normal file
View File

@@ -0,0 +1,33 @@
[package]
name = "blinky"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
cortex-m.workspace = true
cortex-m-rt.workspace = true
# nrf52840-hal.workspace = true
# microflow.workspace = true
libm.workspace = true
# nalgebra.workspace = true
heapless.workspace = true
lsm6ds3tr.workspace = true
defmt.workspace = true
defmt-rtt.workspace = true
# embedded-alloc.workspace = true
# embedded-hal.workspace = true
# embedded-hal-async.workspace = true
embassy-nrf.workspace = true
embassy-time.workspace = true
embassy-executor.workspace = true
embassy-sync.workspace = true
embassy-embedded-hal.workspace = true
fixed.workspace = true
atomic-pool.workspace = true
static_cell.workspace = true
embassy-usb.workspace = true
embassy-futures.workspace = true
panic-probe.workspace = true
# assign-resources.workspace = true

4
blinky/src/common.rs Normal file
View File

@@ -0,0 +1,4 @@
#![macro_use]
use defmt_rtt as _; // global logger
use embassy_nrf as _; // time driver

32
blinky/src/main.rs Normal file
View File

@@ -0,0 +1,32 @@
#![no_main]
#![no_std]
use defmt::unwrap;
use embassy_executor::Spawner;
use embassy_nrf::gpio::{Level, Output, OutputDrive};
use embassy_time::{Duration, Timer};
mod common;
#[panic_handler]
fn panic(_info: &core::panic::PanicInfo) -> ! {
loop {}
}
#[embassy_executor::main]
async fn main(spawner: Spawner) {
let p = embassy_nrf::init(Default::default());
let led = Output::new(p.P0_06, Level::Low, OutputDrive::Standard);
unwrap!(spawner.spawn(blinker(led, Duration::from_millis(300))));
}
#[embassy_executor::task]
async fn blinker(mut led: Output<'static>, interval: Duration) {
loop {
led.set_high();
Timer::after(interval).await;
led.set_low();
Timer::after(interval).await;
}
}