pub struct DmaFrameBuffer<const NROWS: usize, const COLS: usize, const PLANES: usize> { /* private fields */ }Expand description
Row-major BCM framebuffer for row-by-row Binary Code Modulation.
See the module-level documentation for layout details and DMA descriptor patterns.
§Type Parameters
NROWS: number of multiplexed row pairs (panel height / 2)COLS: number of columns (panel width)PLANES: number of bit-planes (typically 8 for full 8-bit colour)
Implementations§
Source§impl<const NROWS: usize, const COLS: usize, const PLANES: usize> DmaFrameBuffer<NROWS, COLS, PLANES>
impl<const NROWS: usize, const COLS: usize, const PLANES: usize> DmaFrameBuffer<NROWS, COLS, PLANES>
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Creates a new framebuffer, pre-formatted and ready for use.
§Panics
Panics if NROWS is not within 1..=32 (5-bit row address) or
PLANES is not within 1..=8 (8-bit color depth). With the
esp32-ordering feature, also panics if COLS is not even (the
ESP32’s byte-order swap requires an even column count). In const
contexts (e.g. static framebuffers) this is a compile-time error.
§Memory placement (⚠️ large buffer)
This framebuffer is a large inline array (roughly
PLANES × NROWS × (COLS + gap) × 2 bytes). A 64×64 panel at
PLANES = 8 is tens of kilobytes, which will overflow a task stack if
bound to a local let. The framebuffer is mutable, so give it a
'static home that hands out &'static mut (e.g.
static_cell::StaticCell) — never static mut. See the crate-level
Memory placement section for a worked example.
Sourcepub const fn bcm_chunk_count() -> usize
👎Deprecated since 0.11.0: use BCM_SEQUENCE instead
pub const fn bcm_chunk_count() -> usize
use BCM_SEQUENCE instead
Number of bit-planes.
Sourcepub const fn bcm_chunk_bytes() -> usize
👎Deprecated since 0.11.0: use BCM_SEQUENCE instead
pub const fn bcm_chunk_bytes() -> usize
use BCM_SEQUENCE instead
Byte size of one plane’s pixel row.
Sourcepub const fn bcm_row_count() -> usize
pub const fn bcm_row_count() -> usize
Number of multiplexed scan rows.
Sourcepub const fn bcm_row_bytes() -> usize
pub const fn bcm_row_bytes() -> usize
Byte size of the per-row overhead (inter-row gap + optional tail).
Sourcepub const fn format(&mut self)
pub const fn format(&mut self)
Formats the framebuffer with row addresses and control bits.
Plane 0 (LSB, 1 rep) uses prev_addr so the brief display of
stale data from the previous row has minimal visual weight.
Planes 1+ use the current row address. Blanking is applied only
around the plane0→plane1 address change (plus plane 0’s trail
blank when PLANES == 1); see the module-level documentation for
the exact distribution.
Sourcepub fn pixel_row_ptr_len(
&self,
row_idx: usize,
plane_idx: usize,
) -> (*const u8, usize)
pub fn pixel_row_ptr_len( &self, row_idx: usize, plane_idx: usize, ) -> (*const u8, usize)
Returns a pointer and byte length for a plane’s pixel row.
§Panics
Panics if row_idx >= NROWS or plane_idx >= PLANES.
Sourcepub fn gap_ptr_len(&self, row_idx: usize) -> (*const u8, usize)
pub fn gap_ptr_len(&self, row_idx: usize) -> (*const u8, usize)
Returns a pointer and byte length for a row’s inter-row blanking gap.
The gap is streamed as the tail of plane 0’s segment (LSB) and holds
the previous row address with OE blank, deferring the address change
until after the gap. Returns length 0 when no inter-row-blank-*
feature is enabled.
§Panics
Panics if row_idx >= NROWS.
Trait Implementations§
Source§impl<const NROWS: usize, const COLS: usize, const PLANES: usize> Clone for DmaFrameBuffer<NROWS, COLS, PLANES>
impl<const NROWS: usize, const COLS: usize, const PLANES: usize> Clone for DmaFrameBuffer<NROWS, COLS, PLANES>
impl<const NROWS: usize, const COLS: usize, const PLANES: usize> Copy for DmaFrameBuffer<NROWS, COLS, PLANES>
Source§impl<const NROWS: usize, const COLS: usize, const PLANES: usize> Debug for DmaFrameBuffer<NROWS, COLS, PLANES>
impl<const NROWS: usize, const COLS: usize, const PLANES: usize> Debug for DmaFrameBuffer<NROWS, COLS, PLANES>
Source§impl<const NROWS: usize, const COLS: usize, const PLANES: usize> Default for DmaFrameBuffer<NROWS, COLS, PLANES>
impl<const NROWS: usize, const COLS: usize, const PLANES: usize> Default for DmaFrameBuffer<NROWS, COLS, PLANES>
Source§impl<const NROWS: usize, const COLS: usize, const PLANES: usize> DrawTarget for DmaFrameBuffer<NROWS, COLS, PLANES>
impl<const NROWS: usize, const COLS: usize, const PLANES: usize> DrawTarget for DmaFrameBuffer<NROWS, COLS, PLANES>
Source§fn draw_iter<I>(&mut self, pixels: I) -> Result<(), Self::Error>
fn draw_iter<I>(&mut self, pixels: I) -> Result<(), Self::Error>
Source§fn fill_contiguous<I>(
&mut self,
area: &Rectangle,
colors: I,
) -> Result<(), Self::Error>where
I: IntoIterator<Item = Self::Color>,
fn fill_contiguous<I>(
&mut self,
area: &Rectangle,
colors: I,
) -> Result<(), Self::Error>where
I: IntoIterator<Item = Self::Color>,
Source§impl<const NROWS: usize, const COLS: usize, const PLANES: usize> FrameBuffer for DmaFrameBuffer<NROWS, COLS, PLANES>
impl<const NROWS: usize, const COLS: usize, const PLANES: usize> FrameBuffer for DmaFrameBuffer<NROWS, COLS, PLANES>
Source§const BCM_SEQUENCE: [BcmLenReps; 10]
const BCM_SEQUENCE: [BcmLenReps; 10]
(len, reps) of the segments in one sequence, in scan
order. Read moreSource§const BCM_SEQUENCE_LEN: usize = PLANES
const BCM_SEQUENCE_LEN: usize = PLANES
BCM_SEQUENCE.Source§const BCM_SEQUENCE_COUNT: usize = NROWS
const BCM_SEQUENCE_COUNT: usize = NROWS
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 = PLANES
const BCM_SEGMENTS_PER_GROUP: usize = PLANES
BCM_SEQUENCE_LEN: groups never straddle
a sequence boundary. Read moreSource§type Word = u16
type Word = u16
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
fn bcm_segment_ptr(&self, index: usize) -> *const u8
index-th BCM segment. Read moreSource§const BCM_SEGMENT_COUNT: usize = _
const BCM_SEGMENT_COUNT: usize = _
Source§fn bcm_segment_count(&self) -> usize
fn bcm_segment_count(&self) -> usize
Source§fn bcm_segment(&self, index: usize) -> BcmSegment
fn bcm_segment(&self, index: usize) -> BcmSegment
index-th BCM segment. Read more