// @generated - manually created as documentation example. Do not auto-generate.
//! Module containing [`ButtonWatchGenerated`], the sample struct type generated by the
//! [`button_watch!`](crate::button_watch!) macro.
//!
//! This file shows what the macro expansion looks like for documentation purposes.

#[cfg(all(not(doc), not(feature = "host"), target_os = "none"))]
use crate::button_watch;

#[cfg(all(not(doc), not(feature = "host"), target_os = "none"))]
button_watch! {
    pub ButtonWatchGenerated {
        pin: GPIO13,
    }
}

#[cfg(doc)]
/// Sample struct type generated by the [`button_watch!`](crate::button_watch!) macro, showing all methods.
///
/// This page serves as the definitive reference for what a generated button watch type
/// provides. For first-time readers, start with the examples in the [`button_watch!`](crate::button_watch!)
/// macro documentation, then return here for a complete list of available methods.
pub struct ButtonWatchGenerated;

#[cfg(doc)]
impl ButtonWatchGenerated {
    /// Creates a new button monitor and spawns its background task.
    ///
    /// # Parameters
    ///
    /// - `button_pin`: GPIO pin for the button
    /// - `pressed_to`: How the button is wired ([`PressedTo::Ground`](crate::button::PressedTo::Ground) or [`PressedTo::Voltage`](crate::button::PressedTo::Voltage))
    /// - `spawner`: Task spawner for background operations
    ///
    /// # Errors
    ///
    /// Returns an error if the background task cannot be spawned.
    ///
    /// # Example
    ///
    /// See the [`button_watch!`](crate::button_watch!) macro for usage.
    pub async fn new(
        button_pin: impl Sized,
        pressed_to: crate::button::PressedTo,
        spawner: embassy_executor::Spawner,
    ) -> crate::Result<&'static mut Self> {
        static INSTANCE: static_cell::StaticCell<ButtonWatchGenerated> =
            static_cell::StaticCell::new();
        let instance = INSTANCE.init(ButtonWatchGenerated);
        let _ = (button_pin, pressed_to, spawner);
        Ok(instance)
    }
}

#[cfg(doc)]
impl crate::button::__ButtonMonitor for ButtonWatchGenerated {
    fn is_pressed_raw(&self) -> bool {
        false
    }

    async fn wait_until_pressed_state(&mut self, pressed: bool) {
        let _ = pressed;
    }
}

#[cfg(doc)]
impl crate::button::Button for ButtonWatchGenerated {}
