TinyGPU
Loading...
Searching...
No Matches
IQSPIBus.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 DisplayDriverQSPI (see
9 * TinyGPU/Drivers/DisplayDriverQSPI.h) to talk to the family of QSPI TFT
10 * panel controllers (NV3041A, ST77916, CO5300, SH8601, AXS15231B, ...)
11 * that wrap every command in a 32-bit frame: opcode byte (0x02 = "write,
12 * parameter bytes follow over 1 line", 0x32 = "write, color/pixel data
13 * follows over 4 lines"), the MIPI-DCS-style command byte, then 16 unused
14 * bits.
15 *
16 * DisplayDriverQSPI and its panel subclasses (NV3041ADriver, ...) only
17 * call writeCommand()/writeColor() - they never build the 32-bit frame or
18 * touch GPIO/peripheral registers themselves, so a new platform gains
19 * support for this whole panel family by implementing just this
20 * interface. See QSPIBusESP32.h (hardware esp_lcd-backed, DMA, ESP32
21 * only) and QSPIBusBitBang.h (portable software fallback, any Arduino
22 * core with digitalWrite - RP2040, STM32, ...).
23 */
24class IQSPIBus {
25 public:
26 virtual ~IQSPIBus() = default;
27
28 /// Sets up the bus (pins/peripheral). Returns false on failure.
29 virtual bool begin() = 0;
30
31 /// Releases any peripheral resources. Safe to call even if begin() was
32 /// never called or already failed.
33 virtual void end() = 0;
34
35 /// Sends one MIPI-DCS/vendor register command with up to `len`
36 /// parameter bytes, framed with the 0x02 ("param bytes over 1 line")
37 /// opcode. Returns false on transport failure.
38 virtual bool writeCommand(uint8_t cmd, const uint8_t* param,
39 size_t len) = 0;
40
41 /// Sends `len` bytes of pixel/color data for the given RAM-write
42 /// command (usually 0x2C), framed with the 0x32 ("data over 4 lines")
43 /// opcode. Returns false on transport failure. Blocks until the whole
44 /// transfer has been accepted by the panel (synchronous from the
45 /// caller's point of view, even if the underlying transport is
46 /// internally asynchronous/DMA-driven).
47 virtual bool writeColor(uint8_t cmd, const uint8_t* data, size_t len) = 0;
48};
49
50} // namespace tinygpu
Abstraction over the transport used by DisplayDriverQSPI (see TinyGPU/Drivers/DisplayDriverQSPI....
Definition: IQSPIBus.h:24
virtual bool writeColor(uint8_t cmd, const uint8_t *data, size_t len)=0
virtual ~IQSPIBus()=default
virtual void end()=0
virtual bool begin()=0
Sets up the bus (pins/peripheral). Returns false on failure.
virtual bool writeCommand(uint8_t cmd, const uint8_t *param, size_t len)=0
Definition: DSIBusESP32.h:19