eculocate

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit f8080a5c05d0e8b4b5ae789820b76f888a579e85
parent 96b387bd68ae3ecaf3daf6cf01696371d38018ea
Author: Daniel Barlow <dan@telent.net>
Date:   Sun, 16 Nov 2025 15:39:09 +0000

use embassy-time instead of Delay

because it doesn't block ble

Diffstat:
Msrc/bin/main.rs | 11++++-------
1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/bin/main.rs b/src/bin/main.rs @@ -10,7 +10,6 @@ use esp_backtrace as _; use esp_println as _; use esp_hal::{ - delay::Delay, timer::timg::TimerGroup, gpio::{Level, Output, OutputConfig}, clock::CpuClock, @@ -75,14 +74,13 @@ async fn run_ecu(periph_uart : esp_hal::peripherals::UART0<'_>, mut tx_peripheral : esp_hal::peripherals::GPIO21<'_>, rx_peripheral : esp_hal::peripherals::GPIO20<'_>) { let tx = tx_peripheral.reborrow(); - let delay = Delay::new(); let mut output = Output::new(tx, Level::High, OutputConfig::default()); output.set_low(); - delay.delay_millis(70); + Timer::after_millis(70).await; output.set_high(); - delay.delay_millis(120); + Timer::after_millis(120).await; let mut uart = Uart::new( periph_uart, @@ -97,13 +95,12 @@ async fn run_ecu(periph_uart : esp_hal::peripherals::UART0<'_>, uart.write(b"\xfe\x04\xff\xff").expect("write failed"); let _ = uart.flush(); - delay.delay_millis(200); + Timer::after_millis(200).await; uart.write(b"\x72\x05\x00\xF0\x99").expect("write 2 failed"); let _ = uart.flush(); loop { - info!("waiting"); - delay.delay_millis(60*1000); + info!("waiting for input"); let mut buf = [0u8; 80]; let bytes = uart.read_async(&mut buf[..]).await.expect("read failed"); // if bytes>0 { led.toggle(); }