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_SWPAR8.h (4943B)
1 #ifndef _ARDUINO_SWPAR8_H_ 2 #define _ARDUINO_SWPAR8_H_ 3 4 #include "Arduino_DataBus.h" 5 6 class Arduino_SWPAR8 : public Arduino_DataBus 7 { 8 public: 9 Arduino_SWPAR8( 10 int8_t dc, int8_t cs, int8_t wr, int8_t rd, 11 int8_t d0, int8_t d1, int8_t d2, int8_t d3, int8_t d4, int8_t d5, int8_t d6, int8_t d7); // Constructor 12 13 bool begin(int32_t speed = GFX_NOT_DEFINED, int8_t dataMode = GFX_NOT_DEFINED) override; 14 void beginWrite() override; 15 void endWrite() override; 16 void writeCommand(uint8_t) override; 17 void writeCommand16(uint16_t) override; 18 void write(uint8_t) override; 19 void write16(uint16_t) override; 20 void writeRepeat(uint16_t p, uint32_t len) override; 21 void writePixels(uint16_t *data, uint32_t len) override; 22 23 #if !defined(LITTLE_FOOT_PRINT) 24 void writeC8D8(uint8_t c, uint8_t d) override; 25 void writeC8D16(uint8_t c, uint16_t d) override; 26 void writeC8D16D16(uint8_t c, uint16_t d1, uint16_t d2) override; 27 void writeBytes(uint8_t *data, uint32_t len) override; 28 void writePattern(uint8_t *data, uint8_t len, uint32_t repeat) override; 29 30 void writeIndexedPixels(uint8_t *data, uint16_t *idx, uint32_t len) override; 31 void writeIndexedPixelsDouble(uint8_t *data, uint16_t *idx, uint32_t len) override; 32 #endif // !defined(LITTLE_FOOT_PRINT) 33 34 private: 35 INLINE void WRITE(uint8_t d); 36 INLINE void WRITEREPEAT(uint16_t p, uint32_t len); 37 INLINE void DC_HIGH(void); 38 INLINE void DC_LOW(void); 39 INLINE void CS_HIGH(void); 40 INLINE void CS_LOW(void); 41 INLINE void WR_HIGH(void); 42 INLINE void WR_LOW(void); 43 INLINE void RD_HIGH(void); 44 INLINE void RD_LOW(void); 45 INLINE void D0_HIGH(void); 46 INLINE void D0_LOW(void); 47 INLINE void D1_HIGH(void); 48 INLINE void D1_LOW(void); 49 INLINE void D2_HIGH(void); 50 INLINE void D2_LOW(void); 51 INLINE void D3_HIGH(void); 52 INLINE void D3_LOW(void); 53 INLINE void D4_HIGH(void); 54 INLINE void D4_LOW(void); 55 INLINE void D5_HIGH(void); 56 INLINE void D5_LOW(void); 57 INLINE void D6_HIGH(void); 58 INLINE void D6_LOW(void); 59 INLINE void D7_HIGH(void); 60 INLINE void D7_LOW(void); 61 62 int8_t _dc, _cs, _wr, _rd; 63 int8_t _d0, _d1, _d2, _d3, _d4, _d5, _d6, _d7; 64 65 // CLASS INSTANCE VARIABLES -------------------------------------------- 66 67 // Here be dragons! There's a big union of three structures here -- 68 // one each for hardware SPI, software (bitbang) SPI, and parallel 69 // interfaces. This is to save some memory, since a display's connection 70 // will be only one of these. The order of some things is a little weird 71 // in an attempt to get values to align and pack better in RAM. 72 73 #if defined(USE_FAST_PINIO) 74 #if defined(HAS_PORT_SET_CLR) 75 PORTreg_t _dcPortSet; 76 PORTreg_t _dcPortClr; 77 PORTreg_t _csPortSet; 78 PORTreg_t _csPortClr; 79 PORTreg_t _wrPortSet; 80 PORTreg_t _wrPortClr; 81 PORTreg_t _rdPortSet; 82 PORTreg_t _rdPortClr; 83 PORTreg_t _d0PortSet; 84 PORTreg_t _d0PortClr; 85 PORTreg_t _d1PortSet; 86 PORTreg_t _d1PortClr; 87 PORTreg_t _d2PortSet; 88 PORTreg_t _d2PortClr; 89 PORTreg_t _d3PortSet; 90 PORTreg_t _d3PortClr; 91 PORTreg_t _d4PortSet; 92 PORTreg_t _d4PortClr; 93 PORTreg_t _d5PortSet; 94 PORTreg_t _d5PortClr; 95 PORTreg_t _d6PortSet; 96 PORTreg_t _d6PortClr; 97 PORTreg_t _d7PortSet; 98 PORTreg_t _d7PortClr; 99 #if !defined(KINETISK) 100 ARDUINOGFX_PORT_t _dcPinMask; 101 ARDUINOGFX_PORT_t _csPinMask; 102 ARDUINOGFX_PORT_t _wrPinMask; 103 ARDUINOGFX_PORT_t _rdPinMask; 104 ARDUINOGFX_PORT_t _d0PinMask; 105 ARDUINOGFX_PORT_t _d1PinMask; 106 ARDUINOGFX_PORT_t _d2PinMask; 107 ARDUINOGFX_PORT_t _d3PinMask; 108 ARDUINOGFX_PORT_t _d4PinMask; 109 ARDUINOGFX_PORT_t _d5PinMask; 110 ARDUINOGFX_PORT_t _d6PinMask; 111 ARDUINOGFX_PORT_t _d7PinMask; 112 #endif // !KINETISK 113 #else // !HAS_PORT_SET_CLR 114 PORTreg_t _dcPort; 115 PORTreg_t _csPort; 116 PORTreg_t _wrPort; 117 PORTreg_t _rdPort; 118 PORTreg_t _d0Port; 119 PORTreg_t _d1Port; 120 PORTreg_t _d2Port; 121 PORTreg_t _d3Port; 122 PORTreg_t _d4Port; 123 PORTreg_t _d5Port; 124 PORTreg_t _d6Port; 125 PORTreg_t _d7Port; 126 ARDUINOGFX_PORT_t _dcPinMaskSet; 127 ARDUINOGFX_PORT_t _dcPinMaskClr; 128 ARDUINOGFX_PORT_t _csPinMaskSet; 129 ARDUINOGFX_PORT_t _csPinMaskClr; 130 ARDUINOGFX_PORT_t _wrPinMaskSet; 131 ARDUINOGFX_PORT_t _wrPinMaskClr; 132 ARDUINOGFX_PORT_t _rdPinMaskSet; 133 ARDUINOGFX_PORT_t _rdPinMaskClr; 134 ARDUINOGFX_PORT_t _d0PinMaskSet; 135 ARDUINOGFX_PORT_t _d0PinMaskClr; 136 ARDUINOGFX_PORT_t _d1PinMaskSet; 137 ARDUINOGFX_PORT_t _d1PinMaskClr; 138 ARDUINOGFX_PORT_t _d2PinMaskSet; 139 ARDUINOGFX_PORT_t _d2PinMaskClr; 140 ARDUINOGFX_PORT_t _d3PinMaskSet; 141 ARDUINOGFX_PORT_t _d3PinMaskClr; 142 ARDUINOGFX_PORT_t _d4PinMaskSet; 143 ARDUINOGFX_PORT_t _d4PinMaskClr; 144 ARDUINOGFX_PORT_t _d5PinMaskSet; 145 ARDUINOGFX_PORT_t _d5PinMaskClr; 146 ARDUINOGFX_PORT_t _d6PinMaskSet; 147 ARDUINOGFX_PORT_t _d6PinMaskClr; 148 ARDUINOGFX_PORT_t _d7PinMaskSet; 149 ARDUINOGFX_PORT_t _d7PinMaskClr; 150 #endif // HAS_PORT_SET_CLR 151 #endif // defined(USE_FAST_PINIO) 152 }; 153 154 #endif // _ARDUINO_SWPAR8_H_