use anyhow::Result;
use esp_idf_svc::{
    hal::{
        gpio::{InterruptType, PinDriver, Pull},
        peripherals::Peripherals,
        task::notification::Notification,
    },
    sys::esp_random,
};
use rgb_led::{RGB8, WS2812RMT};
use std::num::NonZeroU32;

fn main() -> Result<()> {
    esp_idf_svc::sys::link_patches();

    let peripherals = Peripherals::take()?;

    // 1. Configure the button using PinDriver
    // let mut button = PinDriver...

    // 2. Instantiate a new notification and notifier

    unsafe {
        // 3. Create a subscription and its callback function that notifies and yields.
    }

    loop {
        unsafe {
            // 4. Enable the interrupt for the button
            // 5. Wait for notification using `esp_idf_svc::hal::delay::BLOCK`
            // 6. Print a "button pressed" message
        }
    }
}
esp:0
esp:1
esp:2
esp:3
esp:4
esp:5
esp:6
esp:7
esp:9
esp:10
esp:18
esp:19
esp:20
esp:21
esp:RST
esp:3V3
esp:NC1
esp:GND
esp:8.1
esp:8.2
esp:NC2
esp:NC3
esp:NC4
esp:NC5
esp:NC6
esp:5V
esp:EN
esp:BAT+
btn1:1.l
btn1:2.l
btn1:1.r
btn1:2.r