TinyGPU
Loading...
Searching...
No Matches
IDSIBus.h
Go to the documentation of this file.
1#pragma once
2#include <stddef.h>
3#include <stdint.h>
4
5namespace tinygpu {
6
7/**
8 * @brief Abstraction over the transport used by DisplayDriverDSI (see
9 * TinyGPU/Drivers/DisplayDriverDSI.h) to talk to MIPI-DSI panels: a
10 * low-speed command channel (DCS/vendor register writes, used for the
11 * panel's init sequence) plus a continuously-scanned video channel
12 * backed by a framebuffer that draws address into directly - there's no
13 * address-window/RAMWR concept the way SPI/QSPI panels have.
14 *
15 * DisplayDriverDSI and its panel subclasses (ST7701Driver, ...) only call
16 * writeCommand()/drawBitmap() - they never touch the DSI PHY, lane
17 * config, or video-timing/LTDC registers directly, so a new platform
18 * gains support for MIPI-DSI panels by implementing just this interface.
19 * See DSIBusESP32.h (ESP32-P4's esp_lcd DBI+DPI split) and
20 * DSIBusSTM32.h (STM32's HAL_DSI + LTDC, on the STM32 parts that have a
21 * DSI host: F469/F479, F769/F779, H747/H757, U5x9, ...). RP2040 has no
22 * MIPI-DSI peripheral on any variant, so there is no RP2040 backend for
23 * this interface - QSPI/SPI panels (see IQSPIBus.h/DisplayDriverSPI.h)
24 * are the only display option on that platform.
25 */
26class IDSIBus {
27 public:
28 virtual ~IDSIBus() = default;
29
30 /// Powers up and configures the DSI PHY/lanes and the command channel,
31 /// and pulses panel reset if the concrete bus owns that pin. After this
32 /// returns true, writeCommand() can be used to send the panel's init
33 /// register sequence. Does not yet start active video scan-out - see
34 /// finishInit().
35 virtual bool begin() = 0;
36
37 /// Releases peripheral/PHY resources. Safe to call even if begin() was
38 /// never called or already failed.
39 virtual void end() = 0;
40
41 /// Sends one DCS/vendor register command with up to `len` parameter
42 /// bytes over the DSI command channel. Returns false on transport
43 /// failure.
44 virtual bool writeCommand(uint8_t cmd, const uint8_t* param,
45 size_t len) = 0;
46
47 /// Finalizes bring-up after the panel's init sequence has been sent -
48 /// configures/starts the video-timing channel so the panel begins
49 /// active scan-out. Must be called exactly once, after begin() and
50 /// before the first drawBitmap().
51 virtual bool finishInit() = 0;
52
53 /// Writes `rgb565` (native RGB565 byte order, width*height*2 bytes,
54 /// tightly packed) into the rectangle [x0,y0)-[x1,y1) of the live
55 /// framebuffer. Returns false on transport failure.
56 virtual bool drawBitmap(size_t x0, size_t y0, size_t x1, size_t y1,
57 const uint8_t* rgb565) = 0;
58};
59
60} // namespace tinygpu
Abstraction over the transport used by DisplayDriverDSI (see TinyGPU/Drivers/DisplayDriverDSI....
Definition: IDSIBus.h:26
virtual bool drawBitmap(size_t x0, size_t y0, size_t x1, size_t y1, const uint8_t *rgb565)=0
virtual ~IDSIBus()=default
virtual bool finishInit()=0
virtual void end()=0
virtual bool begin()=0
virtual bool writeCommand(uint8_t cmd, const uint8_t *param, size_t len)=0
Definition: DSIBusESP32.h:19