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

      1 #ifndef _ARDUINO_OTM8009A_H_
      2 #define _ARDUINO_OTM8009A_H_
      3 
      4 #include <Arduino.h>
      5 #include <Print.h>
      6 #include "../Arduino_GFX.h"
      7 #include "../Arduino_TFT.h"
      8 
      9 #define OTM8009A_TFTWIDTH 480  ///< OTM8009A max TFT width
     10 #define OTM8009A_TFTHEIGHT 800 ///< OTM8009A max TFT height
     11 
     12 #define OTM8009A_RST_DELAY 500    ///< delay ms wait for reset finish
     13 #define OTM8009A_SLPIN_DELAY 120  ///< delay ms wait for sleep in finish
     14 #define OTM8009A_SLPOUT_DELAY 120 ///< delay ms wait for sleep out finish
     15 
     16 #define OTM8009A_NOP 0x0000
     17 #define OTM8009A_SWRESET 0x0100
     18 #define OTM8009A_RDNUMED 0x0500
     19 #define OTM8009A_RDDPM 0x0A00
     20 #define OTM8009A_RDDMADCTR 0x0B00
     21 #define OTM8009A_RDDCOLMOD 0x0C00
     22 #define OTM8009A_RDDIM 0x0D00
     23 #define OTM8009A_RDDSM 0x0E00
     24 #define OTM8009A_RDDSDR 0x0F00
     25 
     26 #define OTM8009A_SLPIN 0x1000
     27 #define OTM8009A_SLPOUT 0x1100
     28 #define OTM8009A_PTLON 0x1200
     29 #define OTM8009A_NORON 0x1300
     30 
     31 #define OTM8009A_INVOFF 0x2000
     32 #define OTM8009A_INVON 0x2100
     33 #define OTM8009A_ALLPOFF 0x2200
     34 #define OTM8009A_ALLPON 0x2300
     35 #define OTM8009A_GAMSET 0x2600
     36 #define OTM8009A_DISPOFF 0x2800
     37 #define OTM8009A_DISPON 0x2900
     38 #define OTM8009A_CASET 0x2A00
     39 #define OTM8009A_PASET 0x2B00
     40 #define OTM8009A_RAMWR 0x2C00
     41 #define OTM8009A_RAMRD 0x2E00
     42 
     43 #define OTM8009A_PTLAR 0x3000
     44 #define OTM8009A_TEOFF 0x3400
     45 #define OTM8009A_TEON 0x3500
     46 #define OTM8009A_MADCTR 0x3600
     47 #define OTM8009A_IDMOFF 0x3800
     48 #define OTM8009A_IDMON 0x3900
     49 #define OTM8009A_COLMOD 0x3A00
     50 #define OTM8009A_RAMWRCNT 0x3C00
     51 #define OTM8009A_RAMRDCNT 0x3E00
     52 
     53 #define OTM8009A_WRTESCN 0x4400
     54 #define OTM8009A_RDSCNL 0x4500
     55 
     56 #define OTM8009A_WRDISBV 0x5100
     57 #define OTM8009A_RDDISBV 0x5200
     58 #define OTM8009A_WRCTRLD 0x5300
     59 #define OTM8009A_RDCTRLD 0x5400
     60 #define OTM8009A_WRCABC 0x5500
     61 #define OTM8009A_RDCABC 0x5600
     62 #define OTM8009A_WRCABCMB 0x5E00
     63 #define OTM8009A_RDCABCMB 0x5F00
     64 
     65 #define OTM8009A_RDPWMSDR 0x6800
     66 
     67 #define OTM8009A_RDBWLB 0x7000
     68 #define OTM8009A_RDBKX 0x7100
     69 #define OTM8009A_RDBKY 0x7200
     70 #define OTM8009A_RDWX 0x7300
     71 #define OTM8009A_RDWY 0x7400
     72 #define OTM8009A_RDRGLB 0x7500
     73 #define OTM8009A_RDRX 0x7600
     74 #define OTM8009A_RDRY 0x7700
     75 #define OTM8009A_RDGX 0x7800
     76 #define OTM8009A_RDGY 0x7900
     77 #define OTM8009A_RDBALB 0x7A00
     78 #define OTM8009A_RDBX 0x7B00
     79 #define OTM8009A_RDBY 0x7C00
     80 #define OTM8009A_RDAX 0x7D00
     81 #define OTM8009A_RDAY 0x7E00
     82 
     83 #define OTM8009A_RDDDBSTR 0xA100
     84 #define OTM8009A_RDDDBCNT 0xA800
     85 #define OTM8009A_RDFCS 0xAA00
     86 #define OTM8009A_RDCCS 0xAF00
     87 
     88 #define OTM8009A_RDID1 0xDA00
     89 #define OTM8009A_RDID2 0xDB00
     90 #define OTM8009A_RDID3 0xDC00
     91 
     92 #define OTM8009A_MADCTL_MY 0x80
     93 #define OTM8009A_MADCTL_MX 0x40
     94 #define OTM8009A_MADCTL_MV 0x20
     95 
     96 class Arduino_OTM8009A : public Arduino_TFT
     97 {
     98 public:
     99   Arduino_OTM8009A(
    100       Arduino_DataBus *bus, int8_t rst = GFX_NOT_DEFINED, uint8_t r = 0,
    101       bool ips = false, int16_t w = OTM8009A_TFTWIDTH, int16_t h = OTM8009A_TFTHEIGHT,
    102       uint8_t col_offset1 = 0, uint8_t row_offset1 = 0, uint8_t col_offset2 = 0, uint8_t row_offset2 = 0);
    103 
    104   bool begin(int32_t speed = GFX_NOT_DEFINED) override;
    105 
    106   void setRotation(uint8_t r) override;
    107 
    108   void writeAddrWindow(int16_t x, int16_t y, uint16_t w, uint16_t h) override;
    109 
    110   void invertDisplay(bool) override;
    111   void displayOn() override;
    112   void displayOff() override;
    113 
    114 protected:
    115   void WriteRegM(uint16_t adr, uint16_t len, uint8_t dat[]);
    116   void tftInit() override;
    117 
    118 private:
    119 };
    120 
    121 #endif