Skip to main content

Module display

Module display 

Source
Expand description

ILI9342C panel bring-up shared by both boards (feature display).

The M5Stack Fire27 and CoreS3 use the same 320x240 ILI9342C panel with the same controller options (inverted colors, BGR order); only the reset wiring differs — Fire27 has a GPIO reset pin, the CoreS3 panel is reset via the AW9523B expander (see [super::cores3::power_display_reset]) and falls back to lcd-async’s SPI SoftReset ([NoResetPin]), which is harmless after the hardware pulse.

Generic over the [Interface]: works with a plain shared Spi bus device (the examples) as well as a descriptor-backed SpiDma device (super::spi2).

The panel is driven through M5Ili9342cRgb565 rather than lcd-async’s stock model, because the stock init leaves the gamma and power registers on their power-on defaults — see that type for what that costs on glass.

§Writing an app against this panel

Nothing is required of the caller for correct tone response: every route that produces a panel — init_ili9342c, init_ili9342c_with_reset, and both super::spi2 paths on both boards — runs the same init, so a display obtained from this crate already has gamma programmed.

What the init cannot do for you:

  • A neutral grey needs r == b and g == 2 * r. Green has one more bit than red and blue in RGB565, so equal channel numbers are not neutral. Converting an 8-bit token by truncation (>>3, >>2) breaks that relation; at the dark end one LSB is a large relative step, so a value meant as neutral can land with a visible cast.
  • 32 neutral steps is the RGB565 ceiling, not a gamma limit. The panel is 262K-colour — 6 bits per channel, 64 neutral steps — and this crate drives it at 5-6-5. Reaching the rest needs an 18-bit pipeline (lcd_async::models::ILI9342CRgb666), which is a change here rather than in an app.
  • Do not software-reset the panel after bring-up. Gamma lives in controller registers, and SWRESET restores the power-on curve — silently undoing this. Sleep and wake are safe: they send only SLPIN/SLPOUT.

examples/greyscale.rs renders all 32 neutral greys as a labelled checkerboard for judging a panel by eye.

Re-exports§

pub use super::SCREEN_H;
pub use super::SCREEN_W;

Structs§

M5Ili9342cRgb565
The ILI9342C driven the way M5Stack drives it: lcd-async’s init sequence, then the gamma and power registers that sequence never programs.

Functions§

init_ili9342c
Initialise the panel without a reset pin (CoreS3). The hardware reset must have been pulsed beforehand (AW9523B LCD_RST); init falls back to a SPI SoftReset command.
init_ili9342c_with_reset
Initialise the panel with a hardware reset pin (Fire27, RST=GPIO33).

Type Aliases§

Ili9342c
The configured panel type: ILI9342C in RGB565 over DI.