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_ILI9488.h (3193B)
1 /* 2 * start rewrite from: 3 * https://github.com/nopnop2002/esp-idf-parallel-tft 4 */ 5 #ifndef _ARDUINO_ILI9488_H_ 6 #define _ARDUINO_ILI9488_H_ 7 8 #include <Arduino.h> 9 #include <Print.h> 10 #include "../Arduino_GFX.h" 11 #include "../Arduino_TFT.h" 12 13 #define ILI9488_TFTWIDTH 320 ///< ILI9488 max TFT width 14 #define ILI9488_TFTHEIGHT 480 ///< ILI9488 max TFT height 15 16 #define ILI9488_RST_DELAY 150 ///< delay ms wait for reset finish 17 #define ILI9488_SLPIN_DELAY 150 ///< delay ms wait for sleep in finish 18 #define ILI9488_SLPOUT_DELAY 150 ///< delay ms wait for sleep out finish 19 20 // Generic commands used by ILI9488_eSPI.cpp 21 #define ILI9488_NOP 0x00 22 #define ILI9488_SWRESET 0x01 23 24 #define ILI9488_SLPIN 0x10 25 #define ILI9488_SLPOUT 0x11 26 27 #define ILI9488_INVOFF 0x20 28 #define ILI9488_INVON 0x21 29 30 #define ILI9488_DISPOFF 0x28 31 #define ILI9488_DISPON 0x29 32 33 #define ILI9488_CASET 0x2A 34 #define ILI9488_PASET 0x2B 35 #define ILI9488_RAMWR 0x2C 36 37 #define ILI9488_RAMRD 0x2E 38 39 #define ILI9488_MADCTL 0x36 40 41 #define ILI9488_MADCTL_MY 0x80 42 #define ILI9488_MADCTL_MX 0x40 43 #define ILI9488_MADCTL_MV 0x20 44 #define ILI9488_MADCTL_ML 0x10 45 #define ILI9488_MADCTL_RGB 0x00 46 #define ILI9488_MADCTL_BGR 0x08 47 #define ILI9488_MADCTL_MH 0x04 48 #define ILI9488_MADCTL_SS 0x02 49 #define ILI9488_MADCTL_GS 0x01 50 51 static const uint8_t ili9488_init_operations[] = { 52 BEGIN_WRITE, 53 54 WRITE_COMMAND_8, 0xE0, 55 WRITE_BYTES, 15, 56 0x00, 0x03, 0x09, 0x08, 57 0x16, 0x0A, 0x3F, 0x78, 58 0x4C, 0x09, 0x0A, 0x08, 59 0x16, 0x1A, 0x0F, 60 61 WRITE_COMMAND_8, 0xE1, 62 WRITE_BYTES, 15, 63 0x00, 0x16, 0x19, 0x03, 64 0x0F, 0x05, 0x32, 0x45, 65 0x46, 0x04, 0x0E, 0x0D, 66 0x35, 0x37, 0x0F, 67 68 WRITE_C8_D16, 0XC0, // Power Control 1 69 0x17, // Vreg1out 70 0x15, // Verg2out 71 72 WRITE_C8_D8, 0xC1, // Power Control 2 73 0x41, // VGH,VGL 74 75 WRITE_COMMAND_8, 0xC5, // Power Control 3 76 WRITE_BYTES, 3, 77 0x00, 78 0x12, // Vcom 79 0x80, 80 81 WRITE_C8_D8, 0xB0, 0x80, // Interface Mode Control, SDO NOT USE 82 WRITE_C8_D8, 0xB1, 0xA0, // Frame rate, 60Hz 83 WRITE_C8_D8, 0xB4, 0x02, // Display Inversion Control, 2-dot 84 85 WRITE_C8_D16, 0xB6, // Display Function Control RGB/MCU Interface Control 86 0x02, // MCU 87 0x02, // Source,Gate scan dieection 88 89 WRITE_C8_D8, 0xE9, 0x00, // Set Image Function, disable 24 bit data 90 91 WRITE_COMMAND_8, 0xF7, // Adjust Control 92 WRITE_BYTES, 4, 0xA9, 0x51, 0x2C, 0x82, // D7 stream, loose 93 94 WRITE_COMMAND_8, ILI9488_SLPOUT, // Sleep Out 95 END_WRITE, 96 97 DELAY, ILI9488_SLPOUT_DELAY, 98 99 BEGIN_WRITE, 100 WRITE_COMMAND_8, ILI9488_DISPON, // Display on 101 END_WRITE}; 102 103 class Arduino_ILI9488 : public Arduino_TFT 104 { 105 public: 106 Arduino_ILI9488(Arduino_DataBus *bus, int8_t rst = GFX_NOT_DEFINED, uint8_t r = 0, bool ips = false); 107 108 bool begin(int32_t speed = GFX_NOT_DEFINED) override; 109 110 void setRotation(uint8_t r) override; 111 112 void writeAddrWindow(int16_t x, int16_t y, uint16_t w, uint16_t h) override; 113 114 void invertDisplay(bool) override; 115 void displayOn() override; 116 void displayOff() override; 117 118 protected: 119 void tftInit() override; 120 121 private: 122 }; 123 124 #endif // #ifndef _ARDUINO_ILI9488_H_