chore(firmware): scaffold Spike 1 Blink crate
Generated from esp-rs/esp-idf-template for the ESP32-S3 std target. src/main.rs toggles GPIO 2 every 500 ms and logs `blink N` over USB- serial — the minimum bring-up surface called out in docs/v0.1-mvp-technical.md (Spike 1: confirm toolchain, flash, and basic GPIO). edition=2024 with rust-version=1.85. No editor/render/git/usb/fs modules yet; those land per the spike methodology when later spikes need them.
This commit is contained in:
26
firmware/src/main.rs
Normal file
26
firmware/src/main.rs
Normal file
@@ -0,0 +1,26 @@
|
||||
use esp_idf_svc::hal::delay::FreeRtos;
|
||||
use esp_idf_svc::hal::gpio::PinDriver;
|
||||
use esp_idf_svc::hal::peripherals::Peripherals;
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
// Required once before any esp-idf-svc call; some runtime patches
|
||||
// only link if this symbol is referenced. See esp-idf-template#71.
|
||||
esp_idf_svc::sys::link_patches();
|
||||
esp_idf_svc::log::EspLogger::initialize_default();
|
||||
|
||||
let peripherals = Peripherals::take()?;
|
||||
let mut led = PinDriver::output(peripherals.pins.gpio2)?;
|
||||
|
||||
log::info!("Typoena Spike 1 — Blink on GPIO 2");
|
||||
|
||||
let mut n: u32 = 0;
|
||||
loop {
|
||||
led.set_high()?;
|
||||
log::info!("blink {n}");
|
||||
n = n.wrapping_add(1);
|
||||
FreeRtos::delay_ms(500);
|
||||
|
||||
led.set_low()?;
|
||||
FreeRtos::delay_ms(500);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user