acid-drop- Hacking the planet from a LilyGo T-Deck using custom firmware |
git clone git://git.acid.vegas/acid-drop.git |
Log | Files | Refs | Archive | README | LICENSE |
Arduino_ESP32LCD16.h (2732B)
1 /* 2 * start rewrite from: 3 * https://github.com/lovyan03/LovyanGFX/blob/master/src/lgfx/v0/platforms/LGFX_PARALLEL_ESP32.hpp 4 */ 5 #include "Arduino_DataBus.h" 6 7 #if defined(ESP32) && (CONFIG_IDF_TARGET_ESP32S3) 8 9 #ifndef _ARDUINO_ESP32LCD16_H_ 10 #define _ARDUINO_ESP32LCD16_H_ 11 12 #define LCD_MAX_PIXELS_AT_ONCE 2046 13 #define USE_DMA_THRESHOLD 6 14 15 class Arduino_ESP32LCD16 : public Arduino_DataBus 16 { 17 public: 18 Arduino_ESP32LCD16( 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, 21 int8_t d8, int8_t d9, int8_t d10, int8_t d11, int8_t d12, int8_t d13, int8_t d14, int8_t d15); // Constructor 22 23 bool begin(int32_t speed = GFX_NOT_DEFINED, int8_t dataMode = GFX_NOT_DEFINED) override; 24 void beginWrite() override; 25 void endWrite() override; 26 void writeCommand(uint8_t) override; 27 void writeCommand16(uint16_t) override; 28 void write(uint8_t) override; 29 void write16(uint16_t) override; 30 void writeRepeat(uint16_t p, uint32_t len) override; 31 void writePixels(uint16_t *data, uint32_t len) override; 32 33 void writeC8D8(uint8_t c, uint8_t d) override; 34 void writeC8D16(uint8_t c, uint16_t d) override; 35 void writeC8D16D16(uint8_t c, uint16_t d1, uint16_t d2) override; 36 void writeC8D16D16Split(uint8_t c, uint16_t d1, uint16_t d2) override; 37 void writeBytes(uint8_t *data, uint32_t len) override; 38 void writePattern(uint8_t *data, uint8_t len, uint32_t repeat) override; 39 40 void writeIndexedPixels(uint8_t *data, uint16_t *idx, uint32_t len) override; 41 void writeIndexedPixelsDouble(uint8_t *data, uint16_t *idx, uint32_t len) override; 42 43 protected: 44 private: 45 INLINE void WRITECOMMAND16(uint16_t c); 46 INLINE void WRITE16(uint16_t d); 47 INLINE void WRITE32(uint32_t d); 48 INLINE void CS_HIGH(void); 49 INLINE void CS_LOW(void); 50 51 int8_t _dc, _cs, _wr, _rd; 52 int8_t _d0, _d1, _d2, _d3, _d4, _d5, _d6, _d7; 53 int8_t _d8, _d9, _d10, _d11, _d12, _d13, _d14, _d15; 54 55 PORTreg_t _csPortSet; ///< PORT register SET 56 PORTreg_t _csPortClr; ///< PORT register CLEAR 57 uint32_t _csPinMask; ///< Bitmask 58 59 uint32_t _fast_wait; 60 esp_lcd_i80_bus_handle_t _i80_bus = nullptr; 61 dma_descriptor_t *_dmadesc = nullptr; 62 gdma_channel_handle_t _dma_chan; 63 64 union 65 { 66 uint32_t value; 67 struct 68 { 69 uint16_t value16; 70 uint16_t value16_2; 71 }; 72 struct 73 { 74 uint8_t lsb; 75 uint8_t msb; 76 uint8_t lsb_2; 77 uint8_t msb_2; 78 }; 79 } _data32; 80 81 union 82 { 83 uint8_t _buffer[LCD_MAX_PIXELS_AT_ONCE * 2] = {0}; 84 uint16_t _buffer16[LCD_MAX_PIXELS_AT_ONCE]; 85 uint32_t _buffer32[LCD_MAX_PIXELS_AT_ONCE / 2]; 86 }; 87 }; 88 89 #endif // _ARDUINO_ESP32LCD16_H_ 90 91 #endif // #if defined(ESP32) && (CONFIG_IDF_TARGET_ESP32S3)