From bf0f5f55f5ea8328a7fb5ac776b8baaed4b9db83 Mon Sep 17 00:00:00 2001 From: memdmp Date: Fri, 24 Jan 2025 21:35:55 +0100 Subject: feat: initial it works --- src/bin/main.rs | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/bin/main.rs (limited to 'src/bin') diff --git a/src/bin/main.rs b/src/bin/main.rs new file mode 100644 index 0000000..52eafa5 --- /dev/null +++ b/src/bin/main.rs @@ -0,0 +1,36 @@ +#![no_std] +#![no_main] + +use esp_backtrace as _; +use esp_hal::clock::CpuClock; +use esp_hal::delay::Delay; +use esp_hal::main; +use esp_hal::timer::timg::TimerGroup; +use log::info; + +extern crate alloc; + +#[main] +fn main() -> ! { + let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max()); + let peripherals = esp_hal::init(config); + esp_println::logger::init_logger_from_env(); + + esp_alloc::heap_allocator!(72 * 1024); + + let timg0 = TimerGroup::new(peripherals.TIMG0); + let _init = esp_wifi::init( + timg0.timer0, + esp_hal::rng::Rng::new(peripherals.RNG), + peripherals.RADIO_CLK, + ) + .unwrap(); + + let delay = Delay::new(); + loop { + info!("Hello world!"); + delay.delay_millis(500); + } + + // for inspiration have a look at the examples at https://github.com/esp-rs/esp-hal/tree/v0.23.1/examples/src/bin +} -- cgit v1.2.3