#![no_std]
#![no_main]

use core::panic::PanicInfo;
use esp32c3_hal::prelude::*;
//use esp32c3_hal::Peripherals;
use embedded_hal::digital::v2::OutputPin;

// Pin 8 for LED
const LED_PIN: u32 = 8;

#[entry]
fn main() -> ! {
    // Get the device peripherals
    let peripherals = peripherals::take().unwrap();

    // Configure the LED pin as a digital output
    let gpioa = peripherals.GPIO.split();
    let mut led = gpioa.gpio8.into_push_pull_output();

    // Blink the LED
    loop {
        led.set_high().unwrap();
        cortex_m::asm::delay(1000000);
        led.set_low().unwrap();
        cortex_m::asm::delay(1000000);
    }
}

#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
    loop {}
}