|
| | ILI9341Driver (SPIClass &spi, int8_t cs, int8_t dc, int8_t rst=-1, Rotation rotation=Rotation::kNone, uint32_t frequencyHz=40000000, size_t nativeWidth=240, size_t nativeHeight=320) |
| |
| size_t | width () const override |
| |
| size_t | height () const override |
| |
| bool | begin () override |
| |
| void | setRotation (Rotation rotation) override |
| |
| Rotation | rotation () const |
| |
| void | setInvertColor (bool invert) |
| | Toggles the ILI9341's display inversion (DINVON/DINVOFF, 0x21/ 0x20). Some cheap ILI9341-compatible clone panels' color filter needs this set, or every color renders as its photographic negative (RED shows as cyan, GREEN as magenta, BLUE as yellow) - confirmed on real hardware. Safe to call any time after begin() - and safe to call before a later begin() too: begin() sends SWRESET (0x01), a real hardware reset that puts the panel's own inversion register back to its power-on default regardless of what this method last told it (no explicit invert command appears anywhere in begin() itself, so this is easy to miss), so begin() re-sends whatever this last requested (via invertColor_) as its final step - a call to this method always sticks no matter how many further begin() calls follow (e.g. a caller's own redundant DeviceOutput::begin()).
|
| |
| | DisplayDriverSPI (SPIClass &spi, int8_t cs, int8_t dc, int8_t rst=-1, size_t xOffset=0, size_t yOffset=0, uint32_t frequencyHz=40000000, uint32_t readFrequencyHz=15000000, size_t width=240, size_t height=320) |
| |
| size_t | width () const override |
| |
| size_t | height () const override |
| |
| bool | writeData (ISurface< RGB_T > &surface) override |
| |
| void | setSwapOutputBytes (bool swap) |
| |
| bool | writeData (ISurface< RGB_T > &surface, size_t x, size_t y) override |
| |
| bool | readData (ISurface< RGB_T > &surface, size_t x, size_t y) |
| |
| virtual | ~DisplayDriver ()=default |
| |
| virtual bool | begin ()=0 |
| |
| virtual void | end () |
| |
| virtual bool | writeData (ISurface< RGB_T > &surface)=0 |
| |
| virtual bool | writeData (ISurface< RGB_T > &surface, size_t x, size_t y)=0 |
| |
| virtual void | setRotation (DisplayRotation rotation) |
| |
| virtual size_t | width () const =0 |
| |
| virtual size_t | height () const =0 |
| |
| void | writeColor (size_t width, size_t height, RGB_T color) |
| |
template<typename RGB_T = RGB565>
class tinygpu::ILI9341Driver< RGB_T >
Driver for ILI9341 SPI display controller.
This init sequence (power control, VCOM, gamma correction, and the leading 0xEF unlock command some clone panels need) and the MADCTL/BGR rotation table are ported from the widely-used, independently maintained Bodmer/TFT_eSPI library's ILI9341 driver - confirmed on real hardware to render standard RGB565 colors correctly (no field compensation needed) on a panel where this library's earlier minimal init (reset/sleep-out/pixel-format/MADCTL/display-on only, with a guessed non-BGR MADCTL) did not, no matter which MADCTL value was tried - the missing piece was the full power/gamma programming, not just the MADCTL bit.
| void setInvertColor |
( |
bool |
invert | ) |
|
|
inline |
Toggles the ILI9341's display inversion (DINVON/DINVOFF, 0x21/ 0x20). Some cheap ILI9341-compatible clone panels' color filter needs this set, or every color renders as its photographic negative (RED shows as cyan, GREEN as magenta, BLUE as yellow) - confirmed on real hardware. Safe to call any time after begin() - and safe to call before a later begin() too: begin() sends SWRESET (0x01), a real hardware reset that puts the panel's own inversion register back to its power-on default regardless of what this method last told it (no explicit invert command appears anywhere in begin() itself, so this is easy to miss), so begin() re-sends whatever this last requested (via invertColor_) as its final step - a call to this method always sticks no matter how many further begin() calls follow (e.g. a caller's own redundant DeviceOutput::begin()).