// @generated by `cargo xtask servo-player-generated` or `cargo check-all`. Do not edit by hand.
//! Module containing [`ServoPlayerGenerated`], the sample struct type generated by the
//! [`servo_player!`](crate::servo_player!) macro.
//!
//! Auto-generated.

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

#[cfg(all(not(doc), not(feature = "host")))]
servo_player! {
    ServoPlayerGenerated {
        pin: PIN_11,
    }
}

#[cfg(doc)]
/// Sample struct type generated by the [`servo_player!`](crate::servo_player!) macro, showing all methods and constants.
///
/// This page serves as the definitive reference for what a generated servo player type
/// provides. For first-time readers, start with the examples in the [`servo_player`](mod@crate::servo_player) module
/// documentation, then return here for a complete list of available methods and
/// associated constants.
///
/// Auto-generated.
pub struct ServoPlayerGenerated;

#[cfg(doc)]
use crate::Result;
#[cfg(doc)]
use crate::servo_player::AtEnd;
#[cfg(doc)]
use embassy_time::Duration;

#[cfg(doc)]
// Must be public for macro expansion in downstream crates, but not user-facing API.
#[doc(hidden)]
/// Static resources for `ServoPlayerGenerated`.
///
/// See the [`servo_player`](mod@crate::servo_player) module docs for usage.
pub struct ServoPlayerGeneratedStatic;

#[cfg(doc)]
impl ServoPlayerGenerated {
    /// Maximum number of animation steps allowed.
    ///
    /// Specified in the [`servo_player!`](macro@crate::servo_player) macro.
    pub const MAX_STEPS: usize = 16;

    /// Create static resources.
    ///
    /// See the [`servo_player`](mod@crate::servo_player) module docs for usage.
    #[must_use]
    #[doc(hidden)]
    pub const fn new_static() -> ServoPlayerGeneratedStatic {
        ServoPlayerGeneratedStatic {
            servo_player_static: ServoPlayerStatic::new_static(),
        }
    }

    /// Create a new servo player instance of the struct type
    /// defined by [`servo_player!`](macro@crate::servo_player).
    ///
    /// See the [`servo_player`](mod@crate::servo_player) module docs for usage.
    ///
    /// The `pin` and `slice` parameters must correspond to the
    /// GPIO pin specified in the macro.
    ///
    /// # Parameters
    ///
    /// - `pin`: GPIO pin for servo
    /// - `slice`: [PWM slice](crate#glossary) for servo control (`slice = (pin / 2) % 8`)
    /// - `spawner`: Task spawner for background operations
    pub fn new(
        pin: embassy_rp::Peri<'static, embassy_rp::peripherals::PIN_11>,
        slice: embassy_rp::Peri<'static, embassy_rp::peripherals::PWM_SLICE5>,
        spawner: embassy_executor::Spawner,
    ) -> Result<&'static Self> {
        static INSTANCE: ServoPlayerGenerated = ServoPlayerGenerated;
        let _ = (pin, slice, spawner);
        Ok(&INSTANCE)
    }

    /// Set the target angle. The most recent command always wins.
    ///
    /// See the [`servo_player`](mod@crate::servo_player) module docs for usage.
    pub fn set_degrees(&self, degrees: u16) {
        let _ = degrees;
    }

    /// Hold the servo at its current position.
    ///
    /// See the [`servo_player`](mod@crate::servo_player) module docs for usage.
    pub fn hold(&self) {}

    /// Relax the servo. Servo can move freely.
    ///
    /// See the [`servo_player`](mod@crate::servo_player) module docs for usage.
    pub fn relax(&self) {}

    /// Animate the servo through a sequence of angles with per-step hold durations.
    ///
    /// Each step is a tuple `(degrees, duration)`. Accepts both owned iterators and
    /// references to collections.
    ///
    /// See the [`servo_player`](mod@crate::servo_player) module docs for usage.
    pub fn animate<I>(&self, steps: I, at_end: AtEnd)
    where
        I: IntoIterator,
        I::Item: core::borrow::Borrow<(u16, Duration)>,
    {
        let _ = (steps, at_end);
    }
}
