Skip to content

Commit

Permalink
feat: Update to esp-hal 1.0.0-beta.0 crates
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioGasquez committed Feb 20, 2025
1 parent 4eb3eda commit e8051df
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
10 changes: 10 additions & 0 deletions template/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ smoltcp = { version = "0.12.0", default-features = false, features = [
# for more networking protocol support see https://crates.io/crates/edge-net
#ENDIF embassy && wifi
esp-wifi = { version = "0.12.0", default-features=false, features = [
"builtin-scheduler",
#REPLACE esp32c6 mcu
"esp32c6",
#IF option("wifi")
Expand Down Expand Up @@ -138,3 +139,12 @@ incremental = false
lto = 'fat'
opt-level = 's'
overflow-checks = false


[patch.crates-io]
esp-alloc = { git = "https://github.com/esp-rs/esp-hal/", package = "esp-alloc", rev = "b38d5cc8d5a8b19c82ac0724a8188d5c567acfa9" }
esp-backtrace = { git = "https://github.com/esp-rs/esp-hal/", package = "esp-backtrace", rev = "b38d5cc8d5a8b19c82ac0724a8188d5c567acfa9" }
esp-hal = { git = "https://github.com/esp-rs/esp-hal/", package = "esp-hal", rev = "b38d5cc8d5a8b19c82ac0724a8188d5c567acfa9" }
esp-hal-embassy = { git = "https://github.com/esp-rs/esp-hal/", package = "esp-hal-embassy", rev = "b38d5cc8d5a8b19c82ac0724a8188d5c567acfa9" }
esp-println = { git = "https://github.com/esp-rs/esp-hal/", package = "esp-println", rev = "b38d5cc8d5a8b19c82ac0724a8188d5c567acfa9" }
esp-wifi = { git = "https://github.com/esp-rs/esp-hal/", package = "esp-wifi", rev = "b38d5cc8d5a8b19c82ac0724a8188d5c567acfa9" }
2 changes: 1 addition & 1 deletion template/src/bin/async_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async fn main(spawner: Spawner) {
let peripherals = esp_hal::init(config);

//IF option("alloc")
esp_alloc::heap_allocator!(72 * 1024);
esp_alloc::heap_allocator!(size: 72 * 1024);
//ENDIF

//IF !option("esp32")
Expand Down
19 changes: 17 additions & 2 deletions template/src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@
#![no_std]
#![no_main]

use esp_hal::{clock::CpuClock, delay::Delay, main};
use esp_hal::{
clock::CpuClock,
//IF option("unestable-hal")
delay::Delay,
//ELSE
time::{Duration, Instant},
//ENDIF
main,
};
//IF option("wifi") || option("ble")
use esp_hal::timer::timg::TimerGroup;
//ENDIF
Expand Down Expand Up @@ -54,7 +62,7 @@ fn main() -> ! {
//ENDIF

//IF option("alloc")
esp_alloc::heap_allocator!(72 * 1024);
esp_alloc::heap_allocator!(size: 72 * 1024);
//ENDIF

//IF option("wifi") || option("ble")
Expand All @@ -67,12 +75,19 @@ fn main() -> ! {
.unwrap();
//ENDIF

//IF option("unestable-hal")
let delay = Delay::new();
//ENDIF
loop {
//IF option("defmt") || option("log")
info!("Hello world!");
//ENDIF
//IF option("unestable-hal")
delay.delay_millis(500);
//ELSE
let delay_start = Instant::now();
while delay_start.elapsed() < Duration::from_millis(500) {}
//ENDIF
}

// for inspiration have a look at the examples at https://github.com/esp-rs/esp-hal/tree/v0.23.1/examples/src/bin
Expand Down

0 comments on commit e8051df

Please sign in to comment.