mirror of
https://github.com/esp-rs/esp-hal.git
synced 2025-10-02 14:44:42 +00:00
28 lines
606 B
Rust
28 lines
606 B
Rust
#![no_std]
|
|
#![no_main]
|
|
|
|
use esp32_hal::{gpio::IO, pac::Peripherals, prelude::*, Timer};
|
|
use nb::block;
|
|
use panic_halt as _;
|
|
use xtensa_lx_rt::entry;
|
|
|
|
#[entry]
|
|
fn main() -> ! {
|
|
let peripherals = Peripherals::take().unwrap();
|
|
|
|
let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
|
|
let mut led = io.pins.gpio15.into_push_pull_output();
|
|
let mut timer0 = Timer::new(peripherals.TIMG0);
|
|
|
|
// Disable watchdog timer
|
|
timer0.disable();
|
|
|
|
led.set_high().unwrap();
|
|
timer0.start(10_000_000u64);
|
|
|
|
loop {
|
|
led.toggle().unwrap();
|
|
block!(timer0.wait()).unwrap();
|
|
}
|
|
}
|