Skip to main content

StandardSwapChain

Type Alias StandardSwapChain 

Source
pub type StandardSwapChain<const W: usize, const H: usize, B> = SwapChain<W, H, EndianCorrectedBuffer<'static, Rgb565>, B>;
Expand description

Type alias for SwapChain backed by EndianCorrectedBuffer.

This is the most common configuration for statically allocated framebuffer memory.

Aliased Type§

pub struct StandardSwapChain<const W: usize, const H: usize, B> { /* private fields */ }

Implementations§

Source§

impl<const W: usize, const H: usize, B> StandardSwapChain<W, H, B>
where B: DisplayBackend<W, H, EndianCorrectedBuffer<'static, Rgb565>>,

Source

pub fn from_static_slices( front_data: &'static mut [Rgb565], back_data: &'static mut [Rgb565], big_endian: bool, backend: B, ) -> Self

Create a new swap chain from static slices.

§Arguments
  • front_data — Static mutable slice for the front framebuffer.
  • back_data — Static mutable slice for the back framebuffer.
  • big_endian — Byte order of pixel data sent to the display.
  • backend — Display backend used for DMA operations.
§Example
static mut FB0: [Rgb565; 240 * 135] = [Rgb565::BLACK; 240 * 135];
static mut FB1: [Rgb565; 240 * 135] = [Rgb565::BLACK; 240 * 135];

let swap_chain = unsafe {
    StandardSwapChain::<240, 135, _>::from_static_slices(
        &mut FB0,
        &mut FB1,
        false,
        MyHardwareBackend::new(),
    )
};