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_HX8347D.h (2615B)

      1 /*
      2  * start rewrite from:
      3  * https://github.com/adafruit/Adafruit-GFX-Library.git
      4  */
      5 #ifndef _ARDUINO_HX8347D_H_
      6 #define _ARDUINO_HX8347D_H_
      7 
      8 #include <Arduino.h>
      9 #include <Print.h>
     10 #include "../Arduino_GFX.h"
     11 #include "../Arduino_TFT.h"
     12 
     13 #define HX8347D_TFTWIDTH 240  ///< HX8347D max TFT width
     14 #define HX8347D_TFTHEIGHT 320 ///< HX8347D max TFT height
     15 
     16 #define HX8347D_RST_DELAY 120
     17 
     18 static const uint8_t hx8347d_init_operations[] = {
     19     BEGIN_WRITE,
     20     WRITE_C8_D8, 0xEA, 0x00,
     21     WRITE_C8_D8, 0xEB, 0x20,
     22     WRITE_C8_D8, 0xEC, 0x0C,
     23     WRITE_C8_D8, 0xED, 0xC4,
     24     WRITE_C8_D8, 0xE8, 0x38,
     25     WRITE_C8_D8, 0xE9, 0x10,
     26     WRITE_C8_D8, 0xF1, 0x01,
     27     WRITE_C8_D8, 0xF2, 0x10,
     28     WRITE_C8_D8, 0x40, 0x01,
     29     WRITE_C8_D8, 0x41, 0x00,
     30     WRITE_C8_D8, 0x42, 0x00,
     31     WRITE_C8_D8, 0x43, 0x10,
     32     WRITE_C8_D8, 0x44, 0x0E,
     33     WRITE_C8_D8, 0x45, 0x24,
     34     WRITE_C8_D8, 0x46, 0x04,
     35     WRITE_C8_D8, 0x47, 0x50,
     36     WRITE_C8_D8, 0x48, 0x02,
     37     WRITE_C8_D8, 0x49, 0x13,
     38     WRITE_C8_D8, 0x4A, 0x19,
     39     WRITE_C8_D8, 0x4B, 0x19,
     40     WRITE_C8_D8, 0x4C, 0x16,
     41     WRITE_C8_D8, 0x50, 0x1B,
     42     WRITE_C8_D8, 0x51, 0x31,
     43     WRITE_C8_D8, 0x52, 0x2F,
     44     WRITE_C8_D8, 0x53, 0x3F,
     45     WRITE_C8_D8, 0x54, 0x3F,
     46     WRITE_C8_D8, 0x55, 0x3E,
     47     WRITE_C8_D8, 0x56, 0x2F,
     48     WRITE_C8_D8, 0x57, 0x7B,
     49     WRITE_C8_D8, 0x58, 0x09,
     50     WRITE_C8_D8, 0x59, 0x06,
     51     WRITE_C8_D8, 0x5A, 0x06,
     52     WRITE_C8_D8, 0x5B, 0x0C,
     53     WRITE_C8_D8, 0x5C, 0x1D,
     54     WRITE_C8_D8, 0x5D, 0xCC,
     55     WRITE_C8_D8, 0x1B, 0x1B,
     56     WRITE_C8_D8, 0x1A, 0x01,
     57     WRITE_C8_D8, 0x24, 0x2F,
     58     WRITE_C8_D8, 0x25, 0x57,
     59     WRITE_C8_D8, 0x23, 0x88,
     60     WRITE_C8_D8, 0x18, 0x34,
     61     WRITE_C8_D8, 0x19, 0x01,
     62     WRITE_C8_D8, 0x1F, 0x88,
     63     WRITE_C8_D8, 0x1F, 0x80,
     64     WRITE_C8_D8, 0x1F, 0x90,
     65     WRITE_C8_D8, 0x1F, 0xD0,
     66     WRITE_C8_D8, 0x17, 0x05,
     67     WRITE_C8_D8, 0x28, 0x38,
     68     WRITE_C8_D8, 0x28, 0x3F,
     69     WRITE_C8_D8, 0x16, 0x18,
     70     END_WRITE};
     71 
     72 class Arduino_HX8347D : public Arduino_TFT
     73 {
     74 public:
     75   Arduino_HX8347D(
     76       Arduino_DataBus *bus, int8_t rst = GFX_NOT_DEFINED, uint8_t r = 0,
     77       bool ips = false, int16_t w = HX8347D_TFTWIDTH, int16_t h = HX8347D_TFTHEIGHT,
     78       uint8_t col_offset1 = 0, uint8_t row_offset1 = 0, uint8_t col_offset2 = 0, uint8_t row_offset2 = 0);
     79 
     80   bool begin(int32_t speed = GFX_NOT_DEFINED) override;
     81   void writeAddrWindow(int16_t x, int16_t y, uint16_t w, uint16_t h) override;
     82   void setRotation(uint8_t r) override;
     83   void invertDisplay(bool) override;
     84   void displayOn() override;
     85   void displayOff() override;
     86 
     87 protected:
     88   void tftInit() override;
     89   bool _invert = false;
     90 
     91 private:
     92 };
     93 
     94 #endif