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

#[cfg(not(feature = "host"))]
use crate::led_strip::{Current, Gamma};
#[cfg(not(feature = "host"))]
use crate::led2d;
#[cfg(not(feature = "host"))]
use crate::led2d::Led2dFont;
#[cfg(not(feature = "host"))]
use crate::led2d::layout::LedLayout;

// 12×4 panel wired serpentine column-major (sample configuration)
#[cfg(not(feature = "host"))]
const LED_LAYOUT: LedLayout<48, 12, 4> = LedLayout::serpentine_column_major();

#[cfg(all(not(doc), not(feature = "host")))]
led2d! {
    Led2dGenerated {
        // PIO resource (default: PIO0)
        pio: PIO0,
        // GPIO pin for LED data signal
        pin: PIN_3,
        // DMA channel for LED data transfer (default: DMA_CH0)
        dma: DMA_CH0,
        // LED layout mapping (defines panel dimensions)
        led_layout: LED_LAYOUT,
        // Power budget (default: unlimited)
        max_current: Current::Unlimited,
        // Gamma correction mode (default: Gamma::Srgb)
        gamma: Gamma::Srgb,
        // Maximum number of animation frames (default: 16)
        max_frames: 16,
        // Font variant (see [`Led2dFont`](crate::led2d::Led2dFont) for available fonts)
        font: Led2dFont::Font3x4Trim,
    }
}

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

#[cfg(doc)]
use crate::led2d::{Frame2d, Point, Size};
#[cfg(doc)]
use crate::led_strip::RGB8;
#[cfg(doc)]
use crate::Result;

#[cfg(doc)]
#[cfg(doc)]
// Must be public for macro expansion in downstream crates, but not user-facing API.
#[doc(hidden)]
/// LED strip type generated by `led2d!` for this example.
/// 
/// See the [`led2d`](mod@crate::led2d) module docs for usage.
pub struct Led2dGeneratedLedStrip;

#[cfg(doc)]
impl Led2dGenerated {
    /// The width of the panel.
    pub const WIDTH: usize = 12;
    /// The height of the panel.
    pub const HEIGHT: usize = 4;
    /// Panel dimensions as a [`Size`].
    ///
    /// For [`embedded-graphics`](https://docs.rs/embedded-graphics) drawing operation.
    pub const SIZE: Size = Frame2d::<12, 4>::SIZE;
    /// Top-left corner coordinate as a [`Point`].
    ///
    /// For [`embedded-graphics`](https://docs.rs/embedded-graphics) drawing operation.
    pub const TOP_LEFT: Point = Frame2d::<12, 4>::TOP_LEFT;
    /// Top-right corner coordinate as a [`Point`].
    ///
    /// For [`embedded-graphics`](https://docs.rs/embedded-graphics) drawing operation.
    pub const TOP_RIGHT: Point = Frame2d::<12, 4>::TOP_RIGHT;
    /// Bottom-left corner coordinate as a [`Point`].
    ///
    /// For [`embedded-graphics`](https://docs.rs/embedded-graphics) drawing operation.
    pub const BOTTOM_LEFT: Point = Frame2d::<12, 4>::BOTTOM_LEFT;
    /// Bottom-right corner coordinate as a [`Point`].
    ///
    /// For [`embedded-graphics`](https://docs.rs/embedded-graphics) drawing operation.
    pub const BOTTOM_RIGHT: Point = Frame2d::<12, 4>::BOTTOM_RIGHT;
    /// Total LEDs in this panel (width × height).
    pub const LEN: usize = 48;
    /// Maximum brightness level, automatically limited by the power budget specified in `max_current`.
    ///
    /// We assume each LED draws 60 mA at full brightness. The actual limit depends on
    /// the power budget you specified in the [`led2d!`] or [`led_strips!`](crate::led_strips!) macro.
    /// This constant is the result
    /// of calculating how much brightness is safe given that budget and the number of LEDs.
    pub const MAX_BRIGHTNESS: u8 =
        Current::Unlimited.max_brightness(Self::LEN as u32 * 60);
    /// Maximum number of animation frames allowed.
    /// 
    /// Specified in the [`led2d!`] or [`led_strips!`](crate::led_strips!) macro.
    pub const MAX_FRAMES: usize = 16;

    /// Create a new LED panel instance of the struct type
    /// defined by [`led2d!`].
    ///
    /// See the [`led2d`](mod@crate::led2d) module docs for usage.
    ///
    /// The `pin`, `pio`, and `dma` parameters must correspond to the
    /// GPIO pin, PIO resource, and DMA channel specified in the macro.
    ///
    /// The [`led2d!`] macro defaults to `PIO0` and `DMA_CH0` if not specified.
    ///
    /// # Parameters
    ///
    /// - `pin`: GPIO pin for LED data signal
    /// - `pio`: PIO resource
    /// - `dma`: DMA channel for LED data transfer
    /// - `spawner`: Task spawner for background operations
    pub fn new(
        pin: embassy_rp::Peri<'static, embassy_rp::peripherals::PIN_3>,
        pio: embassy_rp::Peri<'static, embassy_rp::peripherals::PIO0>,
        dma: embassy_rp::Peri<'static, embassy_rp::peripherals::DMA_CH0>,
        spawner: embassy_executor::Spawner,
    ) -> Result<Self> {
        let _ = (pin, pio, dma, spawner);
        Ok(Self)
    }

    /// Create a new LED panel instance from a strip.
    ///
    /// See the [`led2d`](mod@crate::led2d) module docs for usage.
    pub(crate) fn from_strip(
        led_strip: &'static Led2dGeneratedLedStrip,
    ) -> Result<Self> {
        let _ = led_strip;
        Ok(Self)
    }

    /// Write a frame to the LED panel.
    ///
    /// See the [`led2d`](mod@crate::led2d) module docs for usage.
    pub fn write_frame(
        &self,
        frame: Frame2d<{ Self::WIDTH }, { Self::HEIGHT }>,
    ) -> Result<()> {
        let _ = frame;
        Ok(())
    }

    /// Write text to the LED panel.
    ///
    /// See the [`led2d`](mod@crate::led2d) module docs for usage.
    pub async fn write_text(&self, text: &str, colors: &[RGB8]) -> Result<()> {
        let _ = (text, colors);
        Ok(())
    }

    /// Write text into a frame.
    ///
    /// See the [`led2d`](mod@crate::led2d) module docs for usage.
    pub fn write_text_to_frame(
        &self,
        text: &str,
        colors: &[RGB8],
        frame: &mut Frame2d<{ Self::WIDTH }, { Self::HEIGHT }>,
    ) -> Result<()> {
        let _ = (text, colors, frame);
        Ok(())
    }

    /// Animate frames on the LED panel.
    ///
    /// See the [`led2d`](mod@crate::led2d) module docs for usage.
    pub fn animate<const N: usize>(
        &self,
        frames: [(Frame2d<{ Self::WIDTH }, { Self::HEIGHT }>, embassy_time::Duration); N],
    ) -> Result<()> {
        let _ = frames;
        Ok(())
    }
}
