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_ESP8266SPI.h (2040B)

      1 /*
      2  * start rewrite from:
      3  * https://github.com/Bodmer/TFT_eSPI.git
      4  */
      5 #ifdef ESP8266
      6 
      7 #ifndef _ARDUINO_ESP8266SPI_H_
      8 #define _ARDUINO_ESP8266SPI_H_
      9 
     10 #include "Arduino_DataBus.h"
     11 
     12 class Arduino_ESP8266SPI : public Arduino_DataBus
     13 {
     14 public:
     15   Arduino_ESP8266SPI(int8_t dc, int8_t cs = GFX_NOT_DEFINED); // Constructor
     16 
     17   bool begin(int32_t speed = GFX_NOT_DEFINED, int8_t dataMode = GFX_NOT_DEFINED) override;
     18   void beginWrite() override;
     19   void endWrite() override;
     20   void writeCommand(uint8_t) override;
     21   void writeCommand16(uint16_t) override;
     22   void write(uint8_t) override;
     23   void write16(uint16_t) override;
     24   void writeRepeat(uint16_t p, uint32_t len) override;
     25   void writePixels(uint16_t *data, uint32_t len) override;
     26 
     27   void writeC8D8(uint8_t c, uint8_t d) override;
     28   void writeC8D16(uint8_t c, uint16_t d) override;
     29   void writeC8D16D16(uint8_t c, uint16_t d1, uint16_t d2) override;
     30   void writeBytes(uint8_t *data, uint32_t len) override;
     31   void writePattern(uint8_t *data, uint8_t len, uint32_t repeat) override;
     32 
     33   void writeIndexedPixels(uint8_t *data, uint16_t *idx, uint32_t len) override;
     34   void writeIndexedPixelsDouble(uint8_t *data, uint16_t *idx, uint32_t len) override;
     35 
     36 private:
     37   INLINE void WRITE(uint8_t d);
     38   INLINE void WRITE16(uint16_t d);
     39   INLINE void DC_HIGH(void);
     40   INLINE void DC_LOW(void);
     41   INLINE void CS_HIGH(void);
     42   INLINE void CS_LOW(void);
     43 
     44   int8_t _dc, _cs;
     45 
     46   PORTreg_t _csPort;               ///< PORT register for chip select
     47   PORTreg_t _dcPort;               ///< PORT register for data/command
     48   ARDUINOGFX_PORT_t _csPinMaskSet; ///< Bitmask for chip select SET (OR)
     49   ARDUINOGFX_PORT_t _csPinMaskClr; ///< Bitmask for chip select CLEAR (AND)
     50   ARDUINOGFX_PORT_t _dcPinMaskSet; ///< Bitmask for data/command SET (OR)
     51   ARDUINOGFX_PORT_t _dcPinMaskClr; ///< Bitmask for data/command CLEAR (AND)
     52 
     53   uint32_t twoPixelBuf[16];
     54   volatile uint32_t *spi1Reg32 = (volatile uint32_t *)(0x60000000 + 0x140); // address of SPI1W0
     55 };
     56 
     57 #endif // _ARDUINO_ESP8266SPI_H_
     58 
     59 #endif // #ifdef ESP8266