Skip to main content

Led2dGenerated

Struct Led2dGenerated 

Source
pub struct Led2dGenerated;
Expand description

Sample struct type generated by the 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 module documentation, then return here for a complete list of available methods and associated constants.

Auto-generated.

Implementations§

Source§

impl Led2dGenerated

Source

pub const WIDTH: usize = 12

The width of the panel.

Source

pub const HEIGHT: usize = 4

The height of the panel.

Source

pub const SIZE: Size = Frame2d<12, 4>::SIZE

Panel dimensions as a Size.

For embedded-graphics drawing operation.

Source

pub const TOP_LEFT: Point = Frame2d<12, 4>::TOP_LEFT

Top-left corner coordinate as a Point.

For embedded-graphics drawing operation.

Source

pub const TOP_RIGHT: Point = Frame2d<12, 4>::TOP_RIGHT

Top-right corner coordinate as a Point.

For embedded-graphics drawing operation.

Source

pub const BOTTOM_LEFT: Point = Frame2d<12, 4>::BOTTOM_LEFT

Bottom-left corner coordinate as a Point.

For embedded-graphics drawing operation.

Source

pub const BOTTOM_RIGHT: Point = Frame2d<12, 4>::BOTTOM_RIGHT

Bottom-right corner coordinate as a Point.

For embedded-graphics drawing operation.

Source

pub const LEN: usize = 48

Total LEDs in this panel (width × height).

Source

pub const MAX_BRIGHTNESS: u8

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! macro. This constant is the result of calculating how much brightness is safe given that budget and the number of LEDs.

Source

pub const MAX_FRAMES: usize = 16

Maximum number of animation frames allowed.

Specified in the led2d! or led_strips! macro.

Source

pub fn new( pin: Peri<'static, PIN_3>, pio: Peri<'static, PIO0>, dma: Peri<'static, DMA_CH0>, spawner: Spawner, ) -> Result<Self>

Create a new LED panel instance of the struct type defined by led2d!.

See the 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
Source

pub fn write_frame( &self, frame: Frame2d<{ Self::WIDTH }, { Self::HEIGHT }>, ) -> Result<()>

Write a frame to the LED panel.

See the led2d module docs for usage.

Source

pub async fn write_text(&self, text: &str, colors: &[RGB8]) -> Result<()>

Write text to the LED panel.

See the led2d module docs for usage.

Source

pub fn write_text_to_frame( &self, text: &str, colors: &[RGB8], frame: &mut Frame2d<{ Self::WIDTH }, { Self::HEIGHT }>, ) -> Result<()>

Write text into a frame.

See the led2d module docs for usage.

Source

pub fn animate<const N: usize>( &self, frames: [(Frame2d<{ Self::WIDTH }, { Self::HEIGHT }>, Duration); N], ) -> Result<()>

Animate frames on the LED panel.

See the led2d module docs for usage.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<Src, Dst> LosslessTryInto<Dst> for Src
where Dst: LosslessTryFrom<Src>,

Source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
Source§

impl<Src, Dst> LossyInto<Dst> for Src
where Dst: LossyFrom<Src>,

Source§

fn lossy_into(self) -> Dst

Performs the conversion.
Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> StrictAs for T

Source§

fn strict_as<Dst>(self) -> Dst
where T: StrictCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> StrictCastFrom<Src> for Dst
where Src: StrictCast<Dst>,

Source§

fn strict_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.