embassy-rs/embassy · error

Flexable pixels are not yet implemented

Error message

Flexable pixels are not yet implemented

What it means

bytes_per_pixel for PixelFormat hits the FLEXIBLE variant, which has no defined byte width in the LTDC driver yet, so it panics via todo!. FLEXIBLE is a placeholder pixel format for variable-depth formats that embassy-stm32 has not implemented for the LTDC display controller.

Solutions

  1. Use a concrete pixel format such as PixelFormat::RGB565, ARGB8888, RGB888, etc. instead of FLEXIBLE
  2. Size the framebuffer for the chosen format (bytes_per_pixel * width * height)
  3. If FLEXIBLE is truly needed, implement the byte-width calculation in ltdc.rs and remove the todo!
  4. Check the LTDC version cfg (ltdc_v1_3) branch is the one compiled for your chip

Example fix

// before
let layer_settings = LayerSettings::new(PixelFormat::FLEXIBLE, buffer);
// after
let layer_settings = LayerSettings::new(PixelFormat::RGB565, buffer);
Defensive patterns

Strategy: validation

Validate before calling

fn assert_supported(fmt: PixelFormat) { assert!(matches!(fmt, PixelFormat::ARGB8888 | PixelFormat::ABGR8888 | PixelFormat::RGBA8888 | PixelFormat::BGRA8888 | PixelFormat::RGB888 | PixelFormat::RGB565 | PixelFormat::BGR565), "FLEXIBLE pixels unsupported"); }

Prevention

When it happens

Trigger: Calling LTDC layer/framebuffer configuration code (e.g. configuring a layer with frame_buffer or layer setup) while a PixelFormat::FLEXIBLE format is selected for a layer on an ltdc_v1_3 part.

Common situations: Copying example layer configs that use PixelFormat::FLEXIBLE, or choosing FLEXIBLE assuming it adapts to a custom framebuffer layout.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of embassy-rs/embassy@463a07b963 (2026-09-10). Data as JSON: /api/errors/518635c9316bf174. Report an issue: GitHub.

Appendix: source

Thrown at embassy-stm32/src/ltdc.rs:244

    FLEXIBLE = Pf::Flexible as u8,
}

impl PixelFormat {
    /// Number of bytes per pixel
    pub fn bytes_per_pixel(&self) -> usize {
        #[cfg(not(ltdc_v1_3))]
        match self {
            PixelFormat::Argb8888 => 4,
            PixelFormat::Rgb888 => 3,
            PixelFormat::Rgb565 | PixelFormat::Argb4444 | PixelFormat::Argb1555 | PixelFormat::Al88 => 2,
            PixelFormat::Al44 | PixelFormat::L8 => 1,
        }
        #[cfg(ltdc_v1_3)]
        match self {
            PixelFormat::ARGB8888 | PixelFormat::ABGR8888 | PixelFormat::RGBA8888 | PixelFormat::BGRA8888 => 4,
            PixelFormat::RGB888 => 3,
            PixelFormat::RGB565 | PixelFormat::BGR565 => 2,
            PixelFormat::FLEXIBLE => todo!("Flexable pixels are not yet implemented"),
        }
    }
}

/// Ltdc Blending Layer
#[repr(usize)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum LtdcLayer {
    /// Bottom layer
    Layer1 = 0,
    /// Top layer
    Layer2 = 1,
}

impl<T: Instance> interrupt::typelevel::Handler<T::Interrupt> for InterruptHandler<T> {
    unsafe fn on_interrupt() {
        cortex_m::asm::dsb();

View on GitHub (pinned to 463a07b963)