Skip to content

Conversation

@ritesh006
Copy link
Contributor

Summary

This PR adds support for passing a madctl parameter to the ILI9341 driver, allowing developers to directly control hardware rotation via the MADCTL register.
It also preserves support for BGR/RGB selection and inversion.

Motivation

Currently, display rotation relies on displayio’s software-based handling, which can be inefficient.
By exposing MADCTL, developers can take advantage of the LCD controller’s built-in rotation logic, which improves performance (especially for OnDiskBitmaps).

Changes

  • Added an optional madctl parameter to the ILI9341 constructor.
  • Retained existing bgr and invert options.
  • Updated initialization sequence handling to correctly append MADCTL.
  • Updated README usage examples to include madctl.

Tests

  • Added unit tests (test_madctl.py) covering:
    • Default RGB encoding
    • BGR encoding
    • Custom MADCTL overrides
  • All tests pass locally.

Related Issues

Closes #26 ("Make it easy to set MADCTL for rotation").

@ritesh006 ritesh006 changed the title feat(ili9341): add madctl parameter for rotation and BGR/RGB control Added madctl parameter to ILI9341 driver for hardware rotation and RGB/BGR control, enabling faster rendering and more flexibility Aug 27, 2025
@ritesh006 ritesh006 force-pushed the feat/madctl-support branch 4 times, most recently from 1361b03 to 74a43af Compare August 27, 2025 17:55
@ritesh006
Copy link
Contributor Author

Please review this commit

@ladyada
Copy link
Member

ladyada commented Aug 28, 2025

reviewed. we will not merge, please use/add/adapt kwargs instead of hardcoding MADCTL writes

@ritesh006 ritesh006 force-pushed the feat/madctl-support branch from 74a43af to a289fba Compare August 29, 2025 04:23
@ritesh006
Copy link
Contributor Author

Hi @ladyada your review comment addressed please take a look.

@ritesh006 ritesh006 force-pushed the feat/madctl-support branch from a289fba to c49a3cb Compare August 29, 2025 05:41
@ladyada
Copy link
Member

ladyada commented Sep 1, 2025

hi, to be clear: we will not accept passing in MADCTL. instead, you can add kwargs for any/each setting that may be required (e.g. color order)

@ritesh006
Copy link
Contributor Author

Hi @ladyada I’ve updated this PR as suggested: replaced raw madctl with a color_order kwarg (default "RGB", optional "BGR"), kept bgr for compatibility, and updated docs/tests. Ready for re-review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make it easy to set MADCTL for rotation

2 participants