Struct TiledFrameBuffer

Source
pub struct TiledFrameBuffer<F, M: PixelRemapper, const PANEL_ROWS: usize, const PANEL_COLS: usize, const NROWS: usize, const BITS: u8, const FRAME_COUNT: usize, const TILE_ROWS: usize, const TILE_COLS: usize, const FB_COLS: usize>(/* private fields */);
Expand description

Tile together multiple displays in a certain configuration to form a single larger display

This is a wrapper around an actual framebuffer implementation which can be used to tile multiple LED matrices together by using a certain pixel remapping strategy.

§Type Parameters

  • F - The type of the underlying framebuffer which will drive the display
  • M - The pixel remapping strategy (see implementers of PixelRemapper) to use to map the virtual framebuffer to the actual framebuffer
  • PANEL_ROWS - Number of rows in a single panel
  • PANEL_COLS - Number of columns in a single panel
  • NROWS: Number of rows per scan (typically half of ROWS)
  • BITS: Color depth (1-8 bits)
  • FRAME_COUNT: Number of frames used for Binary Code Modulation
  • TILE_ROWS - Number of panels stacked vertically
  • TILE_COLS - Number of panels stacked horizontally
  • FB_COLS - Number of columns that the actual framebuffer must have to drive all display

§Example

use hub75_framebuffer::{compute_frame_count, compute_rows};
use hub75_framebuffer::plain::DmaFrameBuffer;
use hub75_framebuffer::tiling::{TiledFrameBuffer, ChainTopRightDown, compute_tiled_cols};

const TILED_COLS: usize = 3;
const TILED_ROWS: usize = 3;
const ROWS: usize = 32;
const PANEL_COLS: usize = 64;
const FB_COLS: usize = compute_tiled_cols(PANEL_COLS, TILED_ROWS, TILED_COLS);
const BITS: u8 = 2;
const NROWS: usize = compute_rows(ROWS);
const FRAME_COUNT: usize = compute_frame_count(BITS);

type FBType = DmaFrameBuffer<ROWS, FB_COLS, NROWS, BITS, FRAME_COUNT>;
type TiledFBType = TiledFrameBuffer<
    FBType,
    ChainTopRightDown<ROWS, PANEL_COLS, TILED_ROWS, TILED_COLS>,
    ROWS,
    PANEL_COLS,
    NROWS,
    BITS,
    FRAME_COUNT,
    TILED_ROWS,
    TILED_COLS,
    FB_COLS,
>;

let mut fb = TiledFBType::new();

// Now fb is ready to be used and can be treated like one big canvas (192*96 pixels in this example)

Implementations§

Source§

impl<F: Default, M: PixelRemapper, const PANEL_ROWS: usize, const PANEL_COLS: usize, const NROWS: usize, const BITS: u8, const FRAME_COUNT: usize, const TILE_ROWS: usize, const TILE_COLS: usize, const FB_COLS: usize> TiledFrameBuffer<F, M, PANEL_ROWS, PANEL_COLS, NROWS, BITS, FRAME_COUNT, TILE_ROWS, TILE_COLS, FB_COLS>

Source

pub fn new() -> Self

Create a new “virtual display” that takes ownership of the underlying framebuffer and remaps any pixels written to it to the correct locations of the underlying framebuffer based on the given PixelRemapper

Trait Implementations§

Source§

impl<F: Debug, M: Debug + PixelRemapper, const PANEL_ROWS: usize, const PANEL_COLS: usize, const NROWS: usize, const BITS: u8, const FRAME_COUNT: usize, const TILE_ROWS: usize, const TILE_COLS: usize, const FB_COLS: usize> Debug for TiledFrameBuffer<F, M, PANEL_ROWS, PANEL_COLS, NROWS, BITS, FRAME_COUNT, TILE_ROWS, TILE_COLS, FB_COLS>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<F: Default, M: PixelRemapper, const PANEL_ROWS: usize, const PANEL_COLS: usize, const NROWS: usize, const BITS: u8, const FRAME_COUNT: usize, const TILE_ROWS: usize, const TILE_COLS: usize, const FB_COLS: usize> Default for TiledFrameBuffer<F, M, PANEL_ROWS, PANEL_COLS, NROWS, BITS, FRAME_COUNT, TILE_ROWS, TILE_COLS, FB_COLS>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<F: DrawTarget<Error = Infallible, Color = Color>, M: PixelRemapper, const PANEL_ROWS: usize, const PANEL_COLS: usize, const NROWS: usize, const BITS: u8, const FRAME_COUNT: usize, const TILE_ROWS: usize, const TILE_COLS: usize, const FB_COLS: usize> DrawTarget for TiledFrameBuffer<F, M, PANEL_ROWS, PANEL_COLS, NROWS, BITS, FRAME_COUNT, TILE_ROWS, TILE_COLS, FB_COLS>

Source§

type Color = Rgb888

The pixel color type the targetted display supports.
Source§

type Error = Infallible

Error type to return when a drawing operation fails. Read more
Source§

fn draw_iter<I>(&mut self, pixels: I) -> Result<(), Self::Error>
where I: IntoIterator<Item = Pixel<Self::Color>>,

Draw individual pixels to the display without a defined order. Read more
Source§

fn fill_contiguous<I>( &mut self, area: &Rectangle, colors: I, ) -> Result<(), Self::Error>
where I: IntoIterator<Item = Self::Color>,

Fill a given area with an iterator providing a contiguous stream of pixel colors. Read more
Source§

fn fill_solid( &mut self, area: &Rectangle, color: Self::Color, ) -> Result<(), Self::Error>

Fill a given area with a solid color. Read more
Source§

fn clear(&mut self, color: Self::Color) -> Result<(), Self::Error>

Fill the entire display with a solid color. Read more
Source§

impl<F: FrameBuffer<PANEL_ROWS, FB_COLS, NROWS, BITS, FRAME_COUNT>, M: PixelRemapper, const PANEL_ROWS: usize, const PANEL_COLS: usize, const NROWS: usize, const BITS: u8, const FRAME_COUNT: usize, const TILE_ROWS: usize, const TILE_COLS: usize, const FB_COLS: usize> FrameBuffer<PANEL_ROWS, FB_COLS, NROWS, BITS, FRAME_COUNT> for TiledFrameBuffer<F, M, PANEL_ROWS, PANEL_COLS, NROWS, BITS, FRAME_COUNT, TILE_ROWS, TILE_COLS, FB_COLS>

Source§

fn get_word_size(&self) -> WordSize

Returns the word size configuration for this framebuffer
Source§

impl<F: FrameBufferOperations<PANEL_ROWS, FB_COLS, NROWS, BITS, FRAME_COUNT> + FrameBuffer<PANEL_ROWS, FB_COLS, NROWS, BITS, FRAME_COUNT>, M: PixelRemapper, const PANEL_ROWS: usize, const PANEL_COLS: usize, const NROWS: usize, const BITS: u8, const FRAME_COUNT: usize, const TILE_ROWS: usize, const TILE_COLS: usize, const FB_COLS: usize> FrameBufferOperations<PANEL_ROWS, FB_COLS, NROWS, BITS, FRAME_COUNT> for TiledFrameBuffer<F, M, PANEL_ROWS, PANEL_COLS, NROWS, BITS, FRAME_COUNT, TILE_ROWS, TILE_COLS, FB_COLS>

Source§

fn erase(&mut self)

Erase pixel colors while preserving control bits. This is much faster than format() and is the typical way to clear the display.
Source§

fn set_pixel(&mut self, p: Point, color: Color)

Set a pixel in the framebuffer.
Source§

impl<F: DrawTarget<Error = Infallible, Color = Color>, M: PixelRemapper, const PANEL_ROWS: usize, const PANEL_COLS: usize, const NROWS: usize, const BITS: u8, const FRAME_COUNT: usize, const TILE_ROWS: usize, const TILE_COLS: usize, const FB_COLS: usize> OriginDimensions for TiledFrameBuffer<F, M, PANEL_ROWS, PANEL_COLS, NROWS, BITS, FRAME_COUNT, TILE_ROWS, TILE_COLS, FB_COLS>

Source§

fn size(&self) -> Size

Returns the size of the bounding box.
Source§

impl<T, F: ReadBuffer<Word = T>, M: PixelRemapper, const PANEL_ROWS: usize, const PANEL_COLS: usize, const NROWS: usize, const BITS: u8, const FRAME_COUNT: usize, const TILE_ROWS: usize, const TILE_COLS: usize, const FB_COLS: usize> ReadBuffer for TiledFrameBuffer<F, M, PANEL_ROWS, PANEL_COLS, NROWS, BITS, FRAME_COUNT, TILE_ROWS, TILE_COLS, FB_COLS>

Source§

type Word = T

Source§

unsafe fn read_buffer(&self) -> (*const T, usize)

Provide a buffer usable for DMA reads. Read more

Auto Trait Implementations§

§

impl<F, M, const PANEL_ROWS: usize, const PANEL_COLS: usize, const NROWS: usize, const BITS: u8, const FRAME_COUNT: usize, const TILE_ROWS: usize, const TILE_COLS: usize, const FB_COLS: usize> Freeze for TiledFrameBuffer<F, M, PANEL_ROWS, PANEL_COLS, NROWS, BITS, FRAME_COUNT, TILE_ROWS, TILE_COLS, FB_COLS>
where F: Freeze,

§

impl<F, M, const PANEL_ROWS: usize, const PANEL_COLS: usize, const NROWS: usize, const BITS: u8, const FRAME_COUNT: usize, const TILE_ROWS: usize, const TILE_COLS: usize, const FB_COLS: usize> RefUnwindSafe for TiledFrameBuffer<F, M, PANEL_ROWS, PANEL_COLS, NROWS, BITS, FRAME_COUNT, TILE_ROWS, TILE_COLS, FB_COLS>

§

impl<F, M, const PANEL_ROWS: usize, const PANEL_COLS: usize, const NROWS: usize, const BITS: u8, const FRAME_COUNT: usize, const TILE_ROWS: usize, const TILE_COLS: usize, const FB_COLS: usize> Send for TiledFrameBuffer<F, M, PANEL_ROWS, PANEL_COLS, NROWS, BITS, FRAME_COUNT, TILE_ROWS, TILE_COLS, FB_COLS>
where F: Send, M: Send,

§

impl<F, M, const PANEL_ROWS: usize, const PANEL_COLS: usize, const NROWS: usize, const BITS: u8, const FRAME_COUNT: usize, const TILE_ROWS: usize, const TILE_COLS: usize, const FB_COLS: usize> Sync for TiledFrameBuffer<F, M, PANEL_ROWS, PANEL_COLS, NROWS, BITS, FRAME_COUNT, TILE_ROWS, TILE_COLS, FB_COLS>
where F: Sync, M: Sync,

§

impl<F, M, const PANEL_ROWS: usize, const PANEL_COLS: usize, const NROWS: usize, const BITS: u8, const FRAME_COUNT: usize, const TILE_ROWS: usize, const TILE_COLS: usize, const FB_COLS: usize> Unpin for TiledFrameBuffer<F, M, PANEL_ROWS, PANEL_COLS, NROWS, BITS, FRAME_COUNT, TILE_ROWS, TILE_COLS, FB_COLS>
where F: Unpin, M: Unpin,

§

impl<F, M, const PANEL_ROWS: usize, const PANEL_COLS: usize, const NROWS: usize, const BITS: u8, const FRAME_COUNT: usize, const TILE_ROWS: usize, const TILE_COLS: usize, const FB_COLS: usize> UnwindSafe for TiledFrameBuffer<F, M, PANEL_ROWS, PANEL_COLS, NROWS, BITS, FRAME_COUNT, TILE_ROWS, TILE_COLS, FB_COLS>
where F: UnwindSafe, M: UnwindSafe,

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> Dimensions for T

Source§

fn bounding_box(&self) -> Rectangle

Returns the bounding box.
Source§

impl<T> DrawTargetExt for T
where T: DrawTarget,

Source§

fn translated(&mut self, offset: Point) -> Translated<'_, T>

Creates a translated draw target based on this draw target. Read more
Source§

fn cropped(&mut self, area: &Rectangle) -> Cropped<'_, T>

Creates a cropped draw target based on this draw target. Read more
Source§

fn clipped(&mut self, area: &Rectangle) -> Clipped<'_, T>

Creates a clipped draw target based on this draw target. Read more
Source§

fn color_converted<C>(&mut self) -> ColorConverted<'_, T, C>
where C: PixelColor + Into<<T as DrawTarget>::Color>,

Creates a color conversion draw target. Read more
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> 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> 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, 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.