Merge upstream dev and reconcile NV3001B SPI support

This commit is contained in:
Quency-D committed 2026-11-16 10:24:30 +08:00
commit a72a75cd08
51 files changed
+1226 -818

No files matched your search

+5 -3
View File
@@ -448,10 +448,12 @@ bool NV3001BDisplay::begin() {
digitalWrite(PIN_TFT_DC, HIGH);
delay(20);
#ifdef NRF52_PLATFORM
spi.begin(); // Pins are set by the nRF52 variant.
#else
#if defined(NRF52_PLATFORM)
spi.begin();
#elif defined(ESP_PLATFORM) || defined(ESP32_PLATFORM)
spi.begin(PIN_TFT_SCL, PIN_TFT_MISO, PIN_TFT_SDA, PIN_TFT_CS);
#else
spi.begin();
#endif
if (PIN_TFT_RST >= 0) {
pinMode(PIN_TFT_RST, OUTPUT);
+14 -11
View File
@@ -20,16 +20,14 @@
#define NV3001B_PANEL_HEIGHT 220
#endif
class NV3001BDisplay : public DisplayDriver {
#if defined(ESP_PLATFORM) || defined(ESP32_PLATFORM)
#ifndef NV3001B_SPI_HOST
#define NV3001B_SPI_HOST HSPI
#endif
class NV3001BDisplay : public DisplayDriver {
#ifdef NRF52_PLATFORM
SPIClass& spi;
#else
SPIClass spi;
SPIClass owned_spi;
#endif
SPIClass& spi;
RefCountedDigitalPin* periph_power;
bool is_on = false;
uint16_t color = 0xffff;
@@ -54,12 +52,17 @@ class NV3001BDisplay : public DisplayDriver {
void drawChar(int x, int y, char ch);
public:
#ifdef NRF52_PLATFORM
explicit NV3001BDisplay(SPIClass& bus) :
DisplayDriver(NV3001B_LOGICAL_WIDTH, NV3001B_LOGICAL_HEIGHT), spi(bus), periph_power(nullptr) { }
#else
#if defined(ESP_PLATFORM) || defined(ESP32_PLATFORM)
NV3001BDisplay(RefCountedDigitalPin* power = nullptr) :
DisplayDriver(NV3001B_LOGICAL_WIDTH, NV3001B_LOGICAL_HEIGHT), spi(NV3001B_SPI_HOST), periph_power(power) { }
DisplayDriver(NV3001B_LOGICAL_WIDTH, NV3001B_LOGICAL_HEIGHT),
owned_spi(NV3001B_SPI_HOST), spi(owned_spi), periph_power(power) { }
NV3001BDisplay(SPIClass* displaySpi, RefCountedDigitalPin* power = nullptr) :
DisplayDriver(NV3001B_LOGICAL_WIDTH, NV3001B_LOGICAL_HEIGHT),
owned_spi(NV3001B_SPI_HOST), spi(displaySpi ? *displaySpi : owned_spi), periph_power(power) { }
#else
NV3001BDisplay(SPIClass* displaySpi = &SPI, RefCountedDigitalPin* power = nullptr) :
DisplayDriver(NV3001B_LOGICAL_WIDTH, NV3001B_LOGICAL_HEIGHT), spi(displaySpi ? *displaySpi : SPI), periph_power(power) { }
#endif
bool begin();