diff --git a/ci-esp.sh b/ci-esp.sh old mode 100644 new mode 100755 index 4b62fd9..ca8cd40 --- a/ci-esp.sh +++ b/ci-esp.sh @@ -32,9 +32,9 @@ fi . $HOME/export-esp.sh # compile -cd ../test-esp32c3; cargo build --release -cd ../test-esp32s3; cargo build --release +cd $test_dir/test-esp32c3; cargo build --release +cd $test_dir/test-esp32s3; cargo build --release # clean up -cd ../.. -# rm -r ci +cd $cwd +# rm -r $test_dir/ci diff --git a/src/templates/config.toml.esp.template b/src/templates/config.toml.esp.template index f0fbd45..71c3fce 100644 --- a/src/templates/config.toml.esp.template +++ b/src/templates/config.toml.esp.template @@ -5,7 +5,7 @@ runner = "espflash flash --monitor" [env] -ESP_LOGLEVEL="INFO" +ESP_LOG="INFO" [build] {rustflags} diff --git a/src/templates/main.rs.esp.template b/src/templates/main.rs.esp.template index 4114f53..8031c5d 100644 --- a/src/templates/main.rs.esp.template +++ b/src/templates/main.rs.esp.template @@ -5,41 +5,29 @@ use embassy_executor::Spawner; use embassy_time::Timer; use esp_backtrace as _; use esp_hal::{ - clock::ClockControl, - gpio::{Io, Level, Output}, - peripherals::Peripherals, - prelude::*, - system::SystemControl, - timer::{timg::TimerGroup, ErasedTimer, OneShotTimer}, + self, + clock::CpuClock, + gpio::{Level, Output}, + timer::timg::TimerGroup, }; +use esp_hal_embassy::main; use esp_println::println; -use static_cell::StaticCell; #[main] async fn main(_spawner: Spawner) { - let peripherals = Peripherals::take(); - let system = SystemControl::new(peripherals.SYSTEM); - - let clocks = ClockControl::max(system.clock_control).freeze(); - esp_println::logger::init_logger_from_env(); - let timg0 = TimerGroup::new(peripherals.TIMG0, &clocks, None); - - let timer = { - static TIMER: StaticCell<[OneShotTimer; 1]> = StaticCell::new(); - - TIMER.init([OneShotTimer::new(timg0.timer0.into())]) - }; - - esp_hal_embassy::init(&clocks, timer); - let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); + let mut config = esp_hal::Config::default(); + config.cpu_clock = CpuClock::max(); + let peripherals = esp_hal::init(config); - let mut led = Output::new(io.pins.gpio17, Level::Low); + let timg0 = TimerGroup::new(peripherals.TIMG0); + esp_hal_embassy::init(timg0.timer0); + let mut led = Output::new(peripherals.GPIO17, Level::High); loop { println!("Hello, World!"); led.toggle(); Timer::after_millis(1_000).await; } -} +} \ No newline at end of file