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_JBT6K71.h (4043B)
1 /* 2 * start rewrite from: 3 * https://github.com/adafruit/Adafruit-GFX-Library.git 4 * https://github.com/gitcnd/LCDWIKI_SPI.git 5 */ 6 #ifndef _ARDUINO_JBT6K71_H_ 7 #define _ARDUINO_JBT6K71_H_ 8 9 #include <Arduino.h> 10 #include <Print.h> 11 #include "../Arduino_GFX.h" 12 #include "../Arduino_TFT.h" 13 14 #define JBT6K71_TFTWIDTH 240 ///< JBT6K71 max TFT width 15 #define JBT6K71_TFTHEIGHT 320 ///< JBT6K71 max TFT height 16 17 #define JBT6K71_RST_DELAY 150 18 19 static const uint8_t jbt6k71_init_operations[] = { 20 BEGIN_WRITE, 21 WRITE_COMMAND_16, 0x00, 0x00, // exiting from deep standby mode 22 END_WRITE, 23 24 DELAY, 10, // spec 1ms 25 26 BEGIN_WRITE, 27 WRITE_COMMAND_16, 0x00, 0x00, 28 END_WRITE, 29 30 DELAY, 10, // spec 1ms 31 32 BEGIN_WRITE, 33 WRITE_COMMAND_16, 0x00, 0x00, 34 END_WRITE, 35 36 DELAY, 10, // spec 1ms 37 38 BEGIN_WRITE, 39 WRITE_C16_D16, 0x00, 0x1d, // mode setting 40 0x00, 0x05, // exit standby 41 END_WRITE, 42 43 DELAY, 100, // spec 1ms 44 45 BEGIN_WRITE, 46 WRITE_C16_D16, 0x00, 0x00, // oscillation setting 47 0x00, 0x01, // set to on 48 END_WRITE, 49 50 DELAY, 100, // spec 1ms 51 52 // Display control 53 BEGIN_WRITE, 54 WRITE_C16_D16, 0x00, 0x02, // LCD driver AC control 55 0x02, 0x00, // line inversion 56 57 WRITE_C16_D16, 0x00, 0x0d, // FR period adjustment setting 58 0x00, 0x11, // Ffr=60Hz optimized 59 END_WRITE, 60 61 DELAY, 100, // spec 1ms 62 63 // LTPS control settings 64 BEGIN_WRITE, 65 WRITE_C16_D16, 0x00, 0x12, // LTPS control setting 1 66 0x03, 0x03, 67 68 WRITE_C16_D16, 0x00, 0x13, // LTPS control setting 2 69 0x01, 0x02, 70 71 WRITE_C16_D16, 0x00, 0x1c, // Amplifier capability setting 72 0x00, 0x00, // Maximum 73 74 // Power settings 75 WRITE_C16_D16, 0x01, 0x02, // Power supply control (1) 76 0x00, 0xf6, // VCOMD Output voltage: 1.4V(Initial), VCS output voltage: 4.5V, VGM output voltage: 4.3V 77 END_WRITE, 78 79 DELAY, 250, // uint8_t max value 255 80 DELAY, 250, 81 82 BEGIN_WRITE, 83 WRITE_C16_D16, 0x01, 0x03, // Power Supply Control (2) 84 0x00, 0x07, // Boosting clock mode: Dual mode, XVDD output voltage: 5.4V 85 END_WRITE, 86 87 DELAY, 100, 88 89 BEGIN_WRITE, 90 WRITE_C16_D16, 0x01, 0x05, // Power supply control (4) 91 0x01, 0x11, // Mask period (DCEW1/DCEW2): 1.0 clock, DCCLK frequency for external regulate circuit: 1H, DCCLK frequency for XVDD regulate circuit: 1/2H, DCCLK frequency for AVDD regulate circuit: 1H 92 END_WRITE, 93 94 DELAY, 100, 95 96 // Gray scale settings (gamma c 97 BEGIN_WRITE, 98 WRITE_C16_D16, 0x03, 0x00, 0x02, 0x00, // chan 99 WRITE_C16_D16, 0x03, 0x01, 0x00, 0x02, // 100 WRITE_C16_D16, 0x03, 0x02, 0x00, 0x00, 101 WRITE_C16_D16, 0x03, 0x03, 0x03, 0x00, // 102 WRITE_C16_D16, 0x03, 0x04, 0x07, 0x00, 103 WRITE_C16_D16, 0x03, 0x05, 0x00, 0x70, // 104 WRITE_C16_D16, 0x04, 0x02, 0x00, 0x00, // First screen start, 0 105 WRITE_C16_D16, 0x04, 0x03, 0x01, 0x3f, // First screen end, 319 106 WRITE_C16_D16, 0x01, 0x00, 0xC0, 0x10, // Display Control 107 END_WRITE, 108 109 DELAY, 250, // uint8_t max value 255 110 DELAY, 250, 111 112 BEGIN_WRITE, 113 WRITE_C16_D16, 0x01, 0x01, 0x00, 0x01, // Auto sequence Control, AUTO 114 WRITE_C16_D16, 0x01, 0x00, 0xF7, 0xFE, // Display Control 115 END_WRITE, 116 117 DELAY, 250, // uint8_t max value 255 118 DELAY, 250, 119 DELAY, 250}; 120 121 class Arduino_JBT6K71 : public Arduino_TFT 122 { 123 public: 124 Arduino_JBT6K71( 125 Arduino_DataBus *bus, int8_t rst = GFX_NOT_DEFINED, uint8_t r = 0, 126 bool ips = false, int16_t w = JBT6K71_TFTWIDTH, int16_t h = JBT6K71_TFTHEIGHT, 127 uint8_t col_offset1 = 0, uint8_t row_offset1 = 0, uint8_t col_offset2 = 0, uint8_t row_offset2 = 0); 128 129 bool begin(int32_t speed = GFX_NOT_DEFINED) override; 130 void writeAddrWindow(int16_t x, int16_t y, uint16_t w, uint16_t h) override; 131 void setRotation(uint8_t r) override; 132 void invertDisplay(bool) override; 133 void displayOn() override; 134 void displayOff() override; 135 136 protected: 137 void tftInit() override; 138 139 private: 140 }; 141 142 #endif