Skip to main content

device_envoy_esp/led2d/
led2d_generated.rs

1// @generated by `cargo check-all`. Do not edit by hand.
2//! Module containing [`Led2dGenerated`], the sample struct type generated by
3//! the [`led2d!`](macro@crate::led2d) macro.
4//!
5//! Auto-generated.
6
7#[cfg(all(not(doc), not(feature = "host"), target_os = "none"))]
8use crate::led2d;
9
10#[cfg(all(not(doc), not(feature = "host"), target_os = "none"))]
11const LED_LAYOUT_12X4: crate::led2d::LedLayout<48, 12, 4> =
12    crate::led2d::LedLayout::serpentine_column_major();
13
14#[cfg(all(not(doc), not(feature = "host"), target_os = "none"))]
15led2d! {
16    Led2dGenerated {
17        pin: GPIO2,
18        len: 48,
19        led_layout: LED_LAYOUT_12X4,
20        max_current: crate::led_strip::Current::Milliamps(250),
21        font: crate::led2d::Led2dFont::Font3x4Trim,
22    }
23}
24
25#[cfg(doc)]
26/// Sample struct type generated by the [`led2d!`](macro@crate::led2d) macro.
27///
28/// This page exists to show constructor, constants, and trait methods in one
29/// place. For narrative examples, see the [`led2d`](mod@crate::led2d) module.
30///
31/// Auto-generated.
32pub struct Led2dGenerated;
33
34#[cfg(doc)]
35use crate::led2d::{Frame2d, Led2d, Led2dFont, Point, Size};
36#[cfg(doc)]
37use crate::Result;
38
39#[cfg(doc)]
40impl Led2dGenerated {
41    /// Maximum number of animation frames.
42    pub const MAX_FRAMES: usize = 16;
43    /// Maximum brightness level after current limiting.
44    pub const MAX_BRIGHTNESS: u8 = 22;
45    /// Default font used by text helpers.
46    pub const FONT: Led2dFont = Led2dFont::Font3x4Trim;
47    /// Panel width in pixels.
48    pub const WIDTH: usize = 12;
49    /// Panel height in pixels.
50    pub const HEIGHT: usize = 4;
51    /// Total LED count (`WIDTH * HEIGHT`).
52    pub const LEN: usize = 48;
53    /// Panel dimensions.
54    pub const SIZE: Size = Frame2d::<12, 4>::SIZE;
55    /// Top-left corner coordinate.
56    pub const TOP_LEFT: Point = Frame2d::<12, 4>::TOP_LEFT;
57    /// Top-right corner coordinate.
58    pub const TOP_RIGHT: Point = Frame2d::<12, 4>::TOP_RIGHT;
59    /// Bottom-left corner coordinate.
60    pub const BOTTOM_LEFT: Point = Frame2d::<12, 4>::BOTTOM_LEFT;
61    /// Bottom-right corner coordinate.
62    pub const BOTTOM_RIGHT: Point = Frame2d::<12, 4>::BOTTOM_RIGHT;
63
64    /// Create a new LED panel instance of the struct type defined by
65    /// [`led2d!`](macro@crate::led2d).
66    ///
67    /// See the [`led2d`](mod@crate::led2d) module docs for usage examples.
68    pub fn new(
69        pin: impl Sized,
70        channel_creator: impl Sized,
71        spawner: embassy_executor::Spawner,
72    ) -> Result<&'static Self> {
73        static INSTANCE: Led2dGenerated = Led2dGenerated;
74        let _ = (pin, channel_creator, spawner);
75        Ok(&INSTANCE)
76    }
77}
78
79#[cfg(doc)]
80impl Led2d<12, 4> for &'static Led2dGenerated {
81    const WIDTH: usize = Led2dGenerated::WIDTH;
82    const HEIGHT: usize = Led2dGenerated::HEIGHT;
83    const LEN: usize = Led2dGenerated::LEN;
84    const SIZE: Size = Led2dGenerated::SIZE;
85    const TOP_LEFT: Point = Led2dGenerated::TOP_LEFT;
86    const TOP_RIGHT: Point = Led2dGenerated::TOP_RIGHT;
87    const BOTTOM_LEFT: Point = Led2dGenerated::BOTTOM_LEFT;
88    const BOTTOM_RIGHT: Point = Led2dGenerated::BOTTOM_RIGHT;
89    const MAX_FRAMES: usize = Led2dGenerated::MAX_FRAMES;
90    const MAX_BRIGHTNESS: u8 = Led2dGenerated::MAX_BRIGHTNESS;
91    const FONT: Led2dFont = Led2dGenerated::FONT;
92
93    fn write_frame(&self, frame2d: Frame2d<12, 4>) {
94        let _ = frame2d;
95    }
96
97    fn animate<I>(&self, frames: I)
98    where
99        I: IntoIterator,
100        I::Item: core::borrow::Borrow<(Frame2d<12, 4>, embassy_time::Duration)>,
101    {
102        let _ = frames;
103    }
104}