forked from Bodmer/TFT_eSPI
Add 16 bit parallel for RP2040 processor
Correct legacy comments Add ESP32 S3 parallel setup 70d Add setups 105-107 for RP2040 with 16 bit display Add file conversion notes to PNG array example
This commit is contained in:
@ -430,7 +430,7 @@ void TFT_eSPI::drawGlyph(uint16_t code)
|
||||
|
||||
startWrite(); // Avoid slow ESP32 transaction overhead for every pixel
|
||||
|
||||
int16_t fillwidth = 0;
|
||||
int16_t fillwidth = 0;
|
||||
int16_t fillheight = 0;
|
||||
|
||||
// Fill area above glyph
|
||||
@ -438,6 +438,7 @@ void TFT_eSPI::drawGlyph(uint16_t code)
|
||||
fillwidth = (cursor_x + gxAdvance[gNum]) - bg_cursor_x;
|
||||
if (fillwidth > 0) {
|
||||
fillheight = gFont.maxAscent - gdY[gNum];
|
||||
// Could be negative
|
||||
if (fillheight > 0) {
|
||||
fillRect(bg_cursor_x, cursor_y, fillwidth, fillheight, textbgcolor);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
public:
|
||||
|
||||
// These are for the new antialiased fonts
|
||||
// These are for the new anti-aliased fonts
|
||||
void loadFont(const uint8_t array[]);
|
||||
#ifdef FONT_FS_AVAILABLE
|
||||
void loadFont(String fontName, fs::FS &ffs);
|
||||
|
@ -717,7 +717,7 @@ void TFT_eSprite::pushSprite(int32_t x, int32_t y, uint16_t transp)
|
||||
// 16bpp -> 16bpp
|
||||
// 16bpp -> 8bpp
|
||||
// 8bpp -> 8bpp
|
||||
// 4bpp -> 4bpp (note: color translation depends on the 2 sprites pallete colors)
|
||||
// 4bpp -> 4bpp (note: color translation depends on the 2 sprites palette colors)
|
||||
// 1bpp -> 1bpp (note: color translation depends on the 2 sprites bitmap colors)
|
||||
|
||||
bool TFT_eSprite::pushToSprite(TFT_eSprite *dspr, int32_t x, int32_t y)
|
||||
@ -1555,7 +1555,7 @@ void TFT_eSprite::fillSprite(uint32_t color)
|
||||
** Function name: width
|
||||
** Description: Return the width of sprite
|
||||
***************************************************************************************/
|
||||
// Return the size of the display
|
||||
// Return the size of the sprite
|
||||
int16_t TFT_eSprite::width(void)
|
||||
{
|
||||
if (!_created ) return 0;
|
||||
@ -1990,10 +1990,8 @@ void TFT_eSprite::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uin
|
||||
{
|
||||
if ( _vpOoB || !_created ) return;
|
||||
|
||||
if ((x >= _vpW - _xDatum) || // Clip right
|
||||
(y >= _vpH - _yDatum) || // Clip bottom
|
||||
((x + 6 * size - 1) < (_vpX - _xDatum)) || // Clip left
|
||||
((y + 8 * size - 1) < (_vpY - _yDatum))) // Clip top
|
||||
if ((x >= _vpW - _xDatum) || // Clip right
|
||||
(y >= _vpH - _yDatum)) // Clip bottom
|
||||
return;
|
||||
|
||||
if (c < 32) return;
|
||||
@ -2004,6 +2002,10 @@ void TFT_eSprite::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uin
|
||||
#endif
|
||||
//>>>>>>>>>>>>>>>>>>
|
||||
|
||||
if (((x + 6 * size - 1) < (_vpX - _xDatum)) || // Clip left
|
||||
((y + 8 * size - 1) < (_vpY - _yDatum))) // Clip top
|
||||
return;
|
||||
|
||||
bool fillbg = (bg != color);
|
||||
|
||||
if ((size==1) && fillbg)
|
||||
@ -2071,15 +2073,20 @@ void TFT_eSprite::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uin
|
||||
|
||||
c -= pgm_read_word(&gfxFont->first);
|
||||
GFXglyph *glyph = &(((GFXglyph *)pgm_read_dword(&gfxFont->glyph))[c]);
|
||||
uint8_t *bitmap = (uint8_t *)pgm_read_dword(&gfxFont->bitmap);
|
||||
|
||||
uint32_t bo = pgm_read_word(&glyph->bitmapOffset);
|
||||
uint8_t w = pgm_read_byte(&glyph->width),
|
||||
h = pgm_read_byte(&glyph->height);
|
||||
//xa = pgm_read_byte(&glyph->xAdvance);
|
||||
|
||||
if (((x + w * size - 1) < (_vpX - _xDatum)) || // Clip left
|
||||
((y + h * size - 1) < (_vpY - _yDatum))) // Clip top
|
||||
return;
|
||||
|
||||
uint8_t *bitmap = (uint8_t *)pgm_read_dword(&gfxFont->bitmap);
|
||||
uint32_t bo = pgm_read_word(&glyph->bitmapOffset);
|
||||
int8_t xo = pgm_read_byte(&glyph->xOffset),
|
||||
yo = pgm_read_byte(&glyph->yOffset);
|
||||
uint8_t xx, yy, bits=0, bit=0;
|
||||
//uint8_t xa = pgm_read_byte(&glyph->xAdvance);
|
||||
int16_t xo16 = 0, yo16 = 0;
|
||||
|
||||
if(size > 1) {
|
||||
@ -2126,7 +2133,7 @@ void TFT_eSprite::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uin
|
||||
|
||||
/***************************************************************************************
|
||||
** Function name: drawChar
|
||||
** Description: draw a unicode glyph onto the screen
|
||||
** Description: draw a unicode glyph into the sprite
|
||||
***************************************************************************************/
|
||||
// TODO: Rationalise with TFT_eSPI
|
||||
// Any UTF-8 decoding must be done before calling drawChar()
|
||||
@ -2473,8 +2480,8 @@ void TFT_eSprite::drawGlyph(uint16_t code)
|
||||
int16_t bx = 0;
|
||||
uint8_t pixel = 0;
|
||||
|
||||
int16_t fillwidth = 0;
|
||||
uint16_t fillheight = 0;
|
||||
int16_t fillwidth = 0;
|
||||
int16_t fillheight = 0;
|
||||
|
||||
// Fill area above glyph
|
||||
if (_fillbg) {
|
||||
|
@ -16,9 +16,9 @@ class TFT_eSprite : public TFT_eSPI {
|
||||
// Sketch can cast returned value to (uint16_t*) for 16 bit depth if needed
|
||||
// RAM required is:
|
||||
// - 1 bit per pixel for 1 bit colour depth
|
||||
// - 1 nibble per pixel for 4 bit colour
|
||||
// - 1 byte per pixel for 8 bit colour
|
||||
// - 2 bytes per pixel for 16 bit color depth
|
||||
// - 1 nibble per pixel for 4 bit colour (with palette table)
|
||||
// - 1 byte per pixel for 8 bit colour (332 RGB format)
|
||||
// - 2 bytes per pixel for 16 bit color depth (565 RGB format)
|
||||
void* createSprite(int16_t width, int16_t height, uint8_t frames = 1);
|
||||
|
||||
// Returns a pointer to the sprite or nullptr if not created, user must cast to pointer type
|
||||
@ -34,7 +34,7 @@ class TFT_eSprite : public TFT_eSPI {
|
||||
// Returns a pointer to the Sprite frame buffer
|
||||
void* frameBuffer(int8_t f);
|
||||
|
||||
// Set or get the colour depth to 4, 8 or 16 bits. Can be used to change depth an existing
|
||||
// Set or get the colour depth to 1, 4, 8 or 16 bits. Can be used to change depth an existing
|
||||
// sprite, but clears it to black, returns a new pointer if sprite is re-created.
|
||||
void* setColorDepth(int8_t b);
|
||||
int8_t getColorDepth(void);
|
||||
@ -52,9 +52,11 @@ class TFT_eSprite : public TFT_eSPI {
|
||||
// Set foreground and background colours for 1 bit per pixel Sprite
|
||||
void setBitmapColor(uint16_t fg, uint16_t bg);
|
||||
|
||||
// Draw a single pixel at x,y
|
||||
void drawPixel(int32_t x, int32_t y, uint32_t color);
|
||||
|
||||
void drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uint32_t bg, uint8_t font),
|
||||
// Draw a single character in the GLCD or GFXFF font
|
||||
void drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uint32_t bg, uint8_t size),
|
||||
|
||||
// Fill Sprite with a colour
|
||||
fillSprite(uint32_t color),
|
||||
@ -62,18 +64,18 @@ class TFT_eSprite : public TFT_eSPI {
|
||||
// Define a window to push 16 bit colour pixels into in a raster order
|
||||
// Colours are converted to the set Sprite colour bit depth
|
||||
setWindow(int32_t x0, int32_t y0, int32_t x1, int32_t y1),
|
||||
// Push a color (aka singe pixel) to the screen
|
||||
// Push a color (aka singe pixel) to the sprite's set window area
|
||||
pushColor(uint16_t color),
|
||||
// Push len colors (pixels) to the screen
|
||||
// Push len colors (pixels) to the sprite's set window area
|
||||
pushColor(uint16_t color, uint32_t len),
|
||||
// Push a pixel preformatted as a 8 or 16 bit colour (avoids conversion overhead)
|
||||
// Push a pixel pre-formatted as a 1, 4, 8 or 16 bit colour (avoids conversion overhead)
|
||||
writeColor(uint16_t color),
|
||||
|
||||
// Set the scroll zone, top left corner at x,y with defined width and height
|
||||
// The colour (optional, black is default) is used to fill the gap after the scroll
|
||||
setScrollRect(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t color = TFT_BLACK),
|
||||
// Scroll the defined zone dx,dy pixels. Negative values left,up, positive right,down
|
||||
// dy is optional (default is then no up/down scroll).
|
||||
// dy is optional (default is 0, so no up/down scroll).
|
||||
// The sprite coordinate frame does not move because pixels are moved
|
||||
scroll(int16_t dx, int16_t dy = 0),
|
||||
|
||||
@ -92,9 +94,9 @@ class TFT_eSprite : public TFT_eSPI {
|
||||
uint8_t getRotation(void);
|
||||
|
||||
// Push a rotated copy of Sprite to TFT with optional transparent colour
|
||||
bool pushRotated(int16_t angle, uint32_t transp = 0x00FFFFFF); // Using fixed point maths
|
||||
bool pushRotated(int16_t angle, uint32_t transp = 0x00FFFFFF);
|
||||
// Push a rotated copy of Sprite to another different Sprite with optional transparent colour
|
||||
bool pushRotated(TFT_eSprite *spr, int16_t angle, uint32_t transp = 0x00FFFFFF); // Using fixed point maths
|
||||
bool pushRotated(TFT_eSprite *spr, int16_t angle, uint32_t transp = 0x00FFFFFF);
|
||||
|
||||
// Get the TFT bounding box for a rotated copy of this Sprite
|
||||
bool getRotatedBounds(int16_t angle, int16_t *min_x, int16_t *min_y, int16_t *max_x, int16_t *max_y);
|
||||
@ -125,10 +127,10 @@ class TFT_eSprite : public TFT_eSPI {
|
||||
bool pushSprite(int32_t tx, int32_t ty, int32_t sx, int32_t sy, int32_t sw, int32_t sh);
|
||||
|
||||
// Push the sprite to another sprite at x,y. This fn calls pushImage() in the destination sprite (dspr) class.
|
||||
// >>>>>> Using a transparent color is not supported at the moment <<<<<<
|
||||
bool pushToSprite(TFT_eSprite *dspr, int32_t x, int32_t y);
|
||||
bool pushToSprite(TFT_eSprite *dspr, int32_t x, int32_t y, uint16_t transparent);
|
||||
|
||||
// Draw a single character in the selected font
|
||||
int16_t drawChar(uint16_t uniCode, int32_t x, int32_t y, uint8_t font),
|
||||
drawChar(uint16_t uniCode, int32_t x, int32_t y);
|
||||
|
||||
@ -137,9 +139,13 @@ class TFT_eSprite : public TFT_eSPI {
|
||||
height(void);
|
||||
|
||||
// Functions associated with anti-aliased fonts
|
||||
// Draw a single unicode character using the loaded font
|
||||
void drawGlyph(uint16_t code);
|
||||
// Print string to sprite using loaded font at cursor position
|
||||
void printToSprite(String string);
|
||||
// Print char array to sprite using loaded font at cursor position
|
||||
void printToSprite(char *cbuffer, uint16_t len);
|
||||
// Print indexed glyph to sprite using loaded font at x,y
|
||||
int16_t printToSprite(int16_t x, int16_t y, uint16_t index);
|
||||
|
||||
private:
|
||||
@ -155,19 +161,19 @@ class TFT_eSprite : public TFT_eSPI {
|
||||
|
||||
protected:
|
||||
|
||||
uint8_t _bpp; // bits per pixel (1, 8 or 16)
|
||||
uint8_t _bpp; // bits per pixel (1, 4, 8 or 16)
|
||||
uint16_t *_img; // pointer to 16 bit sprite
|
||||
uint8_t *_img8; // pointer to 8 bit sprite frame 1 or frame 2
|
||||
uint8_t *_img8; // pointer to 1 and 8 bit sprite frame 1 or frame 2
|
||||
uint8_t *_img4; // pointer to 4 bit sprite (uses color map)
|
||||
uint8_t *_img8_1; // pointer to frame 1
|
||||
uint8_t *_img8_2; // pointer to frame 2
|
||||
|
||||
uint16_t *_colorMap; // color map: 16 entries, used with 4 bit color map.
|
||||
uint16_t *_colorMap; // color map pointer: 16 entries, used with 4 bit color map.
|
||||
|
||||
int32_t _sinra;
|
||||
int32_t _cosra;
|
||||
int32_t _sinra; // Sine of rotation angle in fixed point
|
||||
int32_t _cosra; // Cosine of rotation angle in fixed point
|
||||
|
||||
bool _created; // A Sprite has been created and memory reserved
|
||||
bool _created; // A Sprite has been created and memory reserved
|
||||
bool _gFont = false;
|
||||
|
||||
int32_t _xs, _ys, _xe, _ye, _xptr, _yptr; // for setWindow
|
||||
@ -176,7 +182,7 @@ class TFT_eSprite : public TFT_eSPI {
|
||||
uint32_t _scolor; // gap fill colour for scroll zone
|
||||
|
||||
int32_t _iwidth, _iheight; // Sprite memory image bit width and height (swapped during rotations)
|
||||
int32_t _dwidth, _dheight; // Real display width and height (for <8bpp Sprites)
|
||||
int32_t _dwidth, _dheight; // Real sprite width and height (for <8bpp Sprites)
|
||||
int32_t _bitwidth; // Sprite image bit width for drawPixel (for <8bpp Sprites, not swapped)
|
||||
|
||||
};
|
||||
|
@ -28,9 +28,12 @@
|
||||
// SPI PIO code for 16 bit colour transmit
|
||||
#include "pio_SPI.pio.h"
|
||||
#endif
|
||||
#else
|
||||
#elif defined (TFT_PARALLEL_8_BIT)
|
||||
// SPI PIO code for 8 bit parallel interface (16 bit colour)
|
||||
#include "pio_8bit_parallel.pio.h"
|
||||
#else // must be TFT_PARALLEL_16_BIT
|
||||
// SPI PIO code for 16 bit parallel interface (16 bit colour)
|
||||
#include "pio_16bit_parallel.pio.h"
|
||||
#endif
|
||||
|
||||
// Board package specific differences
|
||||
@ -189,7 +192,7 @@ void pioinit(uint32_t clock_freq) {
|
||||
pio_instr_set_dc = pio_encode_set((pio_src_dest)0, 1);
|
||||
pio_instr_clr_dc = pio_encode_set((pio_src_dest)0, 0);
|
||||
}
|
||||
#else
|
||||
#else // 8 or 16 bit parallel
|
||||
void pioinit(uint16_t clock_div, uint16_t fract_div) {
|
||||
|
||||
// Find a free SM on one of the PIO's
|
||||
@ -212,21 +215,27 @@ void pioinit(uint16_t clock_div, uint16_t fract_div) {
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
#if defined (TFT_PARALLEL_8_BIT)
|
||||
uint8_t bits = 8;
|
||||
#else // must be TFT_PARALLEL_16_BIT
|
||||
uint8_t bits = 16;
|
||||
#endif
|
||||
|
||||
// Load the PIO program
|
||||
program_offset = pio_add_program(tft_pio, &tft_io_program);
|
||||
|
||||
// Associate pins with the PIO
|
||||
pio_gpio_init(tft_pio, TFT_DC);
|
||||
pio_gpio_init(tft_pio, TFT_WR);
|
||||
for (int i = 0; i < 8; i++) {
|
||||
|
||||
for (int i = 0; i < bits; i++) {
|
||||
pio_gpio_init(tft_pio, TFT_D0 + i);
|
||||
}
|
||||
|
||||
// Configure the pins to be outputs
|
||||
pio_sm_set_consecutive_pindirs(tft_pio, pio_sm, TFT_DC, 1, true);
|
||||
pio_sm_set_consecutive_pindirs(tft_pio, pio_sm, TFT_WR, 1, true);
|
||||
pio_sm_set_consecutive_pindirs(tft_pio, pio_sm, TFT_D0, 8, true);
|
||||
pio_sm_set_consecutive_pindirs(tft_pio, pio_sm, TFT_D0, bits, true);
|
||||
|
||||
// Configure the state machine
|
||||
pio_sm_config c = tft_io_program_get_default_config(program_offset);
|
||||
@ -234,8 +243,8 @@ void pioinit(uint16_t clock_div, uint16_t fract_div) {
|
||||
sm_config_set_set_pins(&c, TFT_DC, 1);
|
||||
// Define the single side-set pin
|
||||
sm_config_set_sideset_pins(&c, TFT_WR);
|
||||
// Define the 8 consecutive pins that are used for data output
|
||||
sm_config_set_out_pins(&c, TFT_D0, 8);
|
||||
// Define the consecutive pins that are used for data output
|
||||
sm_config_set_out_pins(&c, TFT_D0, bits);
|
||||
// Set clock divider and fractional divider
|
||||
sm_config_set_clkdiv_int_frac(&c, clock_div, fract_div);
|
||||
// Make a single 8 words FIFO from the 4 words TX and RX FIFOs
|
||||
|
@ -30,7 +30,7 @@
|
||||
// Include processor specific header
|
||||
// None
|
||||
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (RP2040_PIO_SPI)
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT) || defined (RP2040_PIO_SPI)
|
||||
#define RP2040_PIO_INTERFACE
|
||||
#define RP2040_PIO_PUSHBLOCK
|
||||
#endif
|
||||
@ -80,18 +80,33 @@
|
||||
#endif
|
||||
#else
|
||||
|
||||
// ILI9481 needs a slower cycle time
|
||||
// Byte rate = (CPU clock/(4 * divider))
|
||||
#ifdef ILI9481_DRIVER
|
||||
#define DIV_UNITS 1
|
||||
#define DIV_FRACT 160
|
||||
#else
|
||||
#define DIV_UNITS 1
|
||||
#define DIV_FRACT 0
|
||||
// Different controllers have different minimum write cycle periods, so the PIO clock is changed accordingly
|
||||
// The PIO clock is a division of the CPU clock so scales when the processor is overclocked
|
||||
// PIO write frequency = (CPU clock/(4 * DIV_UNITS))
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT) || defined (RP2040_PIO_SPI)
|
||||
#if defined (TFT_PARALLEL_16_BIT)
|
||||
// Different display drivers have different minimum write cycle times
|
||||
#if defined (HX8357C_DRIVER) || defined (SSD1963_DRIVER)
|
||||
#define DIV_UNITS 1 // 32ns write cycle time SSD1963, HX8357C (maybe HX8357D?)
|
||||
#elif defined (ILI9486_DRIVER) || defined (HX8357B_DRIVER) || defined (HX8357D_DRIVER)
|
||||
#define DIV_UNITS 2 // 64ns write cycle time ILI9486, HX8357D, HX8357B
|
||||
#else // ILI9481 needs a slower cycle time
|
||||
#define DIV_UNITS 3 // 96ns write cycle time
|
||||
#endif
|
||||
#define DIV_FRACT 0
|
||||
#else // 8 bit parallel mode
|
||||
#ifdef ILI9481_DRIVER
|
||||
#define DIV_UNITS 1
|
||||
#define DIV_FRACT 160 // Note: Fractional values done with clock period dithering
|
||||
#else
|
||||
#define DIV_UNITS 1
|
||||
#define DIV_FRACT 0
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Initialise TFT data bus
|
||||
#if defined (TFT_PARALLEL_8_BIT)
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT)
|
||||
#define INIT_TFT_DATA_BUS pioinit(DIV_UNITS, DIV_FRACT);
|
||||
#elif defined (RP2040_PIO_SPI)
|
||||
#define INIT_TFT_DATA_BUS pioinit(SPI_FREQUENCY);
|
||||
@ -184,7 +199,7 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Define the WR (TFT Write) pin drive code
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if !defined (TFT_PARALLEL_8_BIT) // SPI
|
||||
#if !defined (TFT_PARALLEL_8_BIT) && !defined (TFT_PARALLEL_16_BIT) // SPI
|
||||
#ifdef TFT_WR
|
||||
#define WR_L digitalWrite(TFT_WR, LOW)
|
||||
#define WR_H digitalWrite(TFT_WR, HIGH)
|
||||
@ -384,13 +399,18 @@
|
||||
|
||||
#define tft_Write_32D(C) WAIT_FOR_FIFO_FREE(2); TX_FIFO = (((C)<<8) | ((C)>>8)); tft_Write_8L(C)
|
||||
|
||||
#else
|
||||
// This writes 8 bits, then switches back to 16 bit mode automatically
|
||||
// Have already waited for pio stalled (last data write complete) when DC switched to command mode
|
||||
// The wait for stall allows DC to be changed immediately afterwards
|
||||
#else // PIO interface, SPI or parallel
|
||||
// This writes 8 bits, then switches back to 16 bit mode automatically
|
||||
// Have already waited for pio stalled (last data write complete) when DC switched to command mode
|
||||
// The wait for stall allows DC to be changed immediately afterwards
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (RP2040_PIO_SPI)
|
||||
#define tft_Write_8(C) tft_pio->sm[pio_sm].instr = pio_instr_jmp8; \
|
||||
TX_FIFO = (C); \
|
||||
WAIT_FOR_STALL
|
||||
#else // For 16 bit parallel 16 bits are always sent
|
||||
#define tft_Write_8(C) TX_FIFO = (C); \
|
||||
WAIT_FOR_STALL
|
||||
#endif
|
||||
|
||||
// Note: the following macros do not wait for the end of transmission
|
||||
|
||||
|
76
Processors/pio_16bit_parallel.pio
Normal file
76
Processors/pio_16bit_parallel.pio
Normal file
@ -0,0 +1,76 @@
|
||||
// Raspberry Pi Pico PIO program to output data to a TFT
|
||||
// controller via a 16 bit 8080 style data path.
|
||||
|
||||
// Original sourced from:
|
||||
// https://github.com/zapta/pio_tft
|
||||
|
||||
// Side set: 1 output pin, TFT_WR. Active low.
|
||||
// Data set: 16 consecutive output pins, TFT_D0 .. TFT_D15
|
||||
|
||||
.program tft_io
|
||||
.side_set 1 opt ; The TFT_WR output.
|
||||
|
||||
// The C++ code switches between the different SM routines
|
||||
// by waiting for the SM to be idle and setting its PC.
|
||||
// The default SM routine is a 16 bit transfer
|
||||
|
||||
// Do a block fill of N+1 pixels.
|
||||
public block_fill:
|
||||
// Fetch colour value.
|
||||
pull side 1
|
||||
// Move colour to x.
|
||||
mov x, osr
|
||||
// Fetch pixel count N (sends N+1 pixels).
|
||||
pull
|
||||
// Move pixel count to y.
|
||||
mov y, osr
|
||||
next:
|
||||
// Copy colour value into osr, colour in LS 16 bits.
|
||||
mov osr, x side 1
|
||||
// Output colour 16 bits, unwanted top 16 bits shifted through.
|
||||
out pins, 32 side 0 [1]
|
||||
// Decrement pixel count and loop.
|
||||
jmp y--, next side 1
|
||||
|
||||
.wrap_target
|
||||
// Transmit an 8 bit value (LS 8 bits of 32 bits).
|
||||
public start_8:
|
||||
// Transmit a 16 bit value (LS 16 bits of 32 bits).
|
||||
public start_tx:
|
||||
// Fetch the next 32 bit value from the TX FIFO and set TFT_WR high.
|
||||
pull side 1
|
||||
// Write the 16 bits and set WR low. This also
|
||||
// shifts the unused top 16 bits through.
|
||||
out pins, 32 side 0 [1]
|
||||
// Set WR high and jump back to start.
|
||||
jmp start_tx side 1
|
||||
|
||||
// Transmit a set window command sequence.
|
||||
public set_addr_window:
|
||||
// Loop count in x (to send caset, paset and ramwr commands).
|
||||
set x, 2 side 1
|
||||
pull_cmd:
|
||||
// Set TFT_DC low.
|
||||
set pins, 0
|
||||
// Fetch caset, paset or ramwr.
|
||||
pull
|
||||
// Output LS byte (caset, paset or ramwr), discarding top 16 bits, set TFT_WR low.
|
||||
out pins, 32 side 0
|
||||
// Jump to end if 3rd cmd byte ramwr sent (x == 0)
|
||||
jmp !x, end_set_addr
|
||||
// pull next start and end coordinates, TFT_WR high.
|
||||
pull side 1
|
||||
// Set TFT_DC high.
|
||||
set pins, 1
|
||||
send_xy:
|
||||
// Output byte, TFT_WR low.
|
||||
out pins, 8 side 0 [1]
|
||||
// Loop until 4 bytes sent, TFT_WR high.
|
||||
jmp !osre, send_xy side 1 [1]
|
||||
end_set_addr: // Jump here since delay needed before DC change
|
||||
// Loop back for next command and write last command.
|
||||
jmp x--, pull_cmd side 1
|
||||
// Set DC high.
|
||||
set pins, 1
|
||||
// Auto-wrap back to start_tx.
|
||||
.wrap
|
62
Processors/pio_16bit_parallel.pio.h
Normal file
62
Processors/pio_16bit_parallel.pio.h
Normal file
@ -0,0 +1,62 @@
|
||||
// -------------------------------------------------- //
|
||||
// This file is autogenerated by pioasm; do not edit! //
|
||||
// -------------------------------------------------- //
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !PICO_NO_HARDWARE
|
||||
#include "hardware/pio.h"
|
||||
#endif
|
||||
|
||||
// ------ //
|
||||
// tft_io //
|
||||
// ------ //
|
||||
|
||||
#define tft_io_wrap_target 7
|
||||
#define tft_io_wrap 20
|
||||
|
||||
#define tft_io_offset_block_fill 0u
|
||||
#define tft_io_offset_start_8 7u
|
||||
#define tft_io_offset_start_tx 7u
|
||||
#define tft_io_offset_set_addr_window 10u
|
||||
|
||||
static const uint16_t tft_io_program_instructions[] = {
|
||||
0x98a0, // 0: pull block side 1
|
||||
0xa027, // 1: mov x, osr
|
||||
0x80a0, // 2: pull block
|
||||
0xa047, // 3: mov y, osr
|
||||
0xb8e1, // 4: mov osr, x side 1
|
||||
0x7100, // 5: out pins, 32 side 0 [1]
|
||||
0x1884, // 6: jmp y--, 4 side 1
|
||||
// .wrap_target
|
||||
0x98a0, // 7: pull block side 1
|
||||
0x7100, // 8: out pins, 32 side 0 [1]
|
||||
0x1807, // 9: jmp 7 side 1
|
||||
0xf822, // 10: set x, 2 side 1
|
||||
0xe000, // 11: set pins, 0
|
||||
0x80a0, // 12: pull block
|
||||
0x7000, // 13: out pins, 32 side 0
|
||||
0x0033, // 14: jmp !x, 19
|
||||
0x98a0, // 15: pull block side 1
|
||||
0xe001, // 16: set pins, 1
|
||||
0x7108, // 17: out pins, 8 side 0 [1]
|
||||
0x19f1, // 18: jmp !osre, 17 side 1 [1]
|
||||
0x184b, // 19: jmp x--, 11 side 1
|
||||
0xe001, // 20: set pins, 1
|
||||
// .wrap
|
||||
};
|
||||
|
||||
#if !PICO_NO_HARDWARE
|
||||
static const struct pio_program tft_io_program = {
|
||||
.instructions = tft_io_program_instructions,
|
||||
.length = 21,
|
||||
.origin = -1,
|
||||
};
|
||||
|
||||
static inline pio_sm_config tft_io_program_get_default_config(uint offset) {
|
||||
pio_sm_config c = pio_get_default_sm_config();
|
||||
sm_config_set_wrap(&c, offset + tft_io_wrap_target, offset + tft_io_wrap);
|
||||
sm_config_set_sideset(&c, 2, true, false);
|
||||
return c;
|
||||
}
|
||||
#endif
|
@ -15,7 +15,7 @@
|
||||
delay(120);
|
||||
|
||||
writecommand(0x3A);
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (RPI_DISPLAY_TYPE)
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT) || defined (RPI_DISPLAY_TYPE)
|
||||
writedata(0x55); // 16 bit colour interface
|
||||
#else
|
||||
writedata(0x66); // 18 bit colour interface
|
||||
@ -64,7 +64,7 @@
|
||||
writedata(0x20);
|
||||
writedata(0x00);
|
||||
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (RPI_DISPLAY_TYPE)
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT) || defined (RPI_DISPLAY_TYPE)
|
||||
writecommand(TFT_INVOFF);
|
||||
#else
|
||||
writecommand(TFT_INVON);
|
||||
|
@ -58,7 +58,7 @@
|
||||
writedata(0x48); // MX, BGR
|
||||
|
||||
writecommand(0x3A); // Pixel Interface Format
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (RPI_DISPLAY_TYPE)
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT) || defined (RPI_DISPLAY_TYPE)
|
||||
writedata(0x55); // 16 bit colour for parallel
|
||||
#else
|
||||
writedata(0x66); // 18 bit colour for SPI
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
The larger fonts are Run Length Encoded to reduce their
|
||||
size.
|
||||
f
|
||||
|
||||
Created by Bodmer 2/12/16
|
||||
Last update by Bodmer 20/03/20
|
||||
****************************************************/
|
||||
|
20
TFT_eSPI.h
20
TFT_eSPI.h
@ -16,7 +16,7 @@
|
||||
#ifndef _TFT_eSPIH_
|
||||
#define _TFT_eSPIH_
|
||||
|
||||
#define TFT_ESPI_VERSION "2.4.61"
|
||||
#define TFT_ESPI_VERSION "2.4.70"
|
||||
|
||||
// Bit level feature flags
|
||||
// Bit 0 set: viewport capability
|
||||
@ -99,7 +99,7 @@
|
||||
#endif
|
||||
|
||||
// Some ST7789 boards do not work with Mode 0
|
||||
#ifndef TFT_SPI_MODE
|
||||
#ifndef TFT_SPI_MODE
|
||||
#if defined(ST7789_DRIVER) || defined(ST7789_2_DRIVER)
|
||||
#define TFT_SPI_MODE SPI_MODE3
|
||||
#else
|
||||
@ -280,7 +280,7 @@ const PROGMEM fontinfo fontdata [] = {
|
||||
#define TFT_WHITE 0xFFFF /* 255, 255, 255 */
|
||||
#define TFT_ORANGE 0xFDA0 /* 255, 180, 0 */
|
||||
#define TFT_GREENYELLOW 0xB7E0 /* 180, 255, 0 */
|
||||
#define TFT_PINK 0xFE19 /* 255, 192, 203 */ //Lighter pink, was 0xFC9F
|
||||
#define TFT_PINK 0xFE19 /* 255, 192, 203 */ //Lighter pink, was 0xFC9F
|
||||
#define TFT_BROWN 0x9A60 /* 150, 75, 0 */
|
||||
#define TFT_GOLD 0xFEA0 /* 255, 215, 0 */
|
||||
#define TFT_SILVER 0xC618 /* 192, 192, 192 */
|
||||
@ -409,7 +409,7 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac
|
||||
height(void),
|
||||
width(void);
|
||||
|
||||
// Read the colour of a pixel at x,y and return value in 565 format
|
||||
// Read the colour of a pixel at x,y and return value in 565 format
|
||||
virtual uint16_t readPixel(int32_t x, int32_t y);
|
||||
|
||||
virtual void setWindow(int32_t xs, int32_t ys, int32_t xe, int32_t ye); // Note: start + end coordinates
|
||||
@ -555,7 +555,7 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac
|
||||
// Text rendering - value returned is the pixel width of the rendered text
|
||||
int16_t drawNumber(long intNumber, int32_t x, int32_t y, uint8_t font), // Draw integer using specified font number
|
||||
drawNumber(long intNumber, int32_t x, int32_t y), // Draw integer using current font
|
||||
|
||||
|
||||
// Decimal is the number of decimal places to render
|
||||
// Use with setTextDatum() to position values on TFT, and setTextPadding() to blank old displayed values
|
||||
drawFloat(float floatNumber, uint8_t decimal, int32_t x, int32_t y, uint8_t font), // Draw float using specified font number
|
||||
@ -579,14 +579,14 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac
|
||||
|
||||
int16_t getCursorX(void), // Read current cursor x position (moves with tft.print())
|
||||
getCursorY(void); // Read current cursor y position
|
||||
|
||||
|
||||
void setTextColor(uint16_t color), // Set character (glyph) color only (background not over-written)
|
||||
setTextColor(uint16_t fgcolor, uint16_t bgcolor, bool bgfill = false), // Set character (glyph) foreground and background colour, optional background fill for smooth fonts
|
||||
setTextSize(uint8_t size); // Set character size multiplier (this increases pixel size)
|
||||
|
||||
void setTextWrap(bool wrapX, bool wrapY = false); // Turn on/off wrapping of text in TFT width and/or height
|
||||
|
||||
void setTextDatum(uint8_t datum); // Set text datum position (default is top left), see Section 6 above
|
||||
void setTextDatum(uint8_t datum); // Set text datum position (default is top left), see Section 6 above
|
||||
uint8_t getTextDatum(void);
|
||||
|
||||
void setTextPadding(uint16_t x_width); // Set text padding (background blanking/over-write) width in pixels
|
||||
@ -689,7 +689,7 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac
|
||||
// Parameter "true" enables DMA engine control of TFT chip select (ESP32 only)
|
||||
// For ESP32 only, TFT reads will not work if parameter is true
|
||||
void deInitDMA(void); // De-initialise the DMA engine and detach from SPI bus - typically not used
|
||||
|
||||
|
||||
// Push an image to the TFT using DMA, buffer is optional and grabs (double buffers) a copy of the image
|
||||
// Use the buffer if the image data will get over-written or destroyed while DMA is in progress
|
||||
// If swapping colour bytes is defined, and the double buffer option is NOT used, then the bytes
|
||||
@ -847,7 +847,7 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac
|
||||
bool _swapBytes; // Swap the byte order for TFT pushImage()
|
||||
|
||||
bool _booted; // init() or begin() has already run once
|
||||
|
||||
|
||||
// User sketch manages these via set/getAttribute()
|
||||
bool _cp437; // If set, use correct CP437 charset (default is ON)
|
||||
bool _utf8; // If set, use UTF-8 decoder in print stream 'write()' function (default ON)
|
||||
@ -857,7 +857,7 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac
|
||||
|
||||
bool _fillbg; // Fill background flag (just for for smooth fonts at the moment)
|
||||
|
||||
#if defined (SSD1963_DRIVER)
|
||||
#if defined (SSD1963_DRIVER)
|
||||
uint16_t Cswap; // Swap buffer for SSD1963
|
||||
uint8_t r6, g6, b6; // RGB buffer for SSD1963
|
||||
#endif
|
||||
|
@ -34,8 +34,9 @@
|
||||
//#define STM_PORTA_DATA_BUS
|
||||
//#define STM_PORTB_DATA_BUS
|
||||
|
||||
// Tell the library to use 8 bit parallel mode (otherwise SPI is assumed)
|
||||
// Tell the library to use parallel mode (otherwise SPI is assumed)
|
||||
//#define TFT_PARALLEL_8_BIT
|
||||
//#defined TFT_PARALLEL_16_BIT // **** 16 bit parallel ONLY for RP2040 processor ****
|
||||
|
||||
// Display type - only define if RPi display
|
||||
//#define RPI_DISPLAY_TYPE // 20MHz maximum SPI
|
||||
|
@ -84,9 +84,10 @@
|
||||
//#include <User_Setups/Setup61_RP2040_ILI9341_PIO_SPI.h> // Setup file for RP2040 with PIO SPI ILI9341
|
||||
//#include <User_Setups/Setup62_RP2040_Nano_Connect_ILI9341.h> // Setup file for RP2040 with SPI ILI9341
|
||||
|
||||
//#include <User_Setups/Setup70_ESP32_S2_ILI9341.h> // Setup file for ESP32 S2 with SPI ILI9341
|
||||
//#include <User_Setups/Setup70b_ESP32_S3_ILI9341.h> // Setup file for ESP32 S3 with SPI ILI9341
|
||||
//#include <User_Setups/Setup70c_ESP32_C3_ILI9341.h> // Setup file for ESP32 C3 with SPI ILI9341
|
||||
//#include <User_Setups/Setup70_ESP32_S2_ILI9341.h> // Setup file for ESP32 S2 with SPI ILI9341
|
||||
//#include <User_Setups/Setup70b_ESP32_S3_ILI9341.h> // Setup file for ESP32 S3 with SPI ILI9341
|
||||
//#include <User_Setups/Setup70c_ESP32_C3_ILI9341.h> // Setup file for ESP32 C3 with SPI ILI9341
|
||||
//#include <User_Setups/Setup70d_ILI9488_S3_Parallel.h> // Setup file for ESP32 S3 with SPI ILI9488
|
||||
|
||||
//#include <User_Setups/Setup71_ESP32_S2_ST7789.h> // Setup file for ESP32 S2 with ST7789
|
||||
//#include <User_Setups/Setup72_ESP32_ST7789_172x320.h> // Setup file for ESP32 with ST7789 1.47" 172x320
|
||||
@ -97,6 +98,10 @@
|
||||
//#include <User_Setups/Setup103_RP2040_ILI9486_parallel.h> // Setup file for Pico/RP2040 with 8 bit parallel ILI9486
|
||||
//#include <User_Setups/Setup104_RP2040_ST7796_parallel.h> // Setup file for Pico/RP2040 with 8 bit parallel ST7796
|
||||
|
||||
//#include <User_Setups/Setup105_RP2040_ST7796_16bit_parallel.h> // Setup file for RP2040 16 bit parallel display
|
||||
//#include <User_Setups/Setup106_RP2040_ILI9481_16bit_parallel.h> // Setup file for RP2040 16 bit parallel display
|
||||
//#include <User_Setups/Setup107_RP2040_ILI9341_16bit_parallel.h> // Setup file for RP2040 16 bit parallel display
|
||||
|
||||
//#include <User_Setups/Setup135_ST7789.h> // Setup file for ESP8266 and ST7789 135 x 240 TFT
|
||||
|
||||
//#include <User_Setups/Setup136_LilyGo_TTV.h> // Setup file for ESP32 and Lilygo TTV ST7789 SPI bus TFT 135x240
|
||||
@ -113,6 +118,16 @@
|
||||
//#include <User_Setups/SetupX_Template.h> // Template file for a setup
|
||||
|
||||
|
||||
//#include <User_Setups/Dustin_ILI9488.h> // Setup file for Dustin Watts PCB with ILI9488
|
||||
//#include <User_Setups/Dustin_ST7796.h> // Setup file for Dustin Watts PCB with ST7796
|
||||
//#include <User_Setups/Dustin_ILI9488_Pico.h> // Setup file for Dustin Watts Pico PCB with ST7796
|
||||
//#include <User_Setups/Dustin_ST7789_Pico.h> // Setup file for Dustin Watts PCB with ST7789 240 x 240 on 3.3V adapter board
|
||||
//#include <User_Setups/Dustin_GC9A01_Pico.h> // Setup file for Dustin Watts PCB with GC9A01 240 x 240 on 3.3V adapter board
|
||||
//#include <User_Setups/Dustin_GC9A01_ESP32.h> // Setup file for Dustin Watts PCB with GC9A01 240 x 240 on 3.3V adapter board
|
||||
//#include <User_Setups/Dustin_STT7789_ESP32.h> // Setup file for Dustin Watts PCB with ST7789 240 x 240 on 3.3V adapter board
|
||||
//#include <User_Setups/Dustin_ILI9341_ESP32.h> // Setup file for Dustin Watts PCB with ILI9341
|
||||
//#include <User_Setups/ILI9225.h>
|
||||
|
||||
#endif // USER_SETUP_LOADED
|
||||
|
||||
|
||||
@ -148,7 +163,7 @@
|
||||
#endif
|
||||
|
||||
// Invoke 18 bit colour for selected displays
|
||||
#if !defined (RPI_DISPLAY_TYPE) && !defined (TFT_PARALLEL_8_BIT) && !defined (ESP32_PARALLEL)
|
||||
#if !defined (RPI_DISPLAY_TYPE) && !defined (TFT_PARALLEL_8_BIT) && !defined (TFT_PARALLEL_16_BIT) && !defined (ESP32_PARALLEL)
|
||||
#if defined (ILI9481_DRIVER) || defined (ILI9486_DRIVER) || defined (ILI9488_DRIVER)
|
||||
#define SPI_18BIT_DRIVER
|
||||
#endif
|
||||
|
60
User_Setups/Setup105_RP2040_ST7796_16bit_parallel.h
Normal file
60
User_Setups/Setup105_RP2040_ST7796_16bit_parallel.h
Normal file
@ -0,0 +1,60 @@
|
||||
// This setup is for the RP2040 processor only when used with 8 bit parallel displays
|
||||
// See SetupX_Template.h for all options available
|
||||
#define USER_SETUP_ID 105
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#define TFT_PARALLEL_16_BIT
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Display driver type
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#define ST7796_DRIVER
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// RP2040 pins used
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//#define TFT_CS -1 // Do not define, chip select control pin permanently connected to 0V
|
||||
|
||||
// These pins can be moved and are controlled directly by the library software
|
||||
#define TFT_DC 3 // Data Command control pin
|
||||
#define TFT_RST 2 // Reset pin
|
||||
|
||||
//#define TFT_RD -1 // Do not define, read pin must be permanently connected to 3V3
|
||||
#define TFT_WR 4
|
||||
|
||||
// PIO requires these to be sequentially increasing GPIO with no gaps
|
||||
#define TFT_D0 6
|
||||
#define TFT_D1 7
|
||||
#define TFT_D2 8
|
||||
#define TFT_D3 9
|
||||
#define TFT_D4 10
|
||||
#define TFT_D5 11
|
||||
#define TFT_D6 12
|
||||
#define TFT_D7 13
|
||||
#define TFT_D8 14
|
||||
#define TFT_D9 15
|
||||
#define TFT_D10 16
|
||||
#define TFT_D11 17
|
||||
#define TFT_D12 18
|
||||
#define TFT_D13 19
|
||||
#define TFT_D14 20
|
||||
#define TFT_D15 21
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Fonts to be available
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
|
||||
#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
|
||||
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:.
|
||||
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
|
||||
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
|
||||
|
||||
#define SMOOTH_FONT
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
64
User_Setups/Setup106_RP2040_ILI9481_16bit_parallel.h
Normal file
64
User_Setups/Setup106_RP2040_ILI9481_16bit_parallel.h
Normal file
@ -0,0 +1,64 @@
|
||||
// This setup is for the RP2040 processor when used with 8 bit parallel displays
|
||||
// See SetupX_Template.h for all options available
|
||||
#define USER_SETUP_ID 106
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//#define TFT_PARALLEL_8_BIT
|
||||
#define TFT_PARALLEL_16_BIT
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Display driver type
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//#define ILI9481_DRIVER
|
||||
//#define HX8357B_DRIVER
|
||||
#define HX8357C_DRIVER
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// RP2040 pins used
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// These pins can be moved and are controlled directly by the library software
|
||||
#define TFT_RST 18 // Reset pin
|
||||
#define TFT_CS 19 // Do not define if chip select control pin permanently connected to 0V
|
||||
//#define TFT_RD -1 // Do not define, read pin must be permanently connected to 3V3
|
||||
|
||||
// Note: All the following pins are PIO hardware configured and driven
|
||||
#define TFT_WR 16 // Write strobe pin
|
||||
#define TFT_DC 17 // Data Command control pin
|
||||
|
||||
// PIO requires these to be sequentially increasing
|
||||
#define TFT_D0 0
|
||||
#define TFT_D1 1
|
||||
#define TFT_D2 2
|
||||
#define TFT_D3 3
|
||||
#define TFT_D4 4
|
||||
#define TFT_D5 5
|
||||
#define TFT_D6 6
|
||||
#define TFT_D7 7
|
||||
#define TFT_D8 8
|
||||
#define TFT_D9 9
|
||||
#define TFT_D10 10
|
||||
#define TFT_D11 11
|
||||
#define TFT_D12 12
|
||||
#define TFT_D13 13
|
||||
#define TFT_D14 14
|
||||
#define TFT_D15 15
|
||||
//*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Fonts to be available
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
|
||||
#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
|
||||
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:.
|
||||
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
|
||||
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
|
||||
|
||||
#define SMOOTH_FONT
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
65
User_Setups/Setup107_RP2040_ILI9341_16bit_parallel.h
Normal file
65
User_Setups/Setup107_RP2040_ILI9341_16bit_parallel.h
Normal file
@ -0,0 +1,65 @@
|
||||
// This setup is for the RP2040 processor only when used with 8 bit parallel displays
|
||||
// See SetupX_Template.h for all options available
|
||||
#define USER_SETUP_ID 107
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//#define TFT_PARALLEL_8_BIT
|
||||
#define TFT_PARALLEL_16_BIT
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Display driver type
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//#define ILI9341_DRIVER
|
||||
//#define ILI9481_DRIVER // Tested
|
||||
//#define HX8357B_DRIVER // Tested
|
||||
//#define HX8357C_DRIVER // Tested
|
||||
#define SSD1963_800_DRIVER
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// RP2040 pins used
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// These pins can be moved and are controlled directly by the library software
|
||||
#define TFT_RST 18 // Reset pin
|
||||
#define TFT_CS 19 // Do not define if chip select control pin permanently connected to 0V
|
||||
//#define TFT_RD -1 // Do not define, read pin must be permanently connected to 3V3
|
||||
|
||||
// Note: All the following pins are PIO hardware configured and driven
|
||||
#define TFT_WR 16 // Write strobe pin
|
||||
#define TFT_DC 17 // Data Command control pin
|
||||
|
||||
// PIO requires these to be sequentially increasing
|
||||
#define TFT_D0 0
|
||||
#define TFT_D1 1
|
||||
#define TFT_D2 2
|
||||
#define TFT_D3 3
|
||||
#define TFT_D4 4
|
||||
#define TFT_D5 5
|
||||
#define TFT_D6 6
|
||||
#define TFT_D7 7
|
||||
#define TFT_D8 8
|
||||
#define TFT_D9 9
|
||||
#define TFT_D10 10
|
||||
#define TFT_D11 11
|
||||
#define TFT_D12 12
|
||||
#define TFT_D13 13
|
||||
#define TFT_D14 14
|
||||
#define TFT_D15 15
|
||||
//*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Fonts to be available
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
|
||||
#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
|
||||
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:.
|
||||
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
|
||||
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
|
||||
|
||||
#define SMOOTH_FONT
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
36
User_Setups/Setup70d_ILI9488_S3_Parallel.h
Normal file
36
User_Setups/Setup70d_ILI9488_S3_Parallel.h
Normal file
@ -0,0 +1,36 @@
|
||||
|
||||
#define USER_SETUP_ID 146
|
||||
|
||||
#define TFT_PARALLEL_8_BIT
|
||||
|
||||
//#define ILI9341_DRIVER
|
||||
//#define ST7796_DRIVER
|
||||
#define ILI9488_DRIVER
|
||||
|
||||
// ESP32 S3 pins used for the parallel interface TFT
|
||||
#define TFT_CS 9
|
||||
#define TFT_DC 8 // Data Command control pin - must use a GPIO in the range 0-31
|
||||
#define TFT_RST 34
|
||||
|
||||
#define TFT_WR 7 // Write strobe control pin - must use a GPIO in the range 0-31
|
||||
#define TFT_RD 6
|
||||
|
||||
#define TFT_D0 12 // Must use GPIO in the range 0-31 for the data bus
|
||||
#define TFT_D1 13 // so a single register write sets/clears all bits
|
||||
#define TFT_D2 14
|
||||
#define TFT_D3 15
|
||||
#define TFT_D4 16
|
||||
#define TFT_D5 21
|
||||
#define TFT_D6 5
|
||||
#define TFT_D7 4
|
||||
|
||||
|
||||
#define LOAD_GLCD
|
||||
#define LOAD_FONT2
|
||||
#define LOAD_FONT4
|
||||
#define LOAD_FONT6
|
||||
#define LOAD_FONT7
|
||||
#define LOAD_FONT8
|
||||
#define LOAD_GFXFF
|
||||
|
||||
#define SMOOTH_FONT
|
@ -35,7 +35,8 @@
|
||||
|
||||
// Tell the library to use 8 bit parallel mode (otherwise SPI is assumed)
|
||||
//#define TFT_PARALLEL_8_BIT
|
||||
|
||||
//#define TFT_PARALLEL_16_BIT // **** 16 bit parallel ONLY with RP2040 processor ****
|
||||
|
||||
// Display type - only define if RPi display
|
||||
//#define RPI_DISPLAY_TYPE // 20MHz maximum SPI
|
||||
|
||||
|
@ -2,9 +2,19 @@
|
||||
// This example renders a png file that is stored in a FLASH array
|
||||
// using the PNGdec library (available via library manager).
|
||||
|
||||
// Image files can be converted to arrays using the tool here:
|
||||
// https://notisrac.github.io/FileToCArray/
|
||||
// To use this tool:
|
||||
// 1. Drag and drop file on "Browse..." button
|
||||
// 2. Tick box "Treat as binary"
|
||||
// 3. Click "Convert"
|
||||
// 4. Click "Save as file" and move the header file to sketch folder
|
||||
// 5. Open the sketch in IDE
|
||||
// 6. Include the header file containing the array (panda.h in this example)
|
||||
|
||||
// Include the PNG decoder library
|
||||
#include <PNGdec.h>
|
||||
#include "panda_png.h" // Image is stored here in an 8 bit array
|
||||
#include "panda.h" // Image is stored here in an 8 bit array
|
||||
|
||||
PNG png; // PNG decoder inatance
|
||||
|
||||
@ -38,7 +48,7 @@ void setup()
|
||||
//====================================================================================
|
||||
void loop()
|
||||
{
|
||||
int16_t rc = png.openFLASH((uint8_t *)panda_png, sizeof(panda_png), pngDraw);
|
||||
int16_t rc = png.openFLASH((uint8_t *)panda, sizeof(panda), pngDraw);
|
||||
if (rc == PNG_SUCCESS) {
|
||||
Serial.println("Successfully png file");
|
||||
Serial.printf("image specs: (%d x %d), %d bpp, pixel type: %d\n", png.getWidth(), png.getHeight(), png.getBpp(), png.getPixelType());
|
||||
|
11425
examples/PNG Images/Flash_PNG/panda.h
Normal file
11425
examples/PNG Images/Flash_PNG/panda.h
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "TFT_eSPI",
|
||||
"version": "2.4.61",
|
||||
"version": "2.4.70",
|
||||
"keywords": "Arduino, tft, display, ttgo, LilyPi, WT32-SC01, ePaper, display, Pico, RP2040 Nano Connect, RP2040, STM32, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9481, ILI9486, ILI9488, ST7789, ST7796, RM68140, SSD1351, SSD1963, ILI9225, HX8357D, GC9A01, R61581",
|
||||
"description": "A TFT and ePaper SPI graphics library with optimisation for Raspberry Pi Pico, RP2040, ESP8266, ESP32 and STM32",
|
||||
"repository":
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=TFT_eSPI
|
||||
version=2.4.61
|
||||
version=2.4.70
|
||||
author=Bodmer
|
||||
maintainer=Bodmer
|
||||
sentence=TFT graphics library for Arduino processors with performance optimisation for RP2040, STM32, ESP8266 and ESP32
|
||||
|
Reference in New Issue
Block a user