Skip to main content

TiledFrameBuffer

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 */);
๐Ÿ‘ŽDeprecated since 0.11.0:

use RemappedFrameBuffer<F, M> instead โ€“ it works with all framebuffer types and has a simpler signature

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 = !

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, 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 for TiledFrameBuffer<F, M, PANEL_ROWS, PANEL_COLS, NROWS, BITS, FRAME_COUNT, TILE_ROWS, TILE_COLS, FB_COLS>

Sourceยง

const BCM_SEQUENCE: [BcmLenReps; 10] = F::BCM_SEQUENCE

Static (len, reps) of the segments in one sequence, in scan order. Read more
Sourceยง

const BCM_SEQUENCE_LEN: usize = F::BCM_SEQUENCE_LEN

Number of BCM segments in one sequence, i.e. the number of meaningful entries in BCM_SEQUENCE.
Sourceยง

const BCM_SEQUENCE_COUNT: usize = F::BCM_SEQUENCE_COUNT

Number of times the sequence repeats in one complete panel refresh: NROWS for row-major framebuffers (one sequence per row), 1 for frame-major and threshold framebuffers (the sequence covers the whole frame).
Sourceยง

const BCM_SEGMENTS_PER_GROUP: usize = F::BCM_SEGMENTS_PER_GROUP

Number of consecutive segments that a driver may chain into a single DMA transfer. Must divide BCM_SEQUENCE_LEN: groups never straddle a sequence boundary. Read more
Sourceยง

type Word = <F as FrameBuffer>::Word

The DMA word type used by this framebuffer (u8 for latched, u16 for direct-drive). Driver implementations can use this to enforce that pin configurations match the framebuffer at compile time.
Sourceยง

fn bcm_segment_ptr(&self, index: usize) -> *const u8

Returns the byte pointer for the index-th BCM segment. Read more
Sourceยง

const BCM_SEGMENT_COUNT: usize = _

Total number of BCM segments streamed for one complete panel refresh (all rows, all planes). Read more
Sourceยง

fn bcm_segment_count(&self) -> usize

Total number of BCM segments streamed for one complete panel refresh. Read more
Sourceยง

fn bcm_segment(&self, index: usize) -> BcmSegment

Returns the index-th BCM segment. Read more
Sourceยง

fn bcm_segments_per_group(&self) -> usize

Number of consecutive segments that form one transfer group. Read more
Sourceยง

impl<F: FrameBufferOperations + FrameBuffer, 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 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: MutableFrameBuffer, 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> MutableFrameBuffer for TiledFrameBuffer<F, M, PANEL_ROWS, PANEL_COLS, NROWS, BITS, FRAME_COUNT, TILE_ROWS, TILE_COLS, FB_COLS>

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>

ยงDeprecated

This implementation is deprecated since 0.11.0. The driver now uses BcmSegment pointers instead of ReadBuffer for DMA transfers.

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, PhantomData<M>: 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, PhantomData<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, PhantomData<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, PhantomData<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> UnsafeUnpin 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> UnwindSafe for TiledFrameBuffer<F, M, PANEL_ROWS, PANEL_COLS, NROWS, BITS, FRAME_COUNT, TILE_ROWS, TILE_COLS, FB_COLS>

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 = !

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.