128x64 EasyC OLED Display 1.0.0
This is a library for Soldered OLED Display
Loading...
Searching...
No Matches
Adafruit_SPITFT.h
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__)
31typedef uint8_t ADAGFX_PORT_t;
32#define USE_FAST_PINIO
33#elif defined(ARDUINO_STM32_FEATHER) // WICED
34typedef class HardwareSPI SPIClass;
35typedef uint32_t ADAGFX_PORT_t;
36#elif defined(__arm__)
37#if defined(ARDUINO_ARCH_SAMD)
38// Adafruit M0, M4
39typedef 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
45typedef uint32_t ADAGFX_PORT_t;
46 // PJRC Teensy 3.x
47#else
48typedef uint8_t ADAGFX_PORT_t;
49#endif
50#define USE_FAST_PINIO
51#define HAS_PORT_SET_CLR
52#else
53// Arduino Due?
54typedef 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.
64typedef uint32_t ADAGFX_PORT_t;
65#endif // end !ARM
66typedef 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.
104
105// CLASS DEFINITION --------------------------------------------------------
106
121
122public:
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
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 void swapBytes(uint16_t *src, uint32_t len, uint16_t *dest = NULL);
238
239 // These functions are similar to the 'write' functions above, but with
240 // a chip-select and/or SPI transaction built-in. They're typically used
241 // solo -- that is, as graphics primitives in themselves, not invoked by
242 // higher-level primitives (which should use the functions above).
243 void drawPixel(int16_t x, int16_t y, uint16_t color);
244 void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
245 void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
246 void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
247 // A single-pixel push encapsulated in a transaction. I don't think
248 // this is used anymore (BMP demos might've used it?) but is provided
249 // for backward compatibility, consider it deprecated:
250 void pushColor(uint16_t color);
251
252 using Adafruit_GFX::drawRGBBitmap; // Check base class first
253 void drawRGBBitmap(int16_t x, int16_t y, uint16_t *pcolors, int16_t w,
254 int16_t h);
255
256 void invertDisplay(bool i);
257 uint16_t color565(uint8_t r, uint8_t g, uint8_t b);
258
259 // Despite parallel additions, function names kept for compatibility:
260 void spiWrite(uint8_t b); // Write single byte as DATA
261 void writeCommand(uint8_t cmd); // Write single byte as COMMAND
262 uint8_t spiRead(void); // Read single byte of data
263 void write16(uint16_t w); // Write 16-bit value as DATA
264 void writeCommand16(uint16_t cmd); // Write 16-bit value as COMMAND
265 uint16_t read16(void); // Read single 16-bit value
266
267 // Most of these low-level functions were formerly macros in
268 // Adafruit_SPITFT_Macros.h. Some have been made into inline functions
269 // to avoid macro mishaps. Despite the addition of code for a parallel
270 // display interface, the names have been kept for backward
271 // compatibility (some subclasses may be invoking these):
272 void SPI_WRITE16(uint16_t w); // Not inline
273 void SPI_WRITE32(uint32_t l); // Not inline
274 // Old code had both a spiWrite16() function and SPI_WRITE16 macro
275 // in addition to the SPI_WRITE32 macro. The latter two have been
276 // made into functions here, and spiWrite16() removed (use SPI_WRITE16()
277 // instead). It looks like most subclasses had gotten comfortable with
278 // SPI_WRITE16 and SPI_WRITE32 anyway so those names were kept rather
279 // than the less-obnoxious camelcase variants, oh well.
280
281 // Placing these functions entirely in the class definition inlines
282 // them implicitly them while allowing their use in other code:
283
290 void SPI_CS_HIGH(void) {
291#if defined(USE_FAST_PINIO)
292#if defined(HAS_PORT_SET_CLR)
293#if defined(KINETISK)
294 *csPortSet = 1;
295#else // !KINETISK
297#endif // end !KINETISK
298#else // !HAS_PORT_SET_CLR
300#endif // end !HAS_PORT_SET_CLR
301#else // !USE_FAST_PINIO
302 digitalWrite(_cs, HIGH);
303#endif // end !USE_FAST_PINIO
304 }
305
312 void SPI_CS_LOW(void) {
313#if defined(USE_FAST_PINIO)
314#if defined(HAS_PORT_SET_CLR)
315#if defined(KINETISK)
316 *csPortClr = 1;
317#else // !KINETISK
319#endif // end !KINETISK
320#else // !HAS_PORT_SET_CLR
322#endif // end !HAS_PORT_SET_CLR
323#else // !USE_FAST_PINIO
324 digitalWrite(_cs, LOW);
325#endif // end !USE_FAST_PINIO
326 }
327
331 void SPI_DC_HIGH(void) {
332#if defined(USE_FAST_PINIO)
333#if defined(HAS_PORT_SET_CLR)
334#if defined(KINETISK)
335 *dcPortSet = 1;
336#else // !KINETISK
338#endif // end !KINETISK
339#else // !HAS_PORT_SET_CLR
341#endif // end !HAS_PORT_SET_CLR
342#else // !USE_FAST_PINIO
343 digitalWrite(_dc, HIGH);
344#endif // end !USE_FAST_PINIO
345 }
346
350 void SPI_DC_LOW(void) {
351#if defined(USE_FAST_PINIO)
352#if defined(HAS_PORT_SET_CLR)
353#if defined(KINETISK)
354 *dcPortClr = 1;
355#else // !KINETISK
357#endif // end !KINETISK
358#else // !HAS_PORT_SET_CLR
360#endif // end !HAS_PORT_SET_CLR
361#else // !USE_FAST_PINIO
362 digitalWrite(_dc, LOW);
363#endif // end !USE_FAST_PINIO
364 }
365
366protected:
367 // A few more low-level member functions -- some may have previously
368 // been macros. Shouldn't have a need to access these externally, so
369 // they've been moved to the protected section. Additionally, they're
370 // declared inline here and the code is in the .cpp file, since outside
371 // code doesn't need to see these.
372 inline void SPI_MOSI_HIGH(void);
373 inline void SPI_MOSI_LOW(void);
374 inline void SPI_SCK_HIGH(void);
375 inline void SPI_SCK_LOW(void);
376 inline bool SPI_MISO_READ(void);
377 inline void SPI_BEGIN_TRANSACTION(void);
378 inline void SPI_END_TRANSACTION(void);
379 inline void TFT_WR_STROBE(void); // Parallel interface write strobe
380 inline void TFT_RD_HIGH(void); // Parallel interface read high
381 inline void TFT_RD_LOW(void); // Parallel interface read low
382
383 // CLASS INSTANCE VARIABLES --------------------------------------------
384
385 // Here be dragons! There's a big union of three structures here --
386 // one each for hardware SPI, software (bitbang) SPI, and parallel
387 // interfaces. This is to save some memory, since a display's connection
388 // will be only one of these. The order of some things is a little weird
389 // in an attempt to get values to align and pack better in RAM.
390
391#if defined(USE_FAST_PINIO)
392#if defined(HAS_PORT_SET_CLR)
397#else // !HAS_PORT_SET_CLR
400#endif // end HAS_PORT_SET_CLR
401#endif // end USE_FAST_PINIO
402#if defined(__cplusplus) && (__cplusplus >= 201100)
403 union {
404#endif
405 struct { // Values specific to HARDWARE SPI:
407#if defined(SPI_HAS_TRANSACTION)
408 SPISettings settings;
409#else
410 uint32_t _freq;
411#endif
412 uint32_t _mode;
414 struct { // Values specific to SOFTWARE SPI:
415#if defined(USE_FAST_PINIO)
417#if defined(HAS_PORT_SET_CLR)
422#if !defined(KINETISK)
425#endif // end !KINETISK
426#else // !HAS_PORT_SET_CLR
433#endif // end HAS_PORT_SET_CLR
434#if !defined(KINETISK)
436#endif // end !KINETISK
437#endif // end USE_FAST_PINIO
438 int8_t _mosi;
439 int8_t _miso;
440 int8_t _sck;
442 struct { // Values specific to 8-bit parallel:
443#if defined(USE_FAST_PINIO)
444
445#if defined(__IMXRT1052__) || defined(__IMXRT1062__) // Teensy 4.x
446 volatile uint32_t *writePort;
447 volatile uint32_t *readPort;
448#else
449 volatile uint8_t *writePort;
450 volatile uint8_t *readPort;
451#endif
452#if defined(HAS_PORT_SET_CLR)
453 // Port direction register pointers are always 8-bit regardless of
454 // PORTreg_t -- even if 32-bit port, we modify a byte-aligned 8 bits.
455#if defined(__IMXRT1052__) || defined(__IMXRT1062__) // Teensy 4.x
456 volatile uint32_t *dirSet;
457 volatile uint32_t *dirClr;
458#else
459 volatile uint8_t *dirSet;
460 volatile uint8_t *dirClr;
461#endif
466#if !defined(KINETISK)
468#endif // end !KINETISK
470#else // !HAS_PORT_SET_CLR
471 // Port direction register pointer is always 8-bit regardless of
472 // PORTreg_t -- even if 32-bit port, we modify a byte-aligned 8 bits.
473 volatile uint8_t *portDir;
480#endif // end HAS_PORT_SET_CLR
481#endif // end USE_FAST_PINIO
482 int8_t _d0;
483 int8_t _wr;
484 int8_t _rd;
485 bool wide = 0;
487#if defined(__cplusplus) && (__cplusplus >= 201100)
488 };
489#endif
490#if defined(USE_SPI_DMA) && \
491 (defined(__SAMD51__) || \
492 defined(ARDUINO_SAMD_ZERO)) // Used by hardware SPI and tft8
493 Adafruit_ZeroDMA dma;
494 DmacDescriptor *dptr = NULL;
495 DmacDescriptor *descriptor = NULL;
496 uint16_t *pixelBuf[2];
497 uint16_t maxFillLen;
498 uint16_t lastFillColor = 0;
499 uint32_t lastFillLen = 0;
500 uint8_t onePixelBuf;
501#endif
502#if defined(USE_FAST_PINIO)
503#if defined(HAS_PORT_SET_CLR)
504#if !defined(KINETISK)
507#endif // end !KINETISK
508#else // !HAS_PORT_SET_CLR
513#endif // end HAS_PORT_SET_CLR
514#endif // end USE_FAST_PINIO
515 uint8_t connection;
516 int8_t _rst;
517 int8_t _cs;
518 int8_t _dc;
519
520 int16_t _xstart = 0;
521 int16_t _ystart = 0;
522 uint8_t invertOnCommand = 0;
523 uint8_t invertOffCommand = 0;
524
525 uint32_t _freq = 0;
526};
527
528#endif // end __AVR_ATtiny85__
529#endif // end _ADAFRUIT_SPITFT_H_
uint8_t ADAGFX_PORT_t
PORT values are 8-bit.
Definition Adafruit_SPITFT.h:31
tftBusWidth
Definition Adafruit_SPITFT.h:103
@ tft8bitbus
Definition Adafruit_SPITFT.h:103
@ tft16bitbus
Definition Adafruit_SPITFT.h:103
volatile ADAGFX_PORT_t * PORTreg_t
PORT register type.
Definition Adafruit_SPITFT.h:66
class HardwareSPI SPIClass
SPI is a bit odd on WICED.
Definition Adafruit_SPITFT.h:34
Definition Adafruit_GFX.h:15
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
Adafruit_SPITFT is an intermediary class between Adafruit_GFX and various hardware-specific subclasse...
Definition Adafruit_SPITFT.h:120
void SPI_MOSI_LOW(void)
Set the software (bitbang) SPI MOSI line LOW.
Definition Adafruit_SPITFT.cpp:2281
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:2116
ADAGFX_PORT_t rdPinMaskSet
Bitmask for read strobe SET (OR)
Definition Adafruit_SPITFT.h:478
int8_t _mosi
MOSI pin #.
Definition Adafruit_SPITFT.h:438
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:1507
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
struct Adafruit_SPITFT::@1::@5 tft8
Parallel interface settings.
void SPI_SCK_HIGH(void)
Set the software (bitbang) SPI SCK line HIGH.
Definition Adafruit_SPITFT.cpp:2304
void SPI_SCK_LOW(void)
Set the software (bitbang) SPI SCK line LOW.
Definition Adafruit_SPITFT.cpp:2331
void TFT_RD_LOW(void)
Set the RD line LOW. Used for parallel-connected interfaces when reading data.
Definition Adafruit_SPITFT.cpp:2528
int8_t _dc
Data/command pin #.
Definition Adafruit_SPITFT.h:518
DmacDescriptor * dptr
1st descriptor
Definition Adafruit_SPITFT.h:494
virtual void setAddrWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h)=0
Set up the specific display hardware's "address window" for subsequent pixel-pushing operations.
int8_t _miso
MISO pin #.
Definition Adafruit_SPITFT.h:439
SPISettings settings
SPI transaction settings.
Definition Adafruit_SPITFT.h:408
int16_t _ystart
Internal framebuffer Y offset.
Definition Adafruit_SPITFT.h:521
PORTreg_t sckPortSet
PORT register for SCK SET.
Definition Adafruit_SPITFT.h:420
SPIClass * _spi
SPI class pointer.
Definition Adafruit_SPITFT.h:406
PORTreg_t mosiPortClr
PORT register for MOSI CLEAR.
Definition Adafruit_SPITFT.h:419
void invertDisplay(bool i)
Invert the colors of the display (if supported by hardware). Self-contained, no transaction setup req...
Definition Adafruit_SPITFT.cpp:1840
uint16_t maxFillLen
Max pixels per DMA xfer.
Definition Adafruit_SPITFT.h:497
volatile uint8_t * writePort
PORT register for DATA WRITE.
Definition Adafruit_SPITFT.h:449
volatile uint32_t * readPort
PORT (PIN) register for DATA READ.
Definition Adafruit_SPITFT.h:447
ADAGFX_PORT_t csPinMaskSet
Bitmask for chip select SET (OR)
Definition Adafruit_SPITFT.h:509
ADAGFX_PORT_t misoPinMask
Bitmask for MISO.
Definition Adafruit_SPITFT.h:435
ADAGFX_PORT_t dcPinMaskClr
Bitmask for data/command CLEAR (AND)
Definition Adafruit_SPITFT.h:512
DmacDescriptor * descriptor
Allocated descriptor list.
Definition Adafruit_SPITFT.h:495
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:1165
ADAGFX_PORT_t sckPinMask
Bitmask for SCK.
Definition Adafruit_SPITFT.h:424
int8_t _rd
Read strobe pin # (or -1)
Definition Adafruit_SPITFT.h:484
ADAGFX_PORT_t wrPinMask
Bitmask for write strobe.
Definition Adafruit_SPITFT.h:467
int16_t _xstart
Internal framebuffer X offset.
Definition Adafruit_SPITFT.h:520
ADAGFX_PORT_t sckPinMaskSet
Bitmask for SCK SET (OR bitmask)
Definition Adafruit_SPITFT.h:431
void setSPISpeed(uint32_t freq)
Allow changing the SPI clock speed after initialization.
Definition Adafruit_SPITFT.cpp:898
uint16_t lastFillColor
Last color used w/fill.
Definition Adafruit_SPITFT.h:498
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:2059
int8_t _rst
Reset pin # (or -1)
Definition Adafruit_SPITFT.h:516
void pushColor(uint16_t color)
Essentially writePixel() with a transaction around it. I don't think this is in use by any of our cod...
Definition Adafruit_SPITFT.cpp:1773
PORTreg_t rdPort
PORT register for read strobe.
Definition Adafruit_SPITFT.h:475
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:1641
int8_t _d0
Data pin 0 #.
Definition Adafruit_SPITFT.h:482
PORTreg_t csPortSet
PORT register for chip select SET.
Definition Adafruit_SPITFT.h:393
PORTreg_t rdPortSet
PORT register for read strobe SET.
Definition Adafruit_SPITFT.h:464
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:1611
ADAGFX_PORT_t dcPinMaskSet
Bitmask for data/command SET (OR)
Definition Adafruit_SPITFT.h:511
ADAGFX_PORT_t rdPinMask
Bitmask for read strobe.
Definition Adafruit_SPITFT.h:469
volatile uint8_t * readPort
PORT (PIN) register for DATA READ.
Definition Adafruit_SPITFT.h:450
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:1970
uint16_t color565(uint8_t r, uint8_t g, uint8_t b)
Given 8-bit red, green and blue values, return a 'packed' 16-bit color value in '565' RGB format (5 b...
Definition Adafruit_SPITFT.cpp:1856
uint32_t _freq
SPI bitrate (if no SPI transactions)
Definition Adafruit_SPITFT.h:410
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
ADAGFX_PORT_t mosiPinMask
Bitmask for MOSI.
Definition Adafruit_SPITFT.h:423
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:2132
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,...
Definition Adafruit_SPITFT.cpp:1587
uint8_t invertOffCommand
Command to disable invert mode.
Definition Adafruit_SPITFT.h:523
PORTreg_t sckPortClr
PORT register for SCK CLEAR.
Definition Adafruit_SPITFT.h:421
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:2076
uint32_t _mode
SPI data mode (transactions or no)
Definition Adafruit_SPITFT.h:412
struct Adafruit_SPITFT::@1::@4 swspi
Software SPI values.
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
volatile uint32_t * writePort
PORT register for DATA WRITE.
Definition Adafruit_SPITFT.h:446
ADAGFX_PORT_t wrPinMaskClr
Bitmask for write strobe CLEAR (AND)
Definition Adafruit_SPITFT.h:477
PORTreg_t wrPortClr
PORT register for write strobe CLEAR.
Definition Adafruit_SPITFT.h:463
virtual void begin(uint32_t freq)=0
Display-specific initialization function.
struct Adafruit_SPITFT::@1::@3 hwspi
Hardware SPI values.
Adafruit_ZeroDMA dma
DMA instance.
Definition Adafruit_SPITFT.h:493
int8_t _wr
Write strobe pin #.
Definition Adafruit_SPITFT.h:483
void SPI_MOSI_HIGH(void)
Set the software (bitbang) SPI MOSI line HIGH.
Definition Adafruit_SPITFT.cpp:2258
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()....
Definition Adafruit_SPITFT.cpp:1455
PORTreg_t dcPortSet
PORT register for data/command SET.
Definition Adafruit_SPITFT.h:395
volatile uint32_t * dirClr
PORT byte data direction CLEAR.
Definition Adafruit_SPITFT.h:457
uint8_t onePixelBuf
For hi==lo fill.
Definition Adafruit_SPITFT.h:500
ADAGFX_PORT_t csPinMaskClr
Bitmask for chip select CLEAR (AND)
Definition Adafruit_SPITFT.h:510
void SPI_DC_HIGH(void)
Set the data/command line HIGH (data mode).
Definition Adafruit_SPITFT.h:331
void initSPI(uint32_t freq=0, uint8_t spiMode=SPI_MODE0)
Configure microcontroller pins for TFT interfacing. Typically called by a subclass' begin() function.
Definition Adafruit_SPITFT.cpp:527
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:2431
PORTreg_t dcPortClr
PORT register for data/command CLEAR.
Definition Adafruit_SPITFT.h:396
volatile uint8_t * portDir
PORT direction register.
Definition Adafruit_SPITFT.h:473
PORTreg_t csPortClr
PORT register for chip select CLEAR.
Definition Adafruit_SPITFT.h:394
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:1543
ADAGFX_PORT_t sckPinMaskClr
Bitmask for SCK CLEAR (AND)
Definition Adafruit_SPITFT.h:432
bool SPI_MISO_READ(void)
Read the state of the software (bitbang) SPI MISO line.
Definition Adafruit_SPITFT.cpp:2359
ADAGFX_PORT_t rdPinMaskClr
Bitmask for read strobe CLEAR (AND)
Definition Adafruit_SPITFT.h:479
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:1795
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:2215
uint16_t * pixelBuf[2]
Working buffers.
Definition Adafruit_SPITFT.h:496
PORTreg_t rdPortClr
PORT register for read strobe CLEAR.
Definition Adafruit_SPITFT.h:465
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
PORTreg_t wrPort
PORT register for write strobe.
Definition Adafruit_SPITFT.h:474
~Adafruit_SPITFT()
Definition Adafruit_SPITFT.h:160
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:290
uint32_t lastFillLen
Definition Adafruit_SPITFT.h:499
bool wide
If true, is 16-bit interface.
Definition Adafruit_SPITFT.h:485
void TFT_WR_STROBE(void)
Set the WR line LOW, then HIGH. Used for parallel-connected interfaces when writing data.
Definition Adafruit_SPITFT.cpp:2488
volatile uint8_t * dirClr
PORT byte data direction CLEAR.
Definition Adafruit_SPITFT.h:460
ADAGFX_PORT_t mosiPinMaskClr
Bitmask for MOSI CLEAR (AND)
Definition Adafruit_SPITFT.h:430
PORTreg_t wrPortSet
PORT register for write strobe SET.
Definition Adafruit_SPITFT.h:462
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:1740
PORTreg_t dcPort
PORT register for data/command.
Definition Adafruit_SPITFT.h:399
PORTreg_t mosiPort
PORT register for MOSI.
Definition Adafruit_SPITFT.h:427
PORTreg_t sckPort
PORT register for SCK.
Definition Adafruit_SPITFT.h:428
int8_t _cs
Chip select pin # (or -1)
Definition Adafruit_SPITFT.h:517
PORTreg_t misoPort
PORT (PIN) register for MISO.
Definition Adafruit_SPITFT.h:416
uint16_t readcommand16(uint16_t addr)
Read 16 bits of data from display register. For 16-bit parallel displays only.
Definition Adafruit_SPITFT.cpp:1989
PORTreg_t mosiPortSet
PORT register for MOSI SET.
Definition Adafruit_SPITFT.h:418
void SPI_DC_LOW(void)
Set the data/command line LOW (command mode).
Definition Adafruit_SPITFT.h:350
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
volatile uint8_t * dirSet
PORT byte data direction SET.
Definition Adafruit_SPITFT.h:459
uint8_t invertOnCommand
Command to enable invert mode.
Definition Adafruit_SPITFT.h:522
void TFT_RD_HIGH(void)
Set the RD line HIGH. Used for parallel-connected interfaces when reading data.
Definition Adafruit_SPITFT.cpp:2512
PORTreg_t csPort
PORT register for chip select.
Definition Adafruit_SPITFT.h:398
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:2031
ADAGFX_PORT_t dcPinMask
Bitmask for data/command.
Definition Adafruit_SPITFT.h:506
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:2195
uint8_t connection
TFT_HARD_SPI, TFT_SOFT_SPI, etc.
Definition Adafruit_SPITFT.h:515
ADAGFX_PORT_t csPinMask
Bitmask for chip select.
Definition Adafruit_SPITFT.h:505
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:2229
void dmaWait(void)
Wait for the last DMA transfer in a prior non-blocking writePixels() call to complete....
Definition Adafruit_SPITFT.cpp:1144
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:1699
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:1934
volatile uint32_t * dirSet
PORT byte data direction SET.
Definition Adafruit_SPITFT.h:456
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
ADAGFX_PORT_t mosiPinMaskSet
Bitmask for MOSI SET (OR)
Definition Adafruit_SPITFT.h:429
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:2381
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:312
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:1867
int8_t _sck
SCK pin #.
Definition Adafruit_SPITFT.h:440
ADAGFX_PORT_t wrPinMaskSet
Bitmask for write strobe SET (OR)
Definition Adafruit_SPITFT.h:476