Subclass of Adafruit_TFTDMA in which display (or section thereof) is generated one scanline at a time, using a callback which sets up one or more sequential 'spans,' providing a start address for each and a width in pixels. The total span width MUST match the update region width. This requires careful planning but might be good for scrollers, tile engines, anything with lots of canned pixel data in tables. Uses about 12K RAM.
More...
#include <Adafruit_TFTDMA.h>
|
| TFT_scanline (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 (int16_t x1, int16_t y1, int16_t x2, int16_t y2, void(*userCallback)(uint16_t *dest, void *udPtr), void *userData) |
| Refreshes specified region of the display. Region will be divided vertically into scanlines, and a callback is then invoked to draw each line as needed (line contents are not preserved; every invocation must fully render that line) and a DMA transfer is initiated while then processing the next line. Function returns when last DMA transfer completes. More...
|
|
void | addSpan (uint16_t *addr, int16_t w, bool inc=1) |
| User callback invokes this function one or more times to specify the next 'span' – a horizontal length of pixels – to issue along the scanline being rendered, left to right. 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...
|
|
|
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 in which display (or section thereof) is generated one scanline at a time, using a callback which sets up one or more sequential 'spans,' providing a start address for each and a width in pixels. The total span width MUST match the update region width. This requires careful planning but might be good for scrollers, tile engines, anything with lots of canned pixel data in tables. Uses about 12K RAM.
◆ TFT_scanline()
TFT_scanline::TFT_scanline |
( |
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.
- Parameters
-
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. |
◆ begin()
bool TFT_scanline::begin |
( |
void |
| ) |
|
Initializes all pins and peripherals used by the library.
- Returns
- true if an error occurred, false otherwise. An error returned here is usually symptomatic of a constructor problem, such as an invalid pin or timer number.
◆ update()
void TFT_scanline::update |
( |
int16_t |
x1, |
|
|
int16_t |
y1, |
|
|
int16_t |
x2, |
|
|
int16_t |
y2, |
|
|
void(*)(uint16_t *dest, void *udPtr) |
userCallback, |
|
|
void * |
userData |
|
) |
| |
Refreshes specified region of the display. Region will be divided vertically into scanlines, and a callback is then invoked to draw each line as needed (line contents are not preserved; every invocation must fully render that line) and a DMA transfer is initiated while then processing the next line. Function returns when last DMA transfer completes.
- Parameters
-
x1 | Left edge of region to update. |
y1 | Top edge of region to update. |
x2 | Right edge of region to update. |
y2 | Bottom edge of region to update. |
userCallback | Function for rendering one scanline of the region being updated. Callback is passed a pointer to a one-scanline working buffer if needed, and a pointer to optional user data provided by the application. |
userData | Pointer to user-defined data structure which can be used to pass data to the callback or between invocations of the callback. Very little is passed to the callback – this is by design – so this structure, or just global variables in one's code, can be used to contain information such as the region width or horizontal/vertical offsets of the scanline within the overall screen. |
◆ addSpan()
void TFT_scanline::addSpan |
( |
uint16_t * |
addr, |
|
|
int16_t |
w, |
|
|
bool |
inc = 1 |
|
) |
| |
User callback invokes this function one or more times to specify the next 'span' – a horizontal length of pixels – to issue along the scanline being rendered, left to right.
- Parameters
-
addr | Pointer to 16-bit pixel data at the start of the span. |
w | Horizontal length of span, in pixels. The total length of all spans on a given scanline MUST match the width of the region passed to update(); no clipping is performed. Spans are always added sequentially left-to-right, there is no insert or reverse operation; speed is of the essence. The internal span counter is always reset to 0 (left edge of region) at the start of each scanline. |
inc | Selects whether source address increment is enabled in DMA transfer descriptor. Default is 1 (true). If 0, and if using the 16-bit parallel interface, this will fill the span with the single color value at 'addr' (in 8-bit mode, this only makes sense if the color's high and low bytes are the same, e.g. black, white and a dubious and strange assortment of colors). |
The documentation for this class was generated from the following files: