esp-hal/esp32-hal/examples/blinky.rs
Björn Quentin 6d94b61268
Shared GPIO Implementation (#3)
* make esp32c3 examples run from flash / flashable
* use gpio3 for blinky
* direct boot in Cargo.toml
* have a shared gpio impl
* use PACs from their original locations again
2022-01-06 07:57:55 -08:00

28 lines
569 B
Rust

#![no_std]
#![no_main]
use esp32_hal::{gpio::IO, pac, prelude::*, Timer};
use nb::block;
use panic_halt as _;
use xtensa_lx_rt::entry;
#[entry]
fn main() -> ! {
let peripherals = pac::Peripherals::take().unwrap();
let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
let mut timer0 = Timer::new(peripherals.TIMG0);
timer0.disable();
let mut led = io.pins.gpio15.into_push_pull_output();
led.set_high().unwrap();
timer0.start(10_000_000u64);
loop {
led.toggle().unwrap();
block!(timer0.wait()).unwrap();
}
}