From 49a9ae5c7b7c4cd8ab1c85df296003312b5aa561 Mon Sep 17 00:00:00 2001 From: Doxygen CI Date: Thu, 18 Jul 2024 14:20:36 +0000 Subject: [PATCH] Deploy docs to GitHub Pages from commit 5080bec822 Commit: 5080bec82279b56362d6d2332311564322afcafa GitHub Actions run: 9993199644 --- html/_adafruit___gray_o_l_e_d_8h_source.html | 50 +++---- html/_adafruit___s_p_i_t_f_t_8h_source.html | 142 +++++++++---------- 2 files changed, 96 insertions(+), 96 deletions(-) diff --git a/html/_adafruit___gray_o_l_e_d_8h_source.html b/html/_adafruit___gray_o_l_e_d_8h_source.html index fb0547ff..0df59077 100644 --- a/html/_adafruit___gray_o_l_e_d_8h_source.html +++ b/html/_adafruit___gray_o_l_e_d_8h_source.html @@ -62,33 +62,33 @@
Adafruit_GrayOLED.h
-Go to the documentation of this file.
1 
24 #ifndef _Adafruit_GRAYOLED_H_
25 #define _Adafruit_GRAYOLED_H_
26 
27 #if !defined(__AVR_ATtiny85__) // Not for ATtiny, at all
28 
29 #include <Adafruit_GFX.h>
30 #include <Adafruit_I2CDevice.h>
31 #include <Adafruit_SPIDevice.h>
32 #include <SPI.h>
33 #include <Wire.h>
34 
35 #define GRAYOLED_SETCONTRAST 0x81
36 #define GRAYOLED_NORMALDISPLAY 0xA6
37 #define GRAYOLED_INVERTDISPLAY 0xA7
38 
39 #define MONOOLED_BLACK 0
40 #define MONOOLED_WHITE 1
41 #define MONOOLED_INVERSE 2
42 
43 
48 public:
49  Adafruit_GrayOLED(uint8_t bpp, uint16_t w, uint16_t h, TwoWire *twi = &Wire,
50  int8_t rst_pin = -1, uint32_t preclk = 400000,
51  uint32_t postclk = 100000);
52  Adafruit_GrayOLED(uint8_t bpp, uint16_t w, uint16_t h, int8_t mosi_pin,
53  int8_t sclk_pin, int8_t dc_pin, int8_t rst_pin,
54  int8_t cs_pin);
55  Adafruit_GrayOLED(uint8_t bpp, uint16_t w, uint16_t h, SPIClass *spi,
56  int8_t dc_pin, int8_t rst_pin, int8_t cs_pin,
57  uint32_t bitrate = 8000000UL);
58 
59  ~Adafruit_GrayOLED(void);
60 
65  virtual void display(void) = 0;
66  void clearDisplay(void);
67  void invertDisplay(bool i);
68  void setContrast(uint8_t contrastlevel);
69  void drawPixel(int16_t x, int16_t y, uint16_t color);
70  bool getPixel(int16_t x, int16_t y);
71  uint8_t *getBuffer(void);
72 
73  void oled_command(uint8_t c);
74  bool oled_commandList(const uint8_t *c, uint8_t n);
75 
76 protected:
77  bool _init(uint8_t i2caddr = 0x3C, bool reset = true);
78 
79  Adafruit_SPIDevice *spi_dev = NULL;
80  Adafruit_I2CDevice *i2c_dev = NULL;
81  int32_t i2c_preclk = 400000,
82  i2c_postclk = 100000;
83  uint8_t *buffer = NULL;
84 
85  int16_t window_x1,
86  window_y1,
87  window_x2,
88  window_y2;
89 
90  int dcPin,
91  csPin,
92  rstPin;
93 
94  uint8_t _bpp = 1;
95 private:
96  TwoWire *_theWire = NULL;
97 };
98 
99 #endif // end __AVR_ATtiny85__
100 #endif // _Adafruit_GrayOLED_H_
uint8_t _bpp
Bits per pixel color for this display.
Definition: Adafruit_GrayOLED.h:94
-
int16_t window_x2
Dirty tracking window maximum x.
Definition: Adafruit_GrayOLED.h:85
-
int csPin
The Arduino pin connected to CS (for SPI)
Definition: Adafruit_GrayOLED.h:90
-
bool _init(uint8_t i2caddr=0x3C, bool reset=true)
Allocate RAM for image buffer, initialize peripherals and pins. Note that subclasses must call this b...
Definition: Adafruit_GrayOLED.cpp:224
+Go to the documentation of this file.
1 
24 #ifndef _Adafruit_GRAYOLED_H_
25 #define _Adafruit_GRAYOLED_H_
26 
27 // Not for ATtiny, at all
28 #if !defined(__AVR_ATtiny85__) && !defined(__AVR_ATtiny84__)
29 
30 #include <Adafruit_GFX.h>
31 #include <Adafruit_I2CDevice.h>
32 #include <Adafruit_SPIDevice.h>
33 #include <SPI.h>
34 #include <Wire.h>
35 
36 #define GRAYOLED_SETCONTRAST 0x81
37 #define GRAYOLED_NORMALDISPLAY 0xA6
38 #define GRAYOLED_INVERTDISPLAY 0xA7
39 
40 #define MONOOLED_BLACK 0
41 #define MONOOLED_WHITE 1
42 #define MONOOLED_INVERSE 2
43 
44 
49 public:
50  Adafruit_GrayOLED(uint8_t bpp, uint16_t w, uint16_t h, TwoWire *twi = &Wire,
51  int8_t rst_pin = -1, uint32_t preclk = 400000,
52  uint32_t postclk = 100000);
53  Adafruit_GrayOLED(uint8_t bpp, uint16_t w, uint16_t h, int8_t mosi_pin,
54  int8_t sclk_pin, int8_t dc_pin, int8_t rst_pin,
55  int8_t cs_pin);
56  Adafruit_GrayOLED(uint8_t bpp, uint16_t w, uint16_t h, SPIClass *spi,
57  int8_t dc_pin, int8_t rst_pin, int8_t cs_pin,
58  uint32_t bitrate = 8000000UL);
59 
60  ~Adafruit_GrayOLED(void);
61 
66  virtual void display(void) = 0;
67  void clearDisplay(void);
68  void invertDisplay(bool i);
69  void setContrast(uint8_t contrastlevel);
70  void drawPixel(int16_t x, int16_t y, uint16_t color);
71  bool getPixel(int16_t x, int16_t y);
72  uint8_t *getBuffer(void);
73 
74  void oled_command(uint8_t c);
75  bool oled_commandList(const uint8_t *c, uint8_t n);
76 
77 protected:
78  bool _init(uint8_t i2caddr = 0x3C, bool reset = true);
79 
80  Adafruit_SPIDevice *spi_dev = NULL;
81  Adafruit_I2CDevice *i2c_dev = NULL;
82  int32_t i2c_preclk = 400000,
83  i2c_postclk = 100000;
84  uint8_t *buffer = NULL;
85 
86  int16_t window_x1,
87  window_y1,
88  window_x2,
89  window_y2;
90 
91  int dcPin,
92  csPin,
93  rstPin;
94 
95  uint8_t _bpp = 1;
96 private:
97  TwoWire *_theWire = NULL;
98 };
99 
100 #endif // end __AVR_ATtiny85__ __AVR_ATtiny84__
101 #endif // _Adafruit_GrayOLED_H_
uint8_t _bpp
Bits per pixel color for this display.
Definition: Adafruit_GrayOLED.h:95
+
int16_t window_x2
Dirty tracking window maximum x.
Definition: Adafruit_GrayOLED.h:86
+
int csPin
The Arduino pin connected to CS (for SPI)
Definition: Adafruit_GrayOLED.h:91
+
bool _init(uint8_t i2caddr=0x3C, bool reset=true)
Allocate RAM for image buffer, initialize peripherals and pins. Note that subclasses must call this b...
Definition: Adafruit_GrayOLED.cpp:225
Definition: Adafruit_GFX.h:18
virtual void display(void)=0
The function that sub-classes define that writes out the buffer to the display over I2C or SPI...
-
void drawPixel(int16_t x, int16_t y, uint16_t color)
Set/clear/invert a single pixel. This is also invoked by the Adafruit_GFX library in generating many ...
Definition: Adafruit_GrayOLED.cpp:285
-
int16_t window_y1
Dirty tracking window minimum y.
Definition: Adafruit_GrayOLED.h:85
-
Adafruit_SPIDevice * spi_dev
The SPI interface BusIO device.
Definition: Adafruit_GrayOLED.h:79
-
bool oled_commandList(const uint8_t *c, uint8_t n)
Issue multiple bytes of commands OLED, using I2C or hard/soft SPI as needed.
Definition: Adafruit_GrayOLED.cpp:187
-
int16_t window_y2
Dirty tracking window maximum y.
Definition: Adafruit_GrayOLED.h:85
-
int16_t window_x1
Dirty tracking window minimum x.
Definition: Adafruit_GrayOLED.h:85
-
Adafruit_GrayOLED(uint8_t bpp, uint16_t w, uint16_t h, TwoWire *twi=&Wire, int8_t rst_pin=-1, uint32_t preclk=400000, uint32_t postclk=100000)
Constructor for I2C-interfaced OLED displays.
Definition: Adafruit_GrayOLED.cpp:64
-
void invertDisplay(bool i)
Enable or disable display invert mode (white-on-black vs black-on-white). Handy for testing! ...
Definition: Adafruit_GrayOLED.cpp:407
-
void setContrast(uint8_t contrastlevel)
Adjust the display contrast.
Definition: Adafruit_GrayOLED.cpp:417
-
uint8_t * buffer
Internal 1:1 framebuffer of display mem.
Definition: Adafruit_GrayOLED.h:83
-
~Adafruit_GrayOLED(void)
Destructor for Adafruit_GrayOLED object.
Definition: Adafruit_GrayOLED.cpp:150
-
void clearDisplay(void)
Clear contents of display buffer (set all pixels to off).
Definition: Adafruit_GrayOLED.cpp:344
-
uint8_t * getBuffer(void)
Get base address of display buffer for direct reading or writing.
Definition: Adafruit_GrayOLED.cpp:391
-
int rstPin
The Arduino pin connected to reset (-1 if unused)
Definition: Adafruit_GrayOLED.h:90
-
int32_t i2c_preclk
Configurable &#39;high speed&#39; I2C rate.
Definition: Adafruit_GrayOLED.h:81
-
bool getPixel(int16_t x, int16_t y)
Return color of a single pixel in display buffer.
Definition: Adafruit_GrayOLED.cpp:364
-
Class that stores state and functions for interacting with generic grayscale OLED displays...
Definition: Adafruit_GrayOLED.h:47
-
int32_t i2c_postclk
Configurable &#39;low speed&#39; I2C rate.
Definition: Adafruit_GrayOLED.h:82
-
void oled_command(uint8_t c)
Issue single command byte to OLED, using I2C or hard/soft SPI as needed.
Definition: Adafruit_GrayOLED.cpp:168
-
int dcPin
The Arduino pin connected to D/C (for SPI)
Definition: Adafruit_GrayOLED.h:90
-
Adafruit_I2CDevice * i2c_dev
The I2C interface BusIO device.
Definition: Adafruit_GrayOLED.h:80
+
void drawPixel(int16_t x, int16_t y, uint16_t color)
Set/clear/invert a single pixel. This is also invoked by the Adafruit_GFX library in generating many ...
Definition: Adafruit_GrayOLED.cpp:286
+
int16_t window_y1
Dirty tracking window minimum y.
Definition: Adafruit_GrayOLED.h:86
+
Adafruit_SPIDevice * spi_dev
The SPI interface BusIO device.
Definition: Adafruit_GrayOLED.h:80
+
bool oled_commandList(const uint8_t *c, uint8_t n)
Issue multiple bytes of commands OLED, using I2C or hard/soft SPI as needed.
Definition: Adafruit_GrayOLED.cpp:188
+
int16_t window_y2
Dirty tracking window maximum y.
Definition: Adafruit_GrayOLED.h:86
+
int16_t window_x1
Dirty tracking window minimum x.
Definition: Adafruit_GrayOLED.h:86
+
Adafruit_GrayOLED(uint8_t bpp, uint16_t w, uint16_t h, TwoWire *twi=&Wire, int8_t rst_pin=-1, uint32_t preclk=400000, uint32_t postclk=100000)
Constructor for I2C-interfaced OLED displays.
Definition: Adafruit_GrayOLED.cpp:65
+
void invertDisplay(bool i)
Enable or disable display invert mode (white-on-black vs black-on-white). Handy for testing! ...
Definition: Adafruit_GrayOLED.cpp:408
+
void setContrast(uint8_t contrastlevel)
Adjust the display contrast.
Definition: Adafruit_GrayOLED.cpp:418
+
uint8_t * buffer
Internal 1:1 framebuffer of display mem.
Definition: Adafruit_GrayOLED.h:84
+
~Adafruit_GrayOLED(void)
Destructor for Adafruit_GrayOLED object.
Definition: Adafruit_GrayOLED.cpp:151
+
void clearDisplay(void)
Clear contents of display buffer (set all pixels to off).
Definition: Adafruit_GrayOLED.cpp:345
+
uint8_t * getBuffer(void)
Get base address of display buffer for direct reading or writing.
Definition: Adafruit_GrayOLED.cpp:392
+
int rstPin
The Arduino pin connected to reset (-1 if unused)
Definition: Adafruit_GrayOLED.h:91
+
int32_t i2c_preclk
Configurable &#39;high speed&#39; I2C rate.
Definition: Adafruit_GrayOLED.h:82
+
bool getPixel(int16_t x, int16_t y)
Return color of a single pixel in display buffer.
Definition: Adafruit_GrayOLED.cpp:365
+
Class that stores state and functions for interacting with generic grayscale OLED displays...
Definition: Adafruit_GrayOLED.h:48
+
int32_t i2c_postclk
Configurable &#39;low speed&#39; I2C rate.
Definition: Adafruit_GrayOLED.h:83
+
void oled_command(uint8_t c)
Issue single command byte to OLED, using I2C or hard/soft SPI as needed.
Definition: Adafruit_GrayOLED.cpp:169
+
int dcPin
The Arduino pin connected to D/C (for SPI)
Definition: Adafruit_GrayOLED.h:91
+
Adafruit_I2CDevice * i2c_dev
The I2C interface BusIO device.
Definition: Adafruit_GrayOLED.h:81
-Go to the documentation of this file.
1 
20 #ifndef _ADAFRUIT_SPITFT_H_
21 #define _ADAFRUIT_SPITFT_H_
22 
23 #if !defined(__AVR_ATtiny85__) // Not for ATtiny, at all
24 
25 #include "Adafruit_GFX.h"
26 #include <SPI.h>
27 
28 // HARDWARE CONFIG ---------------------------------------------------------
29 
30 #if defined(__AVR__)
31 typedef uint8_t ADAGFX_PORT_t;
32 #define USE_FAST_PINIO
33 #elif defined(ARDUINO_STM32_FEATHER) // WICED
34 typedef class HardwareSPI SPIClass;
35 typedef uint32_t ADAGFX_PORT_t;
36 #elif defined(__arm__)
37 #if defined(ARDUINO_ARCH_SAMD)
38 // Adafruit M0, M4
39 typedef uint32_t ADAGFX_PORT_t;
40 #define USE_FAST_PINIO
41 #define HAS_PORT_SET_CLR
42 #elif defined(CORE_TEENSY)
43 // PJRC Teensy 4.x
44 #if defined(__IMXRT1052__) || defined(__IMXRT1062__) // Teensy 4.x
45 typedef uint32_t ADAGFX_PORT_t;
46  // PJRC Teensy 3.x
47 #else
48 typedef uint8_t ADAGFX_PORT_t;
49 #endif
50 #define USE_FAST_PINIO
51 #define HAS_PORT_SET_CLR
52 #else
53 // Arduino Due?
54 typedef uint32_t ADAGFX_PORT_t;
55 // USE_FAST_PINIO not available here (yet)...Due has a totally different
56 // GPIO register set and will require some changes elsewhere (e.g. in
57 // constructors especially).
58 #endif
59 #else // !ARM
60 // Probably ESP8266 or ESP32. USE_FAST_PINIO is not available here (yet)
61 // but don't worry about it too much...the digitalWrite() implementation
62 // on these platforms is reasonably efficient and already RAM-resident,
63 // only gotcha then is no parallel connection support for now.
64 typedef uint32_t ADAGFX_PORT_t;
65 #endif // end !ARM
66 typedef volatile ADAGFX_PORT_t *PORTreg_t;
67 
68 #if defined(__AVR__)
69 #define DEFAULT_SPI_FREQ 8000000L
70 #else
71 #define DEFAULT_SPI_FREQ 16000000L
72 #endif
73 
74 #if defined(ADAFRUIT_PYPORTAL) || defined(ADAFRUIT_PYPORTAL_M4_TITANO) || \
75  defined(ADAFRUIT_PYBADGE_M4_EXPRESS) || \
76  defined(ADAFRUIT_PYGAMER_M4_EXPRESS) || \
77  defined(ADAFRUIT_MONSTER_M4SK_EXPRESS) || defined(NRF52_SERIES) || \
78  defined(ADAFRUIT_CIRCUITPLAYGROUND_M0)
79 #define USE_SPI_DMA
80 #else
81  //#define USE_SPI_DMA ///< If set,
82  // use DMA if available
83 #endif
84 // Another "oops" name -- this now also handles parallel DMA.
85 // If DMA is enabled, Arduino sketch MUST #include <Adafruit_ZeroDMA.h>
86 // Estimated RAM usage:
87 // 4 bytes/pixel on display major axis + 8 bytes/pixel on minor axis,
88 // e.g. 320x240 pixels = 320 * 4 + 240 * 8 = 3,200 bytes.
89 
90 #if defined(USE_SPI_DMA) && (defined(__SAMD51__) || defined(ARDUINO_SAMD_ZERO))
91 #include <Adafruit_ZeroDMA.h>
92 #endif
93 
94 // This is kind of a kludge. Needed a way to disambiguate the software SPI
95 // and parallel constructors via their argument lists. Originally tried a
96 // bool as the first argument to the parallel constructor (specifying 8-bit
97 // vs 16-bit interface) but the compiler regards this as equivalent to an
98 // integer and thus still ambiguous. SO...the parallel constructor requires
99 // an enumerated type as the first argument: tft8 (for 8-bit parallel) or
100 // tft16 (for 16-bit)...even though 16-bit isn't fully implemented or tested
101 // and might never be, still needed that disambiguation from soft SPI.
103 enum tftBusWidth { tft8bitbus, tft16bitbus };
104 
105 // CLASS DEFINITION --------------------------------------------------------
106 
121 
122 public:
123  // CONSTRUCTORS --------------------------------------------------------
124 
125  // Software SPI constructor: expects width & height (at default rotation
126  // setting 0), 4 signal pins (cs, dc, mosi, sclk), 2 optional pins
127  // (reset, miso). cs argument is required but can be -1 if unused --
128  // rather than moving it to the optional arguments, it was done this way
129  // to avoid breaking existing code (-1 option was a later addition).
130  Adafruit_SPITFT(uint16_t w, uint16_t h, int8_t cs, int8_t dc, int8_t mosi,
131  int8_t sck, int8_t rst = -1, int8_t miso = -1);
132 
133  // Hardware SPI constructor using the default SPI port: expects width &
134  // height (at default rotation setting 0), 2 signal pins (cs, dc),
135  // optional reset pin. cs is required but can be -1 if unused -- rather
136  // than moving it to the optional arguments, it was done this way to
137  // avoid breaking existing code (-1 option was a later addition).
138  Adafruit_SPITFT(uint16_t w, uint16_t h, int8_t cs, int8_t dc,
139  int8_t rst = -1);
140 
141 #if !defined(ESP8266) // See notes in .cpp
142  // Hardware SPI constructor using an arbitrary SPI peripheral: expects
143  // width & height (rotation 0), SPIClass pointer, 2 signal pins (cs, dc)
144  // and optional reset pin. cs is required but can be -1 if unused.
145  Adafruit_SPITFT(uint16_t w, uint16_t h, SPIClass *spiClass, int8_t cs,
146  int8_t dc, int8_t rst = -1);
147 #endif // end !ESP8266
148 
149  // Parallel constructor: expects width & height (rotation 0), flag
150  // indicating whether 16-bit (true) or 8-bit (false) interface, 3 signal
151  // pins (d0, wr, dc), 3 optional pins (cs, rst, rd). 16-bit parallel
152  // isn't even fully implemented but the 'wide' flag was added as a
153  // required argument to avoid ambiguity with other constructors.
154  Adafruit_SPITFT(uint16_t w, uint16_t h, tftBusWidth busWidth, int8_t d0,
155  int8_t wr, int8_t dc, int8_t cs = -1, int8_t rst = -1,
156  int8_t rd = -1);
157 
158  // DESTRUCTOR ----------------------------------------------------------
159 
160  ~Adafruit_SPITFT(){};
161 
162  // CLASS MEMBER FUNCTIONS ----------------------------------------------
163 
164  // These first two functions MUST be declared by subclasses:
165 
170  virtual void begin(uint32_t freq) = 0;
171 
184  virtual void setAddrWindow(uint16_t x, uint16_t y, uint16_t w,
185  uint16_t h) = 0;
186 
187  // Remaining functions do not need to be declared in subclasses
188  // unless they wish to provide hardware-specific optimizations.
189  // Brief comments here...documented more thoroughly in .cpp file.
190 
191  // Subclass' begin() function invokes this to initialize hardware.
192  // freq=0 to use default SPI speed. spiMode must be one of the SPI_MODEn
193  // values defined in SPI.h, which are NOT the same as 0 for SPI_MODE0,
194  // 1 for SPI_MODE1, etc...use ONLY the SPI_MODEn defines! Only!
195  // Name is outdated (interface may be parallel) but for compatibility:
196  void initSPI(uint32_t freq = 0, uint8_t spiMode = SPI_MODE0);
197  void setSPISpeed(uint32_t freq);
198  // Chip select and/or hardware SPI transaction start as needed:
199  void startWrite(void);
200  // Chip deselect and/or hardware SPI transaction end as needed:
201  void endWrite(void);
202  void sendCommand(uint8_t commandByte, uint8_t *dataBytes,
203  uint8_t numDataBytes);
204  void sendCommand(uint8_t commandByte, const uint8_t *dataBytes = NULL,
205  uint8_t numDataBytes = 0);
206  void sendCommand16(uint16_t commandWord, const uint8_t *dataBytes = NULL,
207  uint8_t numDataBytes = 0);
208  uint8_t readcommand8(uint8_t commandByte, uint8_t index = 0);
209  uint16_t readcommand16(uint16_t addr);
210 
211  // These functions require a chip-select and/or SPI transaction
212  // around them. Higher-level graphics primitives might start a
213  // single transaction and then make multiple calls to these functions
214  // (e.g. circle or text rendering might make repeated lines or rects)
215  // before ending the transaction. It's more efficient than starting a
216  // transaction every time.
217  void writePixel(int16_t x, int16_t y, uint16_t color);
218  void writePixels(uint16_t *colors, uint32_t len, bool block = true,
219  bool bigEndian = false);
220  void writeColor(uint16_t color, uint32_t len);
221  void writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h,
222  uint16_t color);
223  void writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
224  void writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
225  // This is a new function, similar to writeFillRect() except that
226  // all arguments MUST be onscreen, sorted and clipped. If higher-level
227  // primitives can handle their own sorting/clipping, it avoids repeating
228  // such operations in the low-level code, making it potentially faster.
229  // CALLING THIS WITH UNCLIPPED OR NEGATIVE VALUES COULD BE DISASTROUS.
230  inline void writeFillRectPreclipped(int16_t x, int16_t y, int16_t w,
231  int16_t h, uint16_t color);
232  // Another new function, companion to the new non-blocking
233  // writePixels() variant.
234  void dmaWait(void);
235  // Used by writePixels() in some situations, but might have rare need in
236  // user code, so it's public...
237  bool dmaBusy(void) const; // true if DMA is used and busy, false otherwise
238  void swapBytes(uint16_t *src, uint32_t len, uint16_t *dest = NULL);
239 
240  // These functions are similar to the 'write' functions above, but with
241  // a chip-select and/or SPI transaction built-in. They're typically used
242  // solo -- that is, as graphics primitives in themselves, not invoked by
243  // higher-level primitives (which should use the functions above).
244  void drawPixel(int16_t x, int16_t y, uint16_t color);
245  void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
246  void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
247  void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
248  // A single-pixel push encapsulated in a transaction. I don't think
249  // this is used anymore (BMP demos might've used it?) but is provided
250  // for backward compatibility, consider it deprecated:
251  void pushColor(uint16_t color);
252 
253  using Adafruit_GFX::drawRGBBitmap; // Check base class first
254  void drawRGBBitmap(int16_t x, int16_t y, uint16_t *pcolors, int16_t w,
255  int16_t h);
256 
257  void invertDisplay(bool i);
258  uint16_t color565(uint8_t r, uint8_t g, uint8_t b);
259 
260  // Despite parallel additions, function names kept for compatibility:
261  void spiWrite(uint8_t b); // Write single byte as DATA
262  void writeCommand(uint8_t cmd); // Write single byte as COMMAND
263  uint8_t spiRead(void); // Read single byte of data
264  void write16(uint16_t w); // Write 16-bit value as DATA
265  void writeCommand16(uint16_t cmd); // Write 16-bit value as COMMAND
266  uint16_t read16(void); // Read single 16-bit value
267 
268  // Most of these low-level functions were formerly macros in
269  // Adafruit_SPITFT_Macros.h. Some have been made into inline functions
270  // to avoid macro mishaps. Despite the addition of code for a parallel
271  // display interface, the names have been kept for backward
272  // compatibility (some subclasses may be invoking these):
273  void SPI_WRITE16(uint16_t w); // Not inline
274  void SPI_WRITE32(uint32_t l); // Not inline
275  // Old code had both a spiWrite16() function and SPI_WRITE16 macro
276  // in addition to the SPI_WRITE32 macro. The latter two have been
277  // made into functions here, and spiWrite16() removed (use SPI_WRITE16()
278  // instead). It looks like most subclasses had gotten comfortable with
279  // SPI_WRITE16 and SPI_WRITE32 anyway so those names were kept rather
280  // than the less-obnoxious camelcase variants, oh well.
281 
282  // Placing these functions entirely in the class definition inlines
283  // them implicitly them while allowing their use in other code:
284 
291  void SPI_CS_HIGH(void) {
292 #if defined(USE_FAST_PINIO)
293 #if defined(HAS_PORT_SET_CLR)
294 #if defined(KINETISK)
295  *csPortSet = 1;
296 #else // !KINETISK
297  *csPortSet = csPinMask;
298 #endif // end !KINETISK
299 #else // !HAS_PORT_SET_CLR
300  *csPort |= csPinMaskSet;
301 #endif // end !HAS_PORT_SET_CLR
302 #else // !USE_FAST_PINIO
303  digitalWrite(_cs, HIGH);
304 #endif // end !USE_FAST_PINIO
305  }
306 
313  void SPI_CS_LOW(void) {
314 #if defined(USE_FAST_PINIO)
315 #if defined(HAS_PORT_SET_CLR)
316 #if defined(KINETISK)
317  *csPortClr = 1;
318 #else // !KINETISK
319  *csPortClr = csPinMask;
320 #endif // end !KINETISK
321 #else // !HAS_PORT_SET_CLR
322  *csPort &= csPinMaskClr;
323 #endif // end !HAS_PORT_SET_CLR
324 #else // !USE_FAST_PINIO
325  digitalWrite(_cs, LOW);
326 #endif // end !USE_FAST_PINIO
327  }
328 
332  void SPI_DC_HIGH(void) {
333 #if defined(USE_FAST_PINIO)
334 #if defined(HAS_PORT_SET_CLR)
335 #if defined(KINETISK)
336  *dcPortSet = 1;
337 #else // !KINETISK
338  *dcPortSet = dcPinMask;
339 #endif // end !KINETISK
340 #else // !HAS_PORT_SET_CLR
341  *dcPort |= dcPinMaskSet;
342 #endif // end !HAS_PORT_SET_CLR
343 #else // !USE_FAST_PINIO
344  digitalWrite(_dc, HIGH);
345 #endif // end !USE_FAST_PINIO
346  }
347 
351  void SPI_DC_LOW(void) {
352 #if defined(USE_FAST_PINIO)
353 #if defined(HAS_PORT_SET_CLR)
354 #if defined(KINETISK)
355  *dcPortClr = 1;
356 #else // !KINETISK
357  *dcPortClr = dcPinMask;
358 #endif // end !KINETISK
359 #else // !HAS_PORT_SET_CLR
360  *dcPort &= dcPinMaskClr;
361 #endif // end !HAS_PORT_SET_CLR
362 #else // !USE_FAST_PINIO
363  digitalWrite(_dc, LOW);
364 #endif // end !USE_FAST_PINIO
365  }
366 
367 protected:
368  // A few more low-level member functions -- some may have previously
369  // been macros. Shouldn't have a need to access these externally, so
370  // they've been moved to the protected section. Additionally, they're
371  // declared inline here and the code is in the .cpp file, since outside
372  // code doesn't need to see these.
373  inline void SPI_MOSI_HIGH(void);
374  inline void SPI_MOSI_LOW(void);
375  inline void SPI_SCK_HIGH(void);
376  inline void SPI_SCK_LOW(void);
377  inline bool SPI_MISO_READ(void);
378  inline void SPI_BEGIN_TRANSACTION(void);
379  inline void SPI_END_TRANSACTION(void);
380  inline void TFT_WR_STROBE(void); // Parallel interface write strobe
381  inline void TFT_RD_HIGH(void); // Parallel interface read high
382  inline void TFT_RD_LOW(void); // Parallel interface read low
383 
384  // CLASS INSTANCE VARIABLES --------------------------------------------
385 
386  // Here be dragons! There's a big union of three structures here --
387  // one each for hardware SPI, software (bitbang) SPI, and parallel
388  // interfaces. This is to save some memory, since a display's connection
389  // will be only one of these. The order of some things is a little weird
390  // in an attempt to get values to align and pack better in RAM.
391 
392 #if defined(USE_FAST_PINIO)
393 #if defined(HAS_PORT_SET_CLR)
394  PORTreg_t csPortSet;
395  PORTreg_t csPortClr;
396  PORTreg_t dcPortSet;
397  PORTreg_t dcPortClr;
398 #else // !HAS_PORT_SET_CLR
399  PORTreg_t csPort;
400  PORTreg_t dcPort;
401 #endif // end HAS_PORT_SET_CLR
402 #endif // end USE_FAST_PINIO
403 #if defined(__cplusplus) && (__cplusplus >= 201100)
404  union {
405 #endif
406  struct { // Values specific to HARDWARE SPI:
407  SPIClass *_spi;
408 #if defined(SPI_HAS_TRANSACTION)
409  SPISettings settings;
410 #else
411  uint32_t _freq;
412 #endif
413  uint32_t _mode;
414  } hwspi;
415  struct { // Values specific to SOFTWARE SPI:
416 #if defined(USE_FAST_PINIO)
417  PORTreg_t misoPort;
418 #if defined(HAS_PORT_SET_CLR)
419  PORTreg_t mosiPortSet;
420  PORTreg_t mosiPortClr;
421  PORTreg_t sckPortSet;
422  PORTreg_t sckPortClr;
423 #if !defined(KINETISK)
424  ADAGFX_PORT_t mosiPinMask;
425  ADAGFX_PORT_t sckPinMask;
426 #endif // end !KINETISK
427 #else // !HAS_PORT_SET_CLR
428  PORTreg_t mosiPort;
429  PORTreg_t sckPort;
430  ADAGFX_PORT_t mosiPinMaskSet;
431  ADAGFX_PORT_t mosiPinMaskClr;
432  ADAGFX_PORT_t sckPinMaskSet;
433  ADAGFX_PORT_t sckPinMaskClr;
434 #endif // end HAS_PORT_SET_CLR
435 #if !defined(KINETISK)
436  ADAGFX_PORT_t misoPinMask;
437 #endif // end !KINETISK
438 #endif // end USE_FAST_PINIO
439  int8_t _mosi;
440  int8_t _miso;
441  int8_t _sck;
442  } swspi;
443  struct { // Values specific to 8-bit parallel:
444 #if defined(USE_FAST_PINIO)
445 
446 #if defined(__IMXRT1052__) || defined(__IMXRT1062__) // Teensy 4.x
447  volatile uint32_t *writePort;
448  volatile uint32_t *readPort;
449 #else
450  volatile uint8_t *writePort;
451  volatile uint8_t *readPort;
452 #endif
453 #if defined(HAS_PORT_SET_CLR)
454  // Port direction register pointers are always 8-bit regardless of
455  // PORTreg_t -- even if 32-bit port, we modify a byte-aligned 8 bits.
456 #if defined(__IMXRT1052__) || defined(__IMXRT1062__) // Teensy 4.x
457  volatile uint32_t *dirSet;
458  volatile uint32_t *dirClr;
459 #else
460  volatile uint8_t *dirSet;
461  volatile uint8_t *dirClr;
462 #endif
463  PORTreg_t wrPortSet;
464  PORTreg_t wrPortClr;
465  PORTreg_t rdPortSet;
466  PORTreg_t rdPortClr;
467 #if !defined(KINETISK)
468  ADAGFX_PORT_t wrPinMask;
469 #endif // end !KINETISK
470  ADAGFX_PORT_t rdPinMask;
471 #else // !HAS_PORT_SET_CLR
472  // Port direction register pointer is always 8-bit regardless of
473  // PORTreg_t -- even if 32-bit port, we modify a byte-aligned 8 bits.
474  volatile uint8_t *portDir;
475  PORTreg_t wrPort;
476  PORTreg_t rdPort;
477  ADAGFX_PORT_t wrPinMaskSet;
478  ADAGFX_PORT_t wrPinMaskClr;
479  ADAGFX_PORT_t rdPinMaskSet;
480  ADAGFX_PORT_t rdPinMaskClr;
481 #endif // end HAS_PORT_SET_CLR
482 #endif // end USE_FAST_PINIO
483  int8_t _d0;
484  int8_t _wr;
485  int8_t _rd;
486  bool wide = 0;
487  } tft8;
488 #if defined(__cplusplus) && (__cplusplus >= 201100)
489  };
490 #endif
491 #if defined(USE_SPI_DMA) && \
492  (defined(__SAMD51__) || \
493  defined(ARDUINO_SAMD_ZERO)) // Used by hardware SPI and tft8
494  Adafruit_ZeroDMA dma;
495  DmacDescriptor *dptr = NULL;
496  DmacDescriptor *descriptor = NULL;
497  uint16_t *pixelBuf[2];
498  uint16_t maxFillLen;
499  uint16_t lastFillColor = 0;
500  uint32_t lastFillLen = 0;
501  uint8_t onePixelBuf;
502 #endif
503 #if defined(USE_FAST_PINIO)
504 #if defined(HAS_PORT_SET_CLR)
505 #if !defined(KINETISK)
506  ADAGFX_PORT_t csPinMask;
507  ADAGFX_PORT_t dcPinMask;
508 #endif // end !KINETISK
509 #else // !HAS_PORT_SET_CLR
510  ADAGFX_PORT_t csPinMaskSet;
511  ADAGFX_PORT_t csPinMaskClr;
512  ADAGFX_PORT_t dcPinMaskSet;
513  ADAGFX_PORT_t dcPinMaskClr;
514 #endif // end HAS_PORT_SET_CLR
515 #endif // end USE_FAST_PINIO
516  uint8_t connection;
517  int8_t _rst;
518  int8_t _cs;
519  int8_t _dc;
520 
521  int16_t _xstart = 0;
522  int16_t _ystart = 0;
523  uint8_t invertOnCommand = 0;
524  uint8_t invertOffCommand = 0;
525 
526  uint32_t _freq = 0;
527 };
528 
529 #endif // end __AVR_ATtiny85__
530 #endif // end _ADAFRUIT_SPITFT_H_
void sendCommand(uint8_t commandByte, uint8_t *dataBytes, uint8_t numDataBytes)
Adafruit_SPITFT Send Command handles complete sending of commands and data.
Definition: Adafruit_SPITFT.cpp:1901
-
void write16(uint16_t w)
Issue a single 16-bit value to the display. Chip-select, transaction and data/command selection must ...
Definition: Adafruit_SPITFT.cpp:2232
-
uint32_t _freq
SPI bitrate (if no SPI transactions)
Definition: Adafruit_SPITFT.h:411
-
void writePixels(uint16_t *colors, uint32_t len, bool block=true, bool bigEndian=false)
Issue a series of pixels from memory to the display. Not self- contained; should follow startWrite() ...
Definition: Adafruit_SPITFT.cpp:995
-
uint8_t invertOffCommand
Command to disable invert mode.
Definition: Adafruit_SPITFT.h:524
-
int8_t _rd
Read strobe pin # (or -1)
Definition: Adafruit_SPITFT.h:485
-
void writePixel(int16_t x, int16_t y, uint16_t color)
Draw a single pixel to the display at requested coordinates. Not self-contained; should follow a star...
Definition: Adafruit_SPITFT.cpp:945
+Go to the documentation of this file.
1 
20 #ifndef _ADAFRUIT_SPITFT_H_
21 #define _ADAFRUIT_SPITFT_H_
22 
23 // Not for ATtiny, at all
24 #if !defined(__AVR_ATtiny85__) && !defined(__AVR_ATtiny84__)
25 
26 #include "Adafruit_GFX.h"
27 #include <SPI.h>
28 
29 // HARDWARE CONFIG ---------------------------------------------------------
30 
31 #if defined(__AVR__)
32 typedef uint8_t ADAGFX_PORT_t;
33 #define USE_FAST_PINIO
34 #elif defined(ARDUINO_STM32_FEATHER) // WICED
35 typedef class HardwareSPI SPIClass;
36 typedef uint32_t ADAGFX_PORT_t;
37 #elif defined(__arm__)
38 #if defined(ARDUINO_ARCH_SAMD)
39 // Adafruit M0, M4
40 typedef uint32_t ADAGFX_PORT_t;
41 #define USE_FAST_PINIO
42 #define HAS_PORT_SET_CLR
43 #elif defined(CORE_TEENSY)
44 // PJRC Teensy 4.x
45 #if defined(__IMXRT1052__) || defined(__IMXRT1062__) // Teensy 4.x
46 typedef uint32_t ADAGFX_PORT_t;
47  // PJRC Teensy 3.x
48 #else
49 typedef uint8_t ADAGFX_PORT_t;
50 #endif
51 #define USE_FAST_PINIO
52 #define HAS_PORT_SET_CLR
53 #else
54 // Arduino Due?
55 typedef uint32_t ADAGFX_PORT_t;
56 // USE_FAST_PINIO not available here (yet)...Due has a totally different
57 // GPIO register set and will require some changes elsewhere (e.g. in
58 // constructors especially).
59 #endif
60 #else // !ARM
61 // Probably ESP8266 or ESP32. USE_FAST_PINIO is not available here (yet)
62 // but don't worry about it too much...the digitalWrite() implementation
63 // on these platforms is reasonably efficient and already RAM-resident,
64 // only gotcha then is no parallel connection support for now.
65 typedef uint32_t ADAGFX_PORT_t;
66 #endif // end !ARM
67 typedef volatile ADAGFX_PORT_t *PORTreg_t;
68 
69 #if defined(__AVR__)
70 #define DEFAULT_SPI_FREQ 8000000L
71 #else
72 #define DEFAULT_SPI_FREQ 16000000L
73 #endif
74 
75 #if defined(ADAFRUIT_PYPORTAL) || defined(ADAFRUIT_PYPORTAL_M4_TITANO) || \
76  defined(ADAFRUIT_PYBADGE_M4_EXPRESS) || \
77  defined(ADAFRUIT_PYGAMER_M4_EXPRESS) || \
78  defined(ADAFRUIT_MONSTER_M4SK_EXPRESS) || defined(NRF52_SERIES) || \
79  defined(ADAFRUIT_CIRCUITPLAYGROUND_M0)
80 #define USE_SPI_DMA
81 #else
82  //#define USE_SPI_DMA ///< If set,
83  // use DMA if available
84 #endif
85 // Another "oops" name -- this now also handles parallel DMA.
86 // If DMA is enabled, Arduino sketch MUST #include <Adafruit_ZeroDMA.h>
87 // Estimated RAM usage:
88 // 4 bytes/pixel on display major axis + 8 bytes/pixel on minor axis,
89 // e.g. 320x240 pixels = 320 * 4 + 240 * 8 = 3,200 bytes.
90 
91 #if defined(USE_SPI_DMA) && (defined(__SAMD51__) || defined(ARDUINO_SAMD_ZERO))
92 #include <Adafruit_ZeroDMA.h>
93 #endif
94 
95 // This is kind of a kludge. Needed a way to disambiguate the software SPI
96 // and parallel constructors via their argument lists. Originally tried a
97 // bool as the first argument to the parallel constructor (specifying 8-bit
98 // vs 16-bit interface) but the compiler regards this as equivalent to an
99 // integer and thus still ambiguous. SO...the parallel constructor requires
100 // an enumerated type as the first argument: tft8 (for 8-bit parallel) or
101 // tft16 (for 16-bit)...even though 16-bit isn't fully implemented or tested
102 // and might never be, still needed that disambiguation from soft SPI.
104 enum tftBusWidth { tft8bitbus, tft16bitbus };
105 
106 // CLASS DEFINITION --------------------------------------------------------
107 
122 
123 public:
124  // CONSTRUCTORS --------------------------------------------------------
125 
126  // Software SPI constructor: expects width & height (at default rotation
127  // setting 0), 4 signal pins (cs, dc, mosi, sclk), 2 optional pins
128  // (reset, miso). cs argument is required but can be -1 if unused --
129  // rather than moving it to the optional arguments, it was done this way
130  // to avoid breaking existing code (-1 option was a later addition).
131  Adafruit_SPITFT(uint16_t w, uint16_t h, int8_t cs, int8_t dc, int8_t mosi,
132  int8_t sck, int8_t rst = -1, int8_t miso = -1);
133 
134  // Hardware SPI constructor using the default SPI port: expects width &
135  // height (at default rotation setting 0), 2 signal pins (cs, dc),
136  // optional reset pin. cs is required but can be -1 if unused -- rather
137  // than moving it to the optional arguments, it was done this way to
138  // avoid breaking existing code (-1 option was a later addition).
139  Adafruit_SPITFT(uint16_t w, uint16_t h, int8_t cs, int8_t dc,
140  int8_t rst = -1);
141 
142 #if !defined(ESP8266) // See notes in .cpp
143  // Hardware SPI constructor using an arbitrary SPI peripheral: expects
144  // width & height (rotation 0), SPIClass pointer, 2 signal pins (cs, dc)
145  // and optional reset pin. cs is required but can be -1 if unused.
146  Adafruit_SPITFT(uint16_t w, uint16_t h, SPIClass *spiClass, int8_t cs,
147  int8_t dc, int8_t rst = -1);
148 #endif // end !ESP8266
149 
150  // Parallel constructor: expects width & height (rotation 0), flag
151  // indicating whether 16-bit (true) or 8-bit (false) interface, 3 signal
152  // pins (d0, wr, dc), 3 optional pins (cs, rst, rd). 16-bit parallel
153  // isn't even fully implemented but the 'wide' flag was added as a
154  // required argument to avoid ambiguity with other constructors.
155  Adafruit_SPITFT(uint16_t w, uint16_t h, tftBusWidth busWidth, int8_t d0,
156  int8_t wr, int8_t dc, int8_t cs = -1, int8_t rst = -1,
157  int8_t rd = -1);
158 
159  // DESTRUCTOR ----------------------------------------------------------
160 
161  ~Adafruit_SPITFT(){};
162 
163  // CLASS MEMBER FUNCTIONS ----------------------------------------------
164 
165  // These first two functions MUST be declared by subclasses:
166 
171  virtual void begin(uint32_t freq) = 0;
172 
185  virtual void setAddrWindow(uint16_t x, uint16_t y, uint16_t w,
186  uint16_t h) = 0;
187 
188  // Remaining functions do not need to be declared in subclasses
189  // unless they wish to provide hardware-specific optimizations.
190  // Brief comments here...documented more thoroughly in .cpp file.
191 
192  // Subclass' begin() function invokes this to initialize hardware.
193  // freq=0 to use default SPI speed. spiMode must be one of the SPI_MODEn
194  // values defined in SPI.h, which are NOT the same as 0 for SPI_MODE0,
195  // 1 for SPI_MODE1, etc...use ONLY the SPI_MODEn defines! Only!
196  // Name is outdated (interface may be parallel) but for compatibility:
197  void initSPI(uint32_t freq = 0, uint8_t spiMode = SPI_MODE0);
198  void setSPISpeed(uint32_t freq);
199  // Chip select and/or hardware SPI transaction start as needed:
200  void startWrite(void);
201  // Chip deselect and/or hardware SPI transaction end as needed:
202  void endWrite(void);
203  void sendCommand(uint8_t commandByte, uint8_t *dataBytes,
204  uint8_t numDataBytes);
205  void sendCommand(uint8_t commandByte, const uint8_t *dataBytes = NULL,
206  uint8_t numDataBytes = 0);
207  void sendCommand16(uint16_t commandWord, const uint8_t *dataBytes = NULL,
208  uint8_t numDataBytes = 0);
209  uint8_t readcommand8(uint8_t commandByte, uint8_t index = 0);
210  uint16_t readcommand16(uint16_t addr);
211 
212  // These functions require a chip-select and/or SPI transaction
213  // around them. Higher-level graphics primitives might start a
214  // single transaction and then make multiple calls to these functions
215  // (e.g. circle or text rendering might make repeated lines or rects)
216  // before ending the transaction. It's more efficient than starting a
217  // transaction every time.
218  void writePixel(int16_t x, int16_t y, uint16_t color);
219  void writePixels(uint16_t *colors, uint32_t len, bool block = true,
220  bool bigEndian = false);
221  void writeColor(uint16_t color, uint32_t len);
222  void writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h,
223  uint16_t color);
224  void writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
225  void writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
226  // This is a new function, similar to writeFillRect() except that
227  // all arguments MUST be onscreen, sorted and clipped. If higher-level
228  // primitives can handle their own sorting/clipping, it avoids repeating
229  // such operations in the low-level code, making it potentially faster.
230  // CALLING THIS WITH UNCLIPPED OR NEGATIVE VALUES COULD BE DISASTROUS.
231  inline void writeFillRectPreclipped(int16_t x, int16_t y, int16_t w,
232  int16_t h, uint16_t color);
233  // Another new function, companion to the new non-blocking
234  // writePixels() variant.
235  void dmaWait(void);
236  // Used by writePixels() in some situations, but might have rare need in
237  // user code, so it's public...
238  bool dmaBusy(void) const; // true if DMA is used and busy, false otherwise
239  void swapBytes(uint16_t *src, uint32_t len, uint16_t *dest = NULL);
240 
241  // These functions are similar to the 'write' functions above, but with
242  // a chip-select and/or SPI transaction built-in. They're typically used
243  // solo -- that is, as graphics primitives in themselves, not invoked by
244  // higher-level primitives (which should use the functions above).
245  void drawPixel(int16_t x, int16_t y, uint16_t color);
246  void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
247  void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
248  void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
249  // A single-pixel push encapsulated in a transaction. I don't think
250  // this is used anymore (BMP demos might've used it?) but is provided
251  // for backward compatibility, consider it deprecated:
252  void pushColor(uint16_t color);
253 
254  using Adafruit_GFX::drawRGBBitmap; // Check base class first
255  void drawRGBBitmap(int16_t x, int16_t y, uint16_t *pcolors, int16_t w,
256  int16_t h);
257 
258  void invertDisplay(bool i);
259  uint16_t color565(uint8_t r, uint8_t g, uint8_t b);
260 
261  // Despite parallel additions, function names kept for compatibility:
262  void spiWrite(uint8_t b); // Write single byte as DATA
263  void writeCommand(uint8_t cmd); // Write single byte as COMMAND
264  uint8_t spiRead(void); // Read single byte of data
265  void write16(uint16_t w); // Write 16-bit value as DATA
266  void writeCommand16(uint16_t cmd); // Write 16-bit value as COMMAND
267  uint16_t read16(void); // Read single 16-bit value
268 
269  // Most of these low-level functions were formerly macros in
270  // Adafruit_SPITFT_Macros.h. Some have been made into inline functions
271  // to avoid macro mishaps. Despite the addition of code for a parallel
272  // display interface, the names have been kept for backward
273  // compatibility (some subclasses may be invoking these):
274  void SPI_WRITE16(uint16_t w); // Not inline
275  void SPI_WRITE32(uint32_t l); // Not inline
276  // Old code had both a spiWrite16() function and SPI_WRITE16 macro
277  // in addition to the SPI_WRITE32 macro. The latter two have been
278  // made into functions here, and spiWrite16() removed (use SPI_WRITE16()
279  // instead). It looks like most subclasses had gotten comfortable with
280  // SPI_WRITE16 and SPI_WRITE32 anyway so those names were kept rather
281  // than the less-obnoxious camelcase variants, oh well.
282 
283  // Placing these functions entirely in the class definition inlines
284  // them implicitly them while allowing their use in other code:
285 
292  void SPI_CS_HIGH(void) {
293 #if defined(USE_FAST_PINIO)
294 #if defined(HAS_PORT_SET_CLR)
295 #if defined(KINETISK)
296  *csPortSet = 1;
297 #else // !KINETISK
298  *csPortSet = csPinMask;
299 #endif // end !KINETISK
300 #else // !HAS_PORT_SET_CLR
301  *csPort |= csPinMaskSet;
302 #endif // end !HAS_PORT_SET_CLR
303 #else // !USE_FAST_PINIO
304  digitalWrite(_cs, HIGH);
305 #endif // end !USE_FAST_PINIO
306  }
307 
314  void SPI_CS_LOW(void) {
315 #if defined(USE_FAST_PINIO)
316 #if defined(HAS_PORT_SET_CLR)
317 #if defined(KINETISK)
318  *csPortClr = 1;
319 #else // !KINETISK
320  *csPortClr = csPinMask;
321 #endif // end !KINETISK
322 #else // !HAS_PORT_SET_CLR
323  *csPort &= csPinMaskClr;
324 #endif // end !HAS_PORT_SET_CLR
325 #else // !USE_FAST_PINIO
326  digitalWrite(_cs, LOW);
327 #endif // end !USE_FAST_PINIO
328  }
329 
333  void SPI_DC_HIGH(void) {
334 #if defined(USE_FAST_PINIO)
335 #if defined(HAS_PORT_SET_CLR)
336 #if defined(KINETISK)
337  *dcPortSet = 1;
338 #else // !KINETISK
339  *dcPortSet = dcPinMask;
340 #endif // end !KINETISK
341 #else // !HAS_PORT_SET_CLR
342  *dcPort |= dcPinMaskSet;
343 #endif // end !HAS_PORT_SET_CLR
344 #else // !USE_FAST_PINIO
345  digitalWrite(_dc, HIGH);
346 #endif // end !USE_FAST_PINIO
347  }
348 
352  void SPI_DC_LOW(void) {
353 #if defined(USE_FAST_PINIO)
354 #if defined(HAS_PORT_SET_CLR)
355 #if defined(KINETISK)
356  *dcPortClr = 1;
357 #else // !KINETISK
358  *dcPortClr = dcPinMask;
359 #endif // end !KINETISK
360 #else // !HAS_PORT_SET_CLR
361  *dcPort &= dcPinMaskClr;
362 #endif // end !HAS_PORT_SET_CLR
363 #else // !USE_FAST_PINIO
364  digitalWrite(_dc, LOW);
365 #endif // end !USE_FAST_PINIO
366  }
367 
368 protected:
369  // A few more low-level member functions -- some may have previously
370  // been macros. Shouldn't have a need to access these externally, so
371  // they've been moved to the protected section. Additionally, they're
372  // declared inline here and the code is in the .cpp file, since outside
373  // code doesn't need to see these.
374  inline void SPI_MOSI_HIGH(void);
375  inline void SPI_MOSI_LOW(void);
376  inline void SPI_SCK_HIGH(void);
377  inline void SPI_SCK_LOW(void);
378  inline bool SPI_MISO_READ(void);
379  inline void SPI_BEGIN_TRANSACTION(void);
380  inline void SPI_END_TRANSACTION(void);
381  inline void TFT_WR_STROBE(void); // Parallel interface write strobe
382  inline void TFT_RD_HIGH(void); // Parallel interface read high
383  inline void TFT_RD_LOW(void); // Parallel interface read low
384 
385  // CLASS INSTANCE VARIABLES --------------------------------------------
386 
387  // Here be dragons! There's a big union of three structures here --
388  // one each for hardware SPI, software (bitbang) SPI, and parallel
389  // interfaces. This is to save some memory, since a display's connection
390  // will be only one of these. The order of some things is a little weird
391  // in an attempt to get values to align and pack better in RAM.
392 
393 #if defined(USE_FAST_PINIO)
394 #if defined(HAS_PORT_SET_CLR)
395  PORTreg_t csPortSet;
396  PORTreg_t csPortClr;
397  PORTreg_t dcPortSet;
398  PORTreg_t dcPortClr;
399 #else // !HAS_PORT_SET_CLR
400  PORTreg_t csPort;
401  PORTreg_t dcPort;
402 #endif // end HAS_PORT_SET_CLR
403 #endif // end USE_FAST_PINIO
404 #if defined(__cplusplus) && (__cplusplus >= 201100)
405  union {
406 #endif
407  struct { // Values specific to HARDWARE SPI:
408  SPIClass *_spi;
409 #if defined(SPI_HAS_TRANSACTION)
410  SPISettings settings;
411 #else
412  uint32_t _freq;
413 #endif
414  uint32_t _mode;
415  } hwspi;
416  struct { // Values specific to SOFTWARE SPI:
417 #if defined(USE_FAST_PINIO)
418  PORTreg_t misoPort;
419 #if defined(HAS_PORT_SET_CLR)
420  PORTreg_t mosiPortSet;
421  PORTreg_t mosiPortClr;
422  PORTreg_t sckPortSet;
423  PORTreg_t sckPortClr;
424 #if !defined(KINETISK)
425  ADAGFX_PORT_t mosiPinMask;
426  ADAGFX_PORT_t sckPinMask;
427 #endif // end !KINETISK
428 #else // !HAS_PORT_SET_CLR
429  PORTreg_t mosiPort;
430  PORTreg_t sckPort;
431  ADAGFX_PORT_t mosiPinMaskSet;
432  ADAGFX_PORT_t mosiPinMaskClr;
433  ADAGFX_PORT_t sckPinMaskSet;
434  ADAGFX_PORT_t sckPinMaskClr;
435 #endif // end HAS_PORT_SET_CLR
436 #if !defined(KINETISK)
437  ADAGFX_PORT_t misoPinMask;
438 #endif // end !KINETISK
439 #endif // end USE_FAST_PINIO
440  int8_t _mosi;
441  int8_t _miso;
442  int8_t _sck;
443  } swspi;
444  struct { // Values specific to 8-bit parallel:
445 #if defined(USE_FAST_PINIO)
446 
447 #if defined(__IMXRT1052__) || defined(__IMXRT1062__) // Teensy 4.x
448  volatile uint32_t *writePort;
449  volatile uint32_t *readPort;
450 #else
451  volatile uint8_t *writePort;
452  volatile uint8_t *readPort;
453 #endif
454 #if defined(HAS_PORT_SET_CLR)
455  // Port direction register pointers are always 8-bit regardless of
456  // PORTreg_t -- even if 32-bit port, we modify a byte-aligned 8 bits.
457 #if defined(__IMXRT1052__) || defined(__IMXRT1062__) // Teensy 4.x
458  volatile uint32_t *dirSet;
459  volatile uint32_t *dirClr;
460 #else
461  volatile uint8_t *dirSet;
462  volatile uint8_t *dirClr;
463 #endif
464  PORTreg_t wrPortSet;
465  PORTreg_t wrPortClr;
466  PORTreg_t rdPortSet;
467  PORTreg_t rdPortClr;
468 #if !defined(KINETISK)
469  ADAGFX_PORT_t wrPinMask;
470 #endif // end !KINETISK
471  ADAGFX_PORT_t rdPinMask;
472 #else // !HAS_PORT_SET_CLR
473  // Port direction register pointer is always 8-bit regardless of
474  // PORTreg_t -- even if 32-bit port, we modify a byte-aligned 8 bits.
475  volatile uint8_t *portDir;
476  PORTreg_t wrPort;
477  PORTreg_t rdPort;
478  ADAGFX_PORT_t wrPinMaskSet;
479  ADAGFX_PORT_t wrPinMaskClr;
480  ADAGFX_PORT_t rdPinMaskSet;
481  ADAGFX_PORT_t rdPinMaskClr;
482 #endif // end HAS_PORT_SET_CLR
483 #endif // end USE_FAST_PINIO
484  int8_t _d0;
485  int8_t _wr;
486  int8_t _rd;
487  bool wide = 0;
488  } tft8;
489 #if defined(__cplusplus) && (__cplusplus >= 201100)
490  };
491 #endif
492 #if defined(USE_SPI_DMA) && \
493  (defined(__SAMD51__) || \
494  defined(ARDUINO_SAMD_ZERO)) // Used by hardware SPI and tft8
495  Adafruit_ZeroDMA dma;
496  DmacDescriptor *dptr = NULL;
497  DmacDescriptor *descriptor = NULL;
498  uint16_t *pixelBuf[2];
499  uint16_t maxFillLen;
500  uint16_t lastFillColor = 0;
501  uint32_t lastFillLen = 0;
502  uint8_t onePixelBuf;
503 #endif
504 #if defined(USE_FAST_PINIO)
505 #if defined(HAS_PORT_SET_CLR)
506 #if !defined(KINETISK)
507  ADAGFX_PORT_t csPinMask;
508  ADAGFX_PORT_t dcPinMask;
509 #endif // end !KINETISK
510 #else // !HAS_PORT_SET_CLR
511  ADAGFX_PORT_t csPinMaskSet;
512  ADAGFX_PORT_t csPinMaskClr;
513  ADAGFX_PORT_t dcPinMaskSet;
514  ADAGFX_PORT_t dcPinMaskClr;
515 #endif // end HAS_PORT_SET_CLR
516 #endif // end USE_FAST_PINIO
517  uint8_t connection;
518  int8_t _rst;
519  int8_t _cs;
520  int8_t _dc;
521 
522  int16_t _xstart = 0;
523  int16_t _ystart = 0;
524  uint8_t invertOnCommand = 0;
525  uint8_t invertOffCommand = 0;
526 
527  uint32_t _freq = 0;
528 };
529 
530 #endif // end __AVR_ATtiny85__ __AVR_ATtiny84__
531 #endif // end _ADAFRUIT_SPITFT_H_
void sendCommand(uint8_t commandByte, uint8_t *dataBytes, uint8_t numDataBytes)
Adafruit_SPITFT Send Command handles complete sending of commands and data.
Definition: Adafruit_SPITFT.cpp:1902
+
void write16(uint16_t w)
Issue a single 16-bit value to the display. Chip-select, transaction and data/command selection must ...
Definition: Adafruit_SPITFT.cpp:2233
+
uint32_t _freq
SPI bitrate (if no SPI transactions)
Definition: Adafruit_SPITFT.h:412
+
void writePixels(uint16_t *colors, uint32_t len, bool block=true, bool bigEndian=false)
Issue a series of pixels from memory to the display. Not self- contained; should follow startWrite() ...
Definition: Adafruit_SPITFT.cpp:996
+
uint8_t invertOffCommand
Command to disable invert mode.
Definition: Adafruit_SPITFT.h:525
+
int8_t _rd
Read strobe pin # (or -1)
Definition: Adafruit_SPITFT.h:486
+
void writePixel(int16_t x, int16_t y, uint16_t color)
Draw a single pixel to the display at requested coordinates. Not self-contained; should follow a star...
Definition: Adafruit_SPITFT.cpp:946
struct Adafruit_SPITFT::@2 tft8
Parallel interface settings.
virtual void setAddrWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h)=0
Set up the specific display hardware&#39;s "address window" for subsequent pixel-pushing operations...
-
void SPI_WRITE16(uint16_t w)
Issue a single 16-bit value to the display. Chip-select, transaction and data/command selection must ...
Definition: Adafruit_SPITFT.cpp:2394
+
void SPI_WRITE16(uint16_t w)
Issue a single 16-bit value to the display. Chip-select, transaction and data/command selection must ...
Definition: Adafruit_SPITFT.cpp:2395
Definition: Adafruit_GFX.h:18
-
uint16_t readcommand16(uint16_t addr)
Read 16 bits of data from display register. For 16-bit parallel displays only.
Definition: Adafruit_SPITFT.cpp:2023
-
void SPI_BEGIN_TRANSACTION(void)
Start an SPI transaction if using the hardware SPI interface to the display. If using an earlier vers...
Definition: Adafruit_SPITFT.cpp:2065
-
int8_t _sck
SCK pin #.
Definition: Adafruit_SPITFT.h:441
-
void drawRGBBitmap(int16_t x, int16_t y, uint16_t *pcolors, int16_t w, int16_t h)
Draw a 16-bit image (565 RGB) at the specified (x,y) position. For 16-bit display devices; no color r...
Definition: Adafruit_SPITFT.cpp:1829
-
void TFT_RD_LOW(void)
Set the RD line LOW. Used for parallel-connected interfaces when reading data.
Definition: Adafruit_SPITFT.cpp:2549
-
int8_t _cs
Chip select pin # (or -1)
Definition: Adafruit_SPITFT.h:518
-
void writeColor(uint16_t color, uint32_t len)
Issue a series of pixels, all the same color. Not self- contained; should follow startWrite() and set...
Definition: Adafruit_SPITFT.cpp:1193
-
void writeCommand16(uint16_t cmd)
Write a single command word to the display. Chip-select and transaction must have been previously set...
Definition: Adafruit_SPITFT.cpp:2252
-
void SPI_SCK_HIGH(void)
Set the software (bitbang) SPI SCK line HIGH.
Definition: Adafruit_SPITFT.cpp:2333
-
int8_t _miso
MISO pin #.
Definition: Adafruit_SPITFT.h:440
-
uint8_t connection
TFT_HARD_SPI, TFT_SOFT_SPI, etc.
Definition: Adafruit_SPITFT.h:516
-
bool SPI_MISO_READ(void)
Read the state of the software (bitbang) SPI MISO line.
Definition: Adafruit_SPITFT.cpp:2372
-
void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color)
Draw a horizontal line on the display. Self-contained and provides its own transaction as needed (see...
Definition: Adafruit_SPITFT.cpp:1733
-
void writeFillRectPreclipped(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
A lower-level version of writeFillRect(). This version requires all inputs are in-bounds, that width and height are positive, and no part extends offscreen. NO EDGE CLIPPING OR REJECTION IS PERFORMED. If higher-level graphics primitives are written to handle their own clipping earlier in the drawing process, this can avoid unnecessary function calls and repeated clipping operations in the lower-level functions.
Definition: Adafruit_SPITFT.cpp:1621
-
void invertDisplay(bool i)
Invert the colors of the display (if supported by hardware). Self-contained, no transaction setup req...
Definition: Adafruit_SPITFT.cpp:1874
-
tftBusWidth
Definition: Adafruit_SPITFT.h:103
-
void dmaWait(void)
Wait for the last DMA transfer in a prior non-blocking writePixels() call to complete. This does nothing if DMA is not enabled, and is not needed if blocking writePixels() was used (as is the default case).
Definition: Adafruit_SPITFT.cpp:1159
-
Adafruit_SPITFT(uint16_t w, uint16_t h, int8_t cs, int8_t dc, int8_t mosi, int8_t sck, int8_t rst=-1, int8_t miso=-1)
Adafruit_SPITFT constructor for software (bitbang) SPI.
Definition: Adafruit_SPITFT.cpp:117
-
void setSPISpeed(uint32_t freq)
Allow changing the SPI clock speed after initialization.
Definition: Adafruit_SPITFT.cpp:898
+
uint16_t readcommand16(uint16_t addr)
Read 16 bits of data from display register. For 16-bit parallel displays only.
Definition: Adafruit_SPITFT.cpp:2024
+
void SPI_BEGIN_TRANSACTION(void)
Start an SPI transaction if using the hardware SPI interface to the display. If using an earlier vers...
Definition: Adafruit_SPITFT.cpp:2066
+
int8_t _sck
SCK pin #.
Definition: Adafruit_SPITFT.h:442
+
void drawRGBBitmap(int16_t x, int16_t y, uint16_t *pcolors, int16_t w, int16_t h)
Draw a 16-bit image (565 RGB) at the specified (x,y) position. For 16-bit display devices; no color r...
Definition: Adafruit_SPITFT.cpp:1830
+
void TFT_RD_LOW(void)
Set the RD line LOW. Used for parallel-connected interfaces when reading data.
Definition: Adafruit_SPITFT.cpp:2550
+
int8_t _cs
Chip select pin # (or -1)
Definition: Adafruit_SPITFT.h:519
+
void writeColor(uint16_t color, uint32_t len)
Issue a series of pixels, all the same color. Not self- contained; should follow startWrite() and set...
Definition: Adafruit_SPITFT.cpp:1194
+
void writeCommand16(uint16_t cmd)
Write a single command word to the display. Chip-select and transaction must have been previously set...
Definition: Adafruit_SPITFT.cpp:2253
+
void SPI_SCK_HIGH(void)
Set the software (bitbang) SPI SCK line HIGH.
Definition: Adafruit_SPITFT.cpp:2334
+
int8_t _miso
MISO pin #.
Definition: Adafruit_SPITFT.h:441
+
uint8_t connection
TFT_HARD_SPI, TFT_SOFT_SPI, etc.
Definition: Adafruit_SPITFT.h:517
+
bool SPI_MISO_READ(void)
Read the state of the software (bitbang) SPI MISO line.
Definition: Adafruit_SPITFT.cpp:2373
+
void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color)
Draw a horizontal line on the display. Self-contained and provides its own transaction as needed (see...
Definition: Adafruit_SPITFT.cpp:1734
+
void writeFillRectPreclipped(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
A lower-level version of writeFillRect(). This version requires all inputs are in-bounds, that width and height are positive, and no part extends offscreen. NO EDGE CLIPPING OR REJECTION IS PERFORMED. If higher-level graphics primitives are written to handle their own clipping earlier in the drawing process, this can avoid unnecessary function calls and repeated clipping operations in the lower-level functions.
Definition: Adafruit_SPITFT.cpp:1622
+
void invertDisplay(bool i)
Invert the colors of the display (if supported by hardware). Self-contained, no transaction setup req...
Definition: Adafruit_SPITFT.cpp:1875
+
tftBusWidth
Definition: Adafruit_SPITFT.h:104
+
void dmaWait(void)
Wait for the last DMA transfer in a prior non-blocking writePixels() call to complete. This does nothing if DMA is not enabled, and is not needed if blocking writePixels() was used (as is the default case).
Definition: Adafruit_SPITFT.cpp:1160
+
Adafruit_SPITFT(uint16_t w, uint16_t h, int8_t cs, int8_t dc, int8_t mosi, int8_t sck, int8_t rst=-1, int8_t miso=-1)
Adafruit_SPITFT constructor for software (bitbang) SPI.
Definition: Adafruit_SPITFT.cpp:118
+
void setSPISpeed(uint32_t freq)
Allow changing the SPI clock speed after initialization.
Definition: Adafruit_SPITFT.cpp:899
void drawRGBBitmap(int16_t x, int16_t y, const uint16_t bitmap[], int16_t w, int16_t h)
Draw a PROGMEM-resident 16-bit image (RGB 5/6/5) at the specified (x,y) position. For 16-bit display ...
Definition: Adafruit_GFX.cpp:1001
-
void SPI_CS_LOW(void)
Set the chip-select line LOW. Does NOT check whether CS pin is set (>=0), that should be handled in c...
Definition: Adafruit_SPITFT.h:313
+
void SPI_CS_LOW(void)
Set the chip-select line LOW. Does NOT check whether CS pin is set (>=0), that should be handled in c...
Definition: Adafruit_SPITFT.h:314
struct Adafruit_SPITFT::@0 hwspi
Hardware SPI values.
-
void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color)
Draw a vertical line on the display. Self-contained and provides its own transaction as needed (see w...
Definition: Adafruit_SPITFT.cpp:1774
-
int8_t _wr
Write strobe pin #.
Definition: Adafruit_SPITFT.h:484
-
void pushColor(uint16_t color)
Essentially writePixel() with a transaction around it. I don&#39;t think this is in use by any of our cod...
Definition: Adafruit_SPITFT.cpp:1807
-
int16_t _ystart
Internal framebuffer Y offset.
Definition: Adafruit_SPITFT.h:522
-
void SPI_SCK_LOW(void)
Set the software (bitbang) SPI SCK line LOW.
Definition: Adafruit_SPITFT.cpp:2352
-
void SPI_MOSI_HIGH(void)
Set the software (bitbang) SPI MOSI line HIGH.
Definition: Adafruit_SPITFT.cpp:2295
-
void sendCommand16(uint16_t commandWord, const uint8_t *dataBytes=NULL, uint8_t numDataBytes=0)
Adafruit_SPITFT sendCommand16 handles complete sending of commands and data for 16-bit parallel displ...
Definition: Adafruit_SPITFT.cpp:1968
-
void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
Draw a filled rectangle to the display. Self-contained and provides its own transaction as needed (se...
Definition: Adafruit_SPITFT.cpp:1675
-
uint32_t _mode
SPI data mode (transactions or no)
Definition: Adafruit_SPITFT.h:413
-
void writeCommand(uint8_t cmd)
Write a single command byte to the display. Chip-select and transaction must have been previously set...
Definition: Adafruit_SPITFT.cpp:2153
-
void writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
Draw a filled rectangle to the display. Not self-contained; should follow startWrite(). Typically used by higher-level graphics primitives; user code shouldn&#39;t need to call this and is likely to use the self-contained fillRect() instead. writeFillRect() performs its own edge clipping and rejection; see writeFillRectPreclipped() for a more &#39;raw&#39; implementation.
Definition: Adafruit_SPITFT.cpp:1489
-
bool dmaBusy(void) const
Check if DMA transfer is active. Always returts false if DMA is not enabled.
Definition: Adafruit_SPITFT.cpp:1179
-
void SPI_DC_HIGH(void)
Set the data/command line HIGH (data mode).
Definition: Adafruit_SPITFT.h:332
-
void SPI_CS_HIGH(void)
Set the chip-select line HIGH. Does NOT check whether CS pin is set (>=0), that should be handled in ...
Definition: Adafruit_SPITFT.h:291
-
uint16_t read16(void)
Read a single 16-bit value from the display. Chip-select and transaction must have been previously se...
Definition: Adafruit_SPITFT.cpp:2266
-
volatile ADAGFX_PORT_t * PORTreg_t
PORT register type.
Definition: Adafruit_SPITFT.h:66
-
SPIClass * _spi
SPI class pointer.
Definition: Adafruit_SPITFT.h:407
+
void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color)
Draw a vertical line on the display. Self-contained and provides its own transaction as needed (see w...
Definition: Adafruit_SPITFT.cpp:1775
+
int8_t _wr
Write strobe pin #.
Definition: Adafruit_SPITFT.h:485
+
void pushColor(uint16_t color)
Essentially writePixel() with a transaction around it. I don&#39;t think this is in use by any of our cod...
Definition: Adafruit_SPITFT.cpp:1808
+
int16_t _ystart
Internal framebuffer Y offset.
Definition: Adafruit_SPITFT.h:523
+
void SPI_SCK_LOW(void)
Set the software (bitbang) SPI SCK line LOW.
Definition: Adafruit_SPITFT.cpp:2353
+
void SPI_MOSI_HIGH(void)
Set the software (bitbang) SPI MOSI line HIGH.
Definition: Adafruit_SPITFT.cpp:2296
+
void sendCommand16(uint16_t commandWord, const uint8_t *dataBytes=NULL, uint8_t numDataBytes=0)
Adafruit_SPITFT sendCommand16 handles complete sending of commands and data for 16-bit parallel displ...
Definition: Adafruit_SPITFT.cpp:1969
+
void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
Draw a filled rectangle to the display. Self-contained and provides its own transaction as needed (se...
Definition: Adafruit_SPITFT.cpp:1676
+
uint32_t _mode
SPI data mode (transactions or no)
Definition: Adafruit_SPITFT.h:414
+
void writeCommand(uint8_t cmd)
Write a single command byte to the display. Chip-select and transaction must have been previously set...
Definition: Adafruit_SPITFT.cpp:2154
+
void writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
Draw a filled rectangle to the display. Not self-contained; should follow startWrite(). Typically used by higher-level graphics primitives; user code shouldn&#39;t need to call this and is likely to use the self-contained fillRect() instead. writeFillRect() performs its own edge clipping and rejection; see writeFillRectPreclipped() for a more &#39;raw&#39; implementation.
Definition: Adafruit_SPITFT.cpp:1490
+
bool dmaBusy(void) const
Check if DMA transfer is active. Always returts false if DMA is not enabled.
Definition: Adafruit_SPITFT.cpp:1180
+
void SPI_DC_HIGH(void)
Set the data/command line HIGH (data mode).
Definition: Adafruit_SPITFT.h:333
+
void SPI_CS_HIGH(void)
Set the chip-select line HIGH. Does NOT check whether CS pin is set (>=0), that should be handled in ...
Definition: Adafruit_SPITFT.h:292
+
uint16_t read16(void)
Read a single 16-bit value from the display. Chip-select and transaction must have been previously se...
Definition: Adafruit_SPITFT.cpp:2267
+
volatile ADAGFX_PORT_t * PORTreg_t
PORT register type.
Definition: Adafruit_SPITFT.h:67
+
SPIClass * _spi
SPI class pointer.
Definition: Adafruit_SPITFT.h:408
struct Adafruit_SPITFT::@1 swspi
Software SPI values.
-
void SPI_MOSI_LOW(void)
Set the software (bitbang) SPI MOSI line LOW.
Definition: Adafruit_SPITFT.cpp:2314
-
Adafruit_SPITFT is an intermediary class between Adafruit_GFX and various hardware-specific subclasse...
Definition: Adafruit_SPITFT.h:120
-
void drawPixel(int16_t x, int16_t y, uint16_t color)
Draw a single pixel to the display at requested coordinates. Self-contained and provides its own tran...
Definition: Adafruit_SPITFT.cpp:1645
-
void spiWrite(uint8_t b)
Issue a single 8-bit value to the display. Chip-select, transaction and data/command selection must h...
Definition: Adafruit_SPITFT.cpp:2110
-
uint16_t color565(uint8_t r, uint8_t g, uint8_t b)
Given 8-bit red, green and blue values, return a &#39;packed&#39; 16-bit color value in &#39;565&#39; RGB format (5 b...
Definition: Adafruit_SPITFT.cpp:1890
-
int8_t _d0
Data pin 0 #.
Definition: Adafruit_SPITFT.h:483
-
void SPI_DC_LOW(void)
Set the data/command line LOW (command mode).
Definition: Adafruit_SPITFT.h:351
-
void endWrite(void)
Call after issuing command(s) or data to display. Performs chip-deselect (if required) and ends an SP...
Definition: Adafruit_SPITFT.cpp:924
-
uint8_t invertOnCommand
Command to enable invert mode.
Definition: Adafruit_SPITFT.h:523
-
void startWrite(void)
Call before issuing command(s) or data to display. Performs chip-select (if required) and starts an S...
Definition: Adafruit_SPITFT.cpp:912
-
void TFT_WR_STROBE(void)
Set the WR line LOW, then HIGH. Used for parallel-connected interfaces when writing data...
Definition: Adafruit_SPITFT.cpp:2509
-
bool wide
If true, is 16-bit interface.
Definition: Adafruit_SPITFT.h:486
-
int8_t _dc
Data/command pin #.
Definition: Adafruit_SPITFT.h:519
-
void SPI_END_TRANSACTION(void)
End an SPI transaction if using the hardware SPI interface to the display. No action is taken if the ...
Definition: Adafruit_SPITFT.cpp:2093
-
int16_t _xstart
Internal framebuffer X offset.
Definition: Adafruit_SPITFT.h:521
-
void initSPI(uint32_t freq=0, uint8_t spiMode=SPI_MODE0)
Configure microcontroller pins for TFT interfacing. Typically called by a subclass&#39; begin() function...
Definition: Adafruit_SPITFT.cpp:527
+
void SPI_MOSI_LOW(void)
Set the software (bitbang) SPI MOSI line LOW.
Definition: Adafruit_SPITFT.cpp:2315
+
Adafruit_SPITFT is an intermediary class between Adafruit_GFX and various hardware-specific subclasse...
Definition: Adafruit_SPITFT.h:121
+
void drawPixel(int16_t x, int16_t y, uint16_t color)
Draw a single pixel to the display at requested coordinates. Self-contained and provides its own tran...
Definition: Adafruit_SPITFT.cpp:1646
+
void spiWrite(uint8_t b)
Issue a single 8-bit value to the display. Chip-select, transaction and data/command selection must h...
Definition: Adafruit_SPITFT.cpp:2111
+
uint16_t color565(uint8_t r, uint8_t g, uint8_t b)
Given 8-bit red, green and blue values, return a &#39;packed&#39; 16-bit color value in &#39;565&#39; RGB format (5 b...
Definition: Adafruit_SPITFT.cpp:1891
+
int8_t _d0
Data pin 0 #.
Definition: Adafruit_SPITFT.h:484
+
void SPI_DC_LOW(void)
Set the data/command line LOW (command mode).
Definition: Adafruit_SPITFT.h:352
+
void endWrite(void)
Call after issuing command(s) or data to display. Performs chip-deselect (if required) and ends an SP...
Definition: Adafruit_SPITFT.cpp:925
+
uint8_t invertOnCommand
Command to enable invert mode.
Definition: Adafruit_SPITFT.h:524
+
void startWrite(void)
Call before issuing command(s) or data to display. Performs chip-select (if required) and starts an S...
Definition: Adafruit_SPITFT.cpp:913
+
void TFT_WR_STROBE(void)
Set the WR line LOW, then HIGH. Used for parallel-connected interfaces when writing data...
Definition: Adafruit_SPITFT.cpp:2510
+
bool wide
If true, is 16-bit interface.
Definition: Adafruit_SPITFT.h:487
+
int8_t _dc
Data/command pin #.
Definition: Adafruit_SPITFT.h:520
+
void SPI_END_TRANSACTION(void)
End an SPI transaction if using the hardware SPI interface to the display. No action is taken if the ...
Definition: Adafruit_SPITFT.cpp:2094
+
int16_t _xstart
Internal framebuffer X offset.
Definition: Adafruit_SPITFT.h:522
+
void initSPI(uint32_t freq=0, uint8_t spiMode=SPI_MODE0)
Configure microcontroller pins for TFT interfacing. Typically called by a subclass&#39; begin() function...
Definition: Adafruit_SPITFT.cpp:528
virtual void begin(uint32_t freq)=0
Display-specific initialization function.
-
void TFT_RD_HIGH(void)
Set the RD line HIGH. Used for parallel-connected interfaces when reading data.
Definition: Adafruit_SPITFT.cpp:2533
-
void writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color)
Draw a horizontal line on the display. Performs edge clipping and rejection. Not self-contained; shou...
Definition: Adafruit_SPITFT.cpp:1541
-
void SPI_WRITE32(uint32_t l)
Issue a single 32-bit value to the display. Chip-select, transaction and data/command selection must ...
Definition: Adafruit_SPITFT.cpp:2448
-
uint8_t spiRead(void)
Read a single 8-bit value from the display. Chip-select and transaction must have been previously set...
Definition: Adafruit_SPITFT.cpp:2169
-
uint32_t ADAGFX_PORT_t
PORT values are 32-bit.
Definition: Adafruit_SPITFT.h:64
-
uint8_t readcommand8(uint8_t commandByte, uint8_t index=0)
Read 8 bits of data from display configuration memory (not RAM). This is highly undocumented/supporte...
Definition: Adafruit_SPITFT.cpp:2004
-
void swapBytes(uint16_t *src, uint32_t len, uint16_t *dest=NULL)
Swap bytes in an array of pixels; converts little-to-big or big-to-little endian. Used by writePixels...
Definition: Adafruit_SPITFT.cpp:962
-
int8_t _rst
Reset pin # (or -1)
Definition: Adafruit_SPITFT.h:517
-
int8_t _mosi
MOSI pin #.
Definition: Adafruit_SPITFT.h:439
-
void writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color)
Draw a vertical line on the display. Performs edge clipping and rejection. Not self-contained; should...
Definition: Adafruit_SPITFT.cpp:1577
+
void TFT_RD_HIGH(void)
Set the RD line HIGH. Used for parallel-connected interfaces when reading data.
Definition: Adafruit_SPITFT.cpp:2534
+
void writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color)
Draw a horizontal line on the display. Performs edge clipping and rejection. Not self-contained; shou...
Definition: Adafruit_SPITFT.cpp:1542
+
void SPI_WRITE32(uint32_t l)
Issue a single 32-bit value to the display. Chip-select, transaction and data/command selection must ...
Definition: Adafruit_SPITFT.cpp:2449
+
uint8_t spiRead(void)
Read a single 8-bit value from the display. Chip-select and transaction must have been previously set...
Definition: Adafruit_SPITFT.cpp:2170
+
uint32_t ADAGFX_PORT_t
PORT values are 32-bit.
Definition: Adafruit_SPITFT.h:65
+
uint8_t readcommand8(uint8_t commandByte, uint8_t index=0)
Read 8 bits of data from display configuration memory (not RAM). This is highly undocumented/supporte...
Definition: Adafruit_SPITFT.cpp:2005
+
void swapBytes(uint16_t *src, uint32_t len, uint16_t *dest=NULL)
Swap bytes in an array of pixels; converts little-to-big or big-to-little endian. Used by writePixels...
Definition: Adafruit_SPITFT.cpp:963
+
int8_t _rst
Reset pin # (or -1)
Definition: Adafruit_SPITFT.h:518
+
int8_t _mosi
MOSI pin #.
Definition: Adafruit_SPITFT.h:440
+
void writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color)
Draw a vertical line on the display. Performs edge clipping and rejection. Not self-contained; should...
Definition: Adafruit_SPITFT.cpp:1578