Skip to content

Commit c953352

Browse files
committed
ESP32LCD8.h support old and new version in parallel
1 parent 92fba58 commit c953352

File tree

1 file changed

+83
-3
lines changed

1 file changed

+83
-3
lines changed

src/databus/Arduino_ESP32LCD8.h

Lines changed: 83 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,87 @@
22

33
#include "Arduino_DataBus.h"
44

5-
#if 1 || defined(ESP32) && (CONFIG_IDF_TARGET_ESP32S3)
6-
#if 1 || (!defined(ESP_ARDUINO_VERSION_MAJOR)) || (ESP_ARDUINO_VERSION_MAJOR >= 5)
5+
#if defined(ESP32) && (CONFIG_IDF_TARGET_ESP32S3)
6+
#if (!defined(ESP_ARDUINO_VERSION_MAJOR)) || (ESP_ARDUINO_VERSION_MAJOR < 3)
7+
8+
#ifndef LCD_MAX_PIXELS_AT_ONCE
9+
#define LCD_MAX_PIXELS_AT_ONCE 2046
10+
#endif
11+
#ifndef USE_DMA_THRESHOLD
12+
#define USE_DMA_THRESHOLD 6
13+
#endif
14+
15+
class Arduino_ESP32LCD8 : public Arduino_DataBus
16+
{
17+
public:
18+
Arduino_ESP32LCD8(
19+
int8_t dc, int8_t cs, int8_t wr, int8_t rd,
20+
int8_t d0, int8_t d1, int8_t d2, int8_t d3, int8_t d4, int8_t d5, int8_t d6, int8_t d7); // Constructor
21+
22+
bool begin(int32_t speed = GFX_NOT_DEFINED, int8_t dataMode = GFX_NOT_DEFINED) override;
23+
void beginWrite() override;
24+
void endWrite() override;
25+
void writeCommand(uint8_t) override;
26+
void writeCommand16(uint16_t) override;
27+
void writeCommandBytes(uint8_t *data, uint32_t len) override;
28+
void write(uint8_t) override;
29+
void write16(uint16_t) override;
30+
31+
void writeC8D8(uint8_t c, uint8_t d) override;
32+
void writeC8D16(uint8_t c, uint16_t d) override;
33+
void writeC8D16D16(uint8_t c, uint16_t d1, uint16_t d2) override;
34+
void writeC8D16D16Split(uint8_t c, uint16_t d1, uint16_t d2) override;
35+
36+
void writeRepeat(uint16_t p, uint32_t len) override;
37+
void writePixels(uint16_t *data, uint32_t len) override;
38+
39+
void writeBytes(uint8_t *data, uint32_t len) override;
40+
41+
void writeIndexedPixels(uint8_t *data, uint16_t *idx, uint32_t len) override;
42+
void writeIndexedPixelsDouble(uint8_t *data, uint16_t *idx, uint32_t len) override;
43+
44+
protected:
45+
private:
46+
GFX_INLINE void CS_HIGH(void);
47+
GFX_INLINE void CS_LOW(void);
48+
49+
int8_t _dc, _cs, _wr, _rd;
50+
int8_t _d0, _d1, _d2, _d3, _d4, _d5, _d6, _d7;
51+
52+
PORTreg_t _csPortSet; ///< PORT register for chip select SET
53+
PORTreg_t _csPortClr; ///< PORT register for chip select CLEAR
54+
uint32_t _csPinMask; ///< Bitmask for chip select
55+
56+
esp_lcd_i80_bus_handle_t _i80_bus = nullptr;
57+
dma_descriptor_t *_dmadesc = nullptr;
58+
gdma_channel_handle_t _dma_chan;
59+
60+
union
61+
{
62+
uint32_t value;
63+
struct
64+
{
65+
uint16_t value16;
66+
uint16_t value16_2;
67+
};
68+
struct
69+
{
70+
uint8_t lsb;
71+
uint8_t msb;
72+
uint8_t lsb_2;
73+
uint8_t msb_2;
74+
};
75+
} _data32;
76+
77+
union
78+
{
79+
uint8_t* _buffer;
80+
uint16_t* _buffer16;
81+
uint32_t* _buffer32;
82+
};
83+
};
84+
85+
#else // (ESP_ARDUINO_VERSION_MAJOR >= 3)
786

887
#include "esp_lcd_panel_interface.h"
988
#include "esp_lcd_panel_io.h"
@@ -92,5 +171,6 @@ class Arduino_ESP32LCD8 : public Arduino_DataBus
92171
};
93172
};
94173

95-
#endif // #if (!defined(ESP_ARDUINO_VERSION_MAJOR)) || (ESP_ARDUINO_VERSION_MAJOR < 3)
174+
#endif // #if ... ESP_ARDUINO_VERSION_MAJOR
175+
96176
#endif // #if defined(ESP32) && (CONFIG_IDF_TARGET_ESP32S3)

0 commit comments

Comments
 (0)