From 399d59d5e7a01d6d6bd5f8321450f666dc841bef Mon Sep 17 00:00:00 2001 From: andromeda Date: Sun, 5 Apr 2026 21:11:02 +0200 Subject: init --- src/bin/main.rs | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/bin/main.rs (limited to 'src/bin/main.rs') diff --git a/src/bin/main.rs b/src/bin/main.rs new file mode 100644 index 0000000..7ead6f2 --- /dev/null +++ b/src/bin/main.rs @@ -0,0 +1,40 @@ +#![no_std] +#![no_main] +#![deny( + clippy::mem_forget, + reason = "mem::forget is generally not safe to do with esp_hal types, especially those \ + holding buffers for the duration of a data transfer." +)] +#![deny(clippy::large_stack_frames)] + +use esp_backtrace as _; +use esp_hal::clock::CpuClock; +use esp_hal::main; +use esp_hal::time::{Duration, Instant}; +use log::info; + +// This creates a default app-descriptor required by the esp-idf bootloader. +// For more information see: +esp_bootloader_esp_idf::esp_app_desc!(); + +#[allow( + clippy::large_stack_frames, + reason = "it's not unusual to allocate larger buffers etc. in main" +)] +#[main] +fn main() -> ! { + // generator version: 1.2.0 + + esp_println::logger::init_logger_from_env(); + + let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max()); + let _peripherals = esp_hal::init(config); + + loop { + info!("Hello world!"); + let delay_start = Instant::now(); + while delay_start.elapsed() < Duration::from_millis(500) {} + } + + // for inspiration have a look at the examples at https://github.com/esp-rs/esp-hal/tree/esp-hal-v1.0.0/examples +} -- cgit v1.3.1