Adafruit TFTDMA Arduino Library
|
Subclass of Adafruit_TFTDMA providing a whole-screen contiguous framebuffer. This is probably the easiest subclass to understand, but requires an enormous amount of RAM, nearly 160 kilobytes. More...
#include <Adafruit_TFTDMA.h>
Public Member Functions | |
TFT_framebuffer (int8_t tc, int8_t reset, int8_t cs, int8_t cd, int8_t rd, int8_t wr, int8_t d0, _EPioType periph) | |
Constructor. Takes note of the hardware configuration to use, but does not itself initialize any hardware yet. More... | |
bool | begin (void) |
Initializes all pins and peripherals used by the library. More... | |
void | update (void) |
Refreshes the display based on the current 'dirty rectangle' bounds set by other graphics functions. Initiates a DMA transfer and returns immediately – application can proceed with other code at that point but MUST not modify the framebuffer as it's transferred. | |
void | waitForUpdate (void) |
Wait for the DMA transfer initiated by update() to complete. Dirty rectangle is reset and framebuffer can then be modified. | |
void | sully (int16_t x, int16_t y) |
Set or expand the current dirty rectangle to contain a given pixel coordinate. Input MUST be valid; is NOT clipped. The few graphics primitives provided will set or expand the dirty rectangle automatically, this function is mostly for one's own code that may be modifying the framebuffer contents. More... | |
uint16_t * | getBuffer (void) |
Get the base address of the framebuffer. More... | |
bool | getDirtyRect (int16_t *x1, int16_t *y1, int16_t *x2, int16_t *y2) |
Get the framebuffer's current dirty rectangle, if any. This may be helpful if an application finds it easier or more efficient to simply erase a whole bounding area rather than multiple small elements within. More... | |
void | rawPixel (int16_t x, int16_t y, uint16_t color) |
Lowest-level pixel-setting operation. Sets color of pixel at a given coordinate. Does NOT provide clipping, and pixel color must already be endian-adjusted if needed to match format needed by ILI9341 (MSB first). Dirty rectangle is not updated. More... | |
void | drawPixel (int16_t x, int16_t y, uint16_t color) |
Set pixel in framebuffer, with clipping, endian-adjustment and dirty rectangle update. More... | |
void | fillRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) |
Fill rectangle in framebuffer, with clipping and dirty rectangle update. More... | |
void | fillScreen (uint16_t color=0) |
Fill entire framebuffer with solid color. More... | |
![]() | |
Adafruit_TFTDMA (int8_t tc, int8_t reset, int8_t cs, int8_t cd, int8_t rd, int8_t wr, int8_t d0, _EPioType periph) | |
Constructor. Takes note of the hardware configuration to use, but does not itself initialize any hardware yet. More... | |
bool | begin (void) |
Initializes all pins and peripherals used by the library. More... | |
Additional Inherited Members | |
![]() | |
void | writeReg8 (uint8_t reg, uint8_t value) |
Writes an 8-bit value to an ILI9341 configuration register. More... | |
void | writeReg16 (uint8_t reg, uint16_t value) |
Writes a 16-bit value to an ILI9341 configuration register. More... | |
void | writeReg32 (uint8_t reg, uint32_t value) |
Writes a 32-bit value to an ILI9341 configuration register. More... | |
void | setAddrWindow (int16_t x1, int16_t y1, int16_t x2, int16_t y2) |
Sets the ILI9341 'address window' for subsequent graphics operations. This also issues a MEMORYWRITE command and leaves the device selected and in DATA mode for incoming pixel data. Inputs are NOT sorted or clipped; subclasses provide higher-level functions that ensure the validity of these parameters. More... | |
![]() | |
volatile uint8_t * | writePort |
Pointer to 8-bit PORT OUT. | |
volatile uint8_t * | readPort |
Pointer to 8-bit PORT IN. | |
volatile uint8_t * | dirSet |
8-bit PORT direction set | |
volatile uint8_t * | dirClr |
8-bit Port direction clear | |
volatile uint32_t * | csPortSet |
Pointer to CS pin PORT SET register. | |
volatile uint32_t * | csPortClr |
Pointer to CS pin PORT CLEAR register. | |
volatile uint32_t * | cdPortSet |
Pointer to CD pin PORT SET register. | |
volatile uint32_t * | cdPortClr |
Pointer to CD pin PORT CLEAR register. | |
volatile uint32_t * | rdPortSet |
Pointer to RD pin PORT SET register. | |
volatile uint32_t * | rdPortClr |
Pointer to RD pin PORT CLEAR register. | |
volatile uint32_t * | wrPortActive |
Pointer to WR pin PORT active register. | |
volatile uint32_t * | wrPortIdle |
Pointer to WR pin PORT idle register. | |
uint32_t | csPinMask |
Bitmask for CS pin PORT. | |
uint32_t | cdPinMask |
Bitmask for CD pin PORT. | |
uint32_t | rdPinMask |
Bitmask for RD pin PORT. | |
uint32_t | wrPinMask |
Bitmask for WR pin PORT. | |
int8_t | csPin |
Index of CS pin (or -1) | |
int8_t | cdPin |
Index of CD pin. | |
int8_t | rdPin |
Index of RD pin. | |
int8_t | wrPin |
Index of WR pin. | |
int8_t | resetPin |
Index of RESET pin (or -1) | |
int8_t | d0Pin |
Index of data bit 0 pin. | |
int8_t | tcNum |
Timer/Counter number. | |
_EPioType | wrPeripheral |
WR strobe peripheral type. | |
Adafruit_ZeroDMA | dma |
DMA instance. | |
Subclass of Adafruit_TFTDMA providing a whole-screen contiguous framebuffer. This is probably the easiest subclass to understand, but requires an enormous amount of RAM, nearly 160 kilobytes.
TFT_framebuffer::TFT_framebuffer | ( | int8_t | tc, |
int8_t | reset, | ||
int8_t | cs, | ||
int8_t | cd, | ||
int8_t | rd, | ||
int8_t | wr, | ||
int8_t | d0, | ||
_EPioType | periph | ||
) |
Constructor. Takes note of the hardware configuration to use, but does not itself initialize any hardware yet.
tc | Index of timer/counter peripheral for PWM (used for generating write-strobe pulses), e.g. pass 2 to use the TC2 peripheral. Certain timer/counters may be in use by other libraries or reserved for the Arduino millis()/micros() timers. |
reset | Index of pin connected to the ILI9341's reset line, or -1 if unconnected. Using the reset line is optional but strongly recommended. |
cs | Index of pin connected to ILI9341 chip select line. Required; must be >= 0. |
cd | Index of pin connected to ILI9341 command/data line. Required; must be >= 0. |
rd | Index of pin connected to ILI9341 read-strobe line, or -1 if unconnected. This library currently doesn't read any registers or pixel data from the device; it is coded specifically for this driver and write-only, so -1 is totally acceptable and even preferred here. Maybe this parameter will be removed in the future. |
wr | Index of pin connected to ILI9341 write-strobe line. Required; must be >= 0. Additionally, this pin must be a valid TCx/WO[0] output for the timer/counter specified by the first parameter, OR a CCL/OUT[x] pin for the same timer counter (see last parameter). |
d0 | Index of pin connected to ILI9341 data bit 0 line. Required; must be >= 0. Additionally, the corresponding PORT bit index for this pin MUST be the least-significant bit of an 8-bit byte (e.g. 0, 8, 16 or 24) if using the 8-bit parallel interface, or the least-significant bit of a 16-bit halfword (e.g. 0 or 16) if using the 16-bit parallel interface. Use of the next 7 or 15 bits of the PORT is implied, the pins corresponding to those bits might not be contiguous or sequential; refer to the schematic or device-specific variant.cpp file for insights. |
periph | Peripheral type connected to the write-strobe pin for PWM out. This can be PIO_TIMER or PIO_TIMER_ALT corresponding to TCx/WO[0] for that pin, or PIO_CCL for CCL/OUT[x] on a pin. PIO_TIMER and PIO_TIMER_ALT require the use of an external logic inverter (the ILI9341 uses active-low control signals). PIO_CCL does not need an inverter, but the choice of pins is very limited, perhaps just one or two. |
bool TFT_framebuffer::begin | ( | void | ) |
Initializes all pins and peripherals used by the library.
void TFT_framebuffer::sully | ( | int16_t | x, |
int16_t | y | ||
) |
Set or expand the current dirty rectangle to contain a given pixel coordinate. Input MUST be valid; is NOT clipped. The few graphics primitives provided will set or expand the dirty rectangle automatically, this function is mostly for one's own code that may be modifying the framebuffer contents.
x | Horizontal position of pixel (0 to TFTWIDTH-1). |
y | Vertical position of pixel (0 to TFTWIDTH-1). |
uint16_t * TFT_framebuffer::getBuffer | ( | void | ) |
Get the base address of the framebuffer.
bool TFT_framebuffer::getDirtyRect | ( | int16_t * | x1, |
int16_t * | y1, | ||
int16_t * | x2, | ||
int16_t * | y2 | ||
) |
Get the framebuffer's current dirty rectangle, if any. This may be helpful if an application finds it easier or more efficient to simply erase a whole bounding area rather than multiple small elements within.
x1 | Pointer to signed 16-bit type to hold LEFT edge of dirty rectangle, if set (else will be >= TFTWIDTH). |
y1 | Pointer to signed 16-bit type to hold TOP edge of dirty rectangle, if set (else will be >= TFTHEIGHT). |
x2 | Pointer to signed 16-bit type to hold RIGHT edge of dirty rectangle, if set (else will be -1). |
y2 | Pointer to signed 16-bit type to hold BOTTOM edge of dirty rectangle, if set (else will be -1). |
|
inline |
Lowest-level pixel-setting operation. Sets color of pixel at a given coordinate. Does NOT provide clipping, and pixel color must already be endian-adjusted if needed to match format needed by ILI9341 (MSB first). Dirty rectangle is not updated.
x | Horizontal position of pixel (0 to TFTWIDTH-1). |
y | Vertical position of pixel (0 to TFTHEIGHT-1). |
color | 16-bit (5/6/5 R/G/B) color value, ILI9341 byte order. |
void TFT_framebuffer::drawPixel | ( | int16_t | x, |
int16_t | y, | ||
uint16_t | color | ||
) |
Set pixel in framebuffer, with clipping, endian-adjustment and dirty rectangle update.
x | Horizontal position of pixel. |
y | Vertical position of pixel. |
color | 16-bit (5/6/5 R/G/B) color value, native byte order. |
void TFT_framebuffer::fillRect | ( | int16_t | x, |
int16_t | y, | ||
int16_t | w, | ||
int16_t | h, | ||
uint16_t | color | ||
) |
Fill rectangle in framebuffer, with clipping and dirty rectangle update.
x | Left edge of rectangle (right edge if negative width). |
y | Top edge of rectangle (bottom edge if negative height). |
w | Width in pixels. |
h | Height in pixels. |
color | 16-bit (5/6/5 R/G/B) color value, native byte order. |
void TFT_framebuffer::fillScreen | ( | uint16_t | color = 0 | ) |
Fill entire framebuffer with solid color.
color | 16-bit (5/6/5 R/G/B) color value, native byte order. |