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