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_NT35510.h (3367B)

      1 /*
      2  * start rewrite from:
      3  * https://github.com/hi631/LCD_NT35510-MRB3971.git
      4  */
      5 #ifndef _ARDUINO_NT35510_H_
      6 #define _ARDUINO_NT35510_H_
      7 
      8 #include <Arduino.h>
      9 #include <Print.h>
     10 #include "../Arduino_GFX.h"
     11 #include "../Arduino_TFT.h"
     12 
     13 #define NT35510_TFTWIDTH 480  ///< NT35510 max TFT width
     14 #define NT35510_TFTHEIGHT 800 ///< NT35510 max TFT height
     15 
     16 #define NT35510_RST_DELAY 500    ///< delay ms wait for reset finish
     17 #define NT35510_SLPIN_DELAY 120  ///< delay ms wait for sleep in finish
     18 #define NT35510_SLPOUT_DELAY 120 ///< delay ms wait for sleep out finish
     19 
     20 #define NT35510_NOP 0x0000
     21 #define NT35510_SWRESET 0x0100
     22 #define NT35510_RDNUMED 0x0500
     23 #define NT35510_RDDPM 0x0A00
     24 #define NT35510_RDDMADCTR 0x0B00
     25 #define NT35510_RDDCOLMOD 0x0C00
     26 #define NT35510_RDDIM 0x0D00
     27 #define NT35510_RDDSM 0x0E00
     28 #define NT35510_RDDSDR 0x0F00
     29 
     30 #define NT35510_SLPIN 0x1000
     31 #define NT35510_SLPOUT 0x1100
     32 #define NT35510_PTLON 0x1200
     33 #define NT35510_NORON 0x1300
     34 
     35 #define NT35510_INVOFF 0x2000
     36 #define NT35510_INVON 0x2100
     37 #define NT35510_ALLPOFF 0x2200
     38 #define NT35510_ALLPON 0x2300
     39 #define NT35510_GAMSET 0x2600
     40 #define NT35510_DISPOFF 0x2800
     41 #define NT35510_DISPON 0x2900
     42 #define NT35510_CASET 0x2A00
     43 #define NT35510_PASET 0x2B00
     44 #define NT35510_RAMWR 0x2C00
     45 #define NT35510_RAMRD 0x2E00
     46 
     47 #define NT35510_PTLAR 0x3000
     48 #define NT35510_TEOFF 0x3400
     49 #define NT35510_TEON 0x3500
     50 #define NT35510_MADCTR 0x3600
     51 #define NT35510_IDMOFF 0x3800
     52 #define NT35510_IDMON 0x3900
     53 #define NT35510_COLMOD 0x3A00
     54 #define NT35510_RAMWRCNT 0x3C00
     55 #define NT35510_RAMRDCNT 0x3E00
     56 
     57 #define NT35510_WRTESCN 0x4400
     58 #define NT35510_RDSCNL 0x4500
     59 
     60 #define NT35510_WRDISBV 0x5100
     61 #define NT35510_RDDISBV 0x5200
     62 #define NT35510_WRCTRLD 0x5300
     63 #define NT35510_RDCTRLD 0x5400
     64 #define NT35510_WRCABC 0x5500
     65 #define NT35510_RDCABC 0x5600
     66 #define NT35510_WRCABCMB 0x5E00
     67 #define NT35510_RDCABCMB 0x5F00
     68 
     69 #define NT35510_RDPWMSDR 0x6800
     70 
     71 #define NT35510_RDBWLB 0x7000
     72 #define NT35510_RDBKX 0x7100
     73 #define NT35510_RDBKY 0x7200
     74 #define NT35510_RDWX 0x7300
     75 #define NT35510_RDWY 0x7400
     76 #define NT35510_RDRGLB 0x7500
     77 #define NT35510_RDRX 0x7600
     78 #define NT35510_RDRY 0x7700
     79 #define NT35510_RDGX 0x7800
     80 #define NT35510_RDGY 0x7900
     81 #define NT35510_RDBALB 0x7A00
     82 #define NT35510_RDBX 0x7B00
     83 #define NT35510_RDBY 0x7C00
     84 #define NT35510_RDAX 0x7D00
     85 #define NT35510_RDAY 0x7E00
     86 
     87 #define NT35510_RDDDBSTR 0xA100
     88 #define NT35510_RDDDBCNT 0xA800
     89 #define NT35510_RDFCS 0xAA00
     90 #define NT35510_RDCCS 0xAF00
     91 
     92 #define NT35510_RDID1 0xDA00
     93 #define NT35510_RDID2 0xDB00
     94 #define NT35510_RDID3 0xDC00
     95 
     96 #define NT35510_MADCTL_MY 0x80
     97 #define NT35510_MADCTL_MX 0x40
     98 #define NT35510_MADCTL_MV 0x20
     99 
    100 class Arduino_NT35510 : public Arduino_TFT
    101 {
    102 public:
    103   Arduino_NT35510(
    104       Arduino_DataBus *bus, int8_t rst = GFX_NOT_DEFINED, uint8_t r = 0,
    105       bool ips = false, int16_t w = NT35510_TFTWIDTH, int16_t h = NT35510_TFTHEIGHT,
    106       uint8_t col_offset1 = 0, uint8_t row_offset1 = 0, uint8_t col_offset2 = 0, uint8_t row_offset2 = 0);
    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 WriteRegM(uint16_t adr, uint16_t len, uint8_t dat[]);
    120   void tftInit() override;
    121 
    122 private:
    123 };
    124 
    125 #endif