/*
Simplified Embedded Rust: ESP Core Library Edition
The Embassy Framework - Blinky Application Example
*/
#![no_std]
#![no_main]
use embassy_executor::Spawner;
use embassy_time::{Duration, Timer};
use esp_backtrace as _;
use esp_hal::{
gpio::{Io, Level, Output},
timer::timg::TimerGroup,
};
#[esp_hal_embassy::main]
async fn main(_spawner: Spawner) {
// Take peripherals & Configure System Clocks
let peripherals =
esp_hal::init(esp_hal::Config::default());
// Initalize embassy executor
let timg0 = TimerGroup::new(peripherals.TIMG0);
esp_hal_embassy::init(timg0.timer0);
// Setup and Configure LED Output Pin
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
let mut led = Output::new(io.pins.gpio1, Level::High);
loop {
// Turn on LED
led.set_high();
// Wait for 1 second
Timer::after(Duration::from_millis(1_000)).await;
// Turn off LED
led.set_low();
// Wait for 1 second
Timer::after(Duration::from_millis(1_000)).await;
}
}