mirror of
https://github.com/Bodmer/TFT_eSPI.git
synced 2025-08-12 17:14:49 +02:00
Correct various inconsequential typos
This commit is contained in:
@@ -140,7 +140,7 @@ void computeCA() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the Moore neighborhood
|
// Check the Moore neighbourhood
|
||||||
int getNumberOfNeighbors(int x, int y) {
|
int getNumberOfNeighbors(int x, int y) {
|
||||||
return grid[x - 1][y] + grid[x - 1][y - 1] + grid[x][y - 1] + grid[x + 1][y - 1] + grid[x + 1][y] + grid[x + 1][y + 1] + grid[x][y + 1] + grid[x - 1][y + 1];
|
return grid[x - 1][y] + grid[x - 1][y - 1] + grid[x][y - 1] + grid[x + 1][y - 1] + grid[x + 1][y] + grid[x + 1][y + 1] + grid[x][y + 1] + grid[x - 1][y + 1];
|
||||||
}
|
}
|
||||||
|
@@ -134,7 +134,7 @@ void computeCA() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the Moore neighborhood
|
// Check the Moore neighbourhood
|
||||||
int getNumberOfNeighbors(int x, int y) {
|
int getNumberOfNeighbors(int x, int y) {
|
||||||
return grid[x - 1][y] + grid[x - 1][y - 1] + grid[x][y - 1] + grid[x + 1][y - 1] + grid[x + 1][y] + grid[x + 1][y + 1] + grid[x][y + 1] + grid[x - 1][y + 1];
|
return grid[x - 1][y] + grid[x - 1][y - 1] + grid[x][y - 1] + grid[x + 1][y - 1] + grid[x + 1][y] + grid[x + 1][y + 1] + grid[x][y + 1] + grid[x - 1][y + 1];
|
||||||
}
|
}
|
||||||
|
@@ -134,7 +134,7 @@ void computeCA() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the Moore neighborhood
|
// Check the Moore neighbourhood
|
||||||
int getNumberOfNeighbors(int x, int y) {
|
int getNumberOfNeighbors(int x, int y) {
|
||||||
return grid[x - 1][y] + grid[x - 1][y - 1] + grid[x][y - 1] + grid[x + 1][y - 1] + grid[x + 1][y] + grid[x + 1][y + 1] + grid[x][y + 1] + grid[x - 1][y + 1];
|
return grid[x - 1][y] + grid[x - 1][y - 1] + grid[x][y - 1] + grid[x + 1][y - 1] + grid[x + 1][y] + grid[x + 1][y + 1] + grid[x][y + 1] + grid[x - 1][y + 1];
|
||||||
}
|
}
|
||||||
|
@@ -84,7 +84,7 @@ void setup() {
|
|||||||
|
|
||||||
fact = 180 / 3.14159259; // conversion from degrees to radians.
|
fact = 180 / 3.14159259; // conversion from degrees to radians.
|
||||||
|
|
||||||
Xoff = 240; // Position the center of the 3d conversion space into the center of the TFT screen.
|
Xoff = 240; // Position the centre of the 3d conversion space into the centre of the TFT screen.
|
||||||
Yoff = 160;
|
Yoff = 160;
|
||||||
Zoff = 550; // Z offset in 3D space (smaller = closer and bigger rendering)
|
Zoff = 550; // Z offset in 3D space (smaller = closer and bigger rendering)
|
||||||
}
|
}
|
||||||
@@ -241,7 +241,7 @@ void ProcessLine(struct Line2d *ret, struct Line3d vec)
|
|||||||
ret->p1.x = rx2;
|
ret->p1.x = rx2;
|
||||||
ret->p1.y = ry2;
|
ret->p1.y = ry2;
|
||||||
}
|
}
|
||||||
// The ifs here are checks for out of bounds. needs a bit more code here to "safe" lines that will be way out of whack, so they dont get drawn and cause screen garbage.
|
// The ifs here are checks for out of bounds. needs a bit more code here to "safe" lines that will be way out of whack, so they don't get drawn and cause screen garbage.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -33,12 +33,12 @@ String fps = "xx.xx fps";
|
|||||||
|
|
||||||
// Structure to hold circle plotting parameters
|
// Structure to hold circle plotting parameters
|
||||||
typedef struct circle_t {
|
typedef struct circle_t {
|
||||||
int16_t cx[CNUMBER] = { 0 }; // x coord of centre
|
int16_t cx[CNUMBER] = { 0 }; // x coordinate of centre
|
||||||
int16_t cy[CNUMBER] = { 0 }; // y coord of centre
|
int16_t cy[CNUMBER] = { 0 }; // y coordinate of centre
|
||||||
int16_t cr[CNUMBER] = { 0 }; // radius
|
int16_t cr[CNUMBER] = { 0 }; // radius
|
||||||
uint16_t col[CNUMBER] = { 0 }; // colour
|
uint16_t col[CNUMBER] = { 0 }; // colour
|
||||||
int16_t dx[CNUMBER] = { 0 }; // x movment & direction
|
int16_t dx[CNUMBER] = { 0 }; // x movement & direction
|
||||||
int16_t dy[CNUMBER] = { 0 }; // y movment & direction
|
int16_t dy[CNUMBER] = { 0 }; // y movement & direction
|
||||||
} circle_param;
|
} circle_param;
|
||||||
|
|
||||||
// Create the structure and get a pointer to it
|
// Create the structure and get a pointer to it
|
||||||
|
@@ -4,9 +4,9 @@
|
|||||||
If needed, first resize and crop to an appropriate width and height
|
If needed, first resize and crop to an appropriate width and height
|
||||||
to suit your display with an image editing program such as IrfanView.
|
to suit your display with an image editing program such as IrfanView.
|
||||||
|
|
||||||
You can also change the image "guality" to reduce the file size.
|
You can also change the image "quality" to reduce the file size.
|
||||||
|
|
||||||
Paste the array into a new tabe, top and tail the array from the
|
Paste the array into a new tab, top and tail the array from the
|
||||||
tool to look like the one below with:
|
tool to look like the one below with:
|
||||||
|
|
||||||
const uint8_t name[] PROGMEM = {
|
const uint8_t name[] PROGMEM = {
|
||||||
|
@@ -56,7 +56,7 @@ TFT_eSprite spr[2] = {TFT_eSprite(&tft), TFT_eSprite(&tft) };
|
|||||||
// Toggle buffer selection
|
// Toggle buffer selection
|
||||||
bool sprSel = 0;
|
bool sprSel = 0;
|
||||||
|
|
||||||
// Pointers to start of Sprties in RAM
|
// Pointers to start of Sprites in RAM
|
||||||
uint16_t* sprPtr[2];
|
uint16_t* sprPtr[2];
|
||||||
|
|
||||||
// Define the cube face colors
|
// Define the cube face colors
|
||||||
@@ -305,7 +305,7 @@ void drawCube()
|
|||||||
p2y[i] = IHEIGHT / 2 + ay[i] * CUBE_SIZE / az[i];
|
p2y[i] = IHEIGHT / 2 + ay[i] * CUBE_SIZE / az[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill the buffer with color 0 (Black)
|
// Fill the buffer with colour 0 (Black)
|
||||||
spr[sprSel].fillSprite(TFT_BLACK);
|
spr[sprSel].fillSprite(TFT_BLACK);
|
||||||
|
|
||||||
for (int i = 0; i < 12; i++) {
|
for (int i = 0; i < 12; i++) {
|
||||||
|
@@ -39,7 +39,7 @@ TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
|
|||||||
#define RED 0xF800
|
#define RED 0xF800
|
||||||
#define WHITE 0xFFFF
|
#define WHITE 0xFFFF
|
||||||
|
|
||||||
#define YBOTTOM 123 // Ball Y coord at bottom
|
#define YBOTTOM 123 // Ball Y coordinate at bottom
|
||||||
#define YBOUNCE -3.5 // Upward velocity on ball bounce
|
#define YBOUNCE -3.5 // Upward velocity on ball bounce
|
||||||
|
|
||||||
// Ball coordinates are stored floating-point because screen refresh
|
// Ball coordinates are stored floating-point because screen refresh
|
||||||
@@ -49,7 +49,7 @@ float ballx = 20.0, bally = YBOTTOM, // Current ball position
|
|||||||
ballframe = 3; // Ball animation frame #
|
ballframe = 3; // Ball animation frame #
|
||||||
int balloldx = ballx, balloldy = bally; // Prior ball position
|
int balloldx = ballx, balloldy = bally; // Prior ball position
|
||||||
|
|
||||||
// Working buffer for ball rendering...2 scanlines that alternate,
|
// Working buffer for ball rendering...2 scan lines that alternate,
|
||||||
// one is rendered while the other is transferred via DMA.
|
// one is rendered while the other is transferred via DMA.
|
||||||
uint16_t renderbuf[2][SCREENWIDTH];
|
uint16_t renderbuf[2][SCREENWIDTH];
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ void setup() {
|
|||||||
tft.begin();
|
tft.begin();
|
||||||
tft.setRotation(3); // Landscape orientation, USB at bottom right
|
tft.setRotation(3); // Landscape orientation, USB at bottom right
|
||||||
tft.setSwapBytes(false);
|
tft.setSwapBytes(false);
|
||||||
// Draw initial framebuffer contents:
|
// Draw initial frame buffer contents:
|
||||||
//tft.setBitmapColor(GRIDCOLOR, BGCOLOR);
|
//tft.setBitmapColor(GRIDCOLOR, BGCOLOR);
|
||||||
tft.fillScreen(BGCOLOR);
|
tft.fillScreen(BGCOLOR);
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ void loop() {
|
|||||||
(by >= 0) && (by < BALLHEIGHT)) { // inside the ball bitmap area?
|
(by >= 0) && (by < BALLHEIGHT)) { // inside the ball bitmap area?
|
||||||
// Yes, do ball compositing math...
|
// Yes, do ball compositing math...
|
||||||
p = ball[by][bx1 / 2]; // Get packed value (2 pixels)
|
p = ball[by][bx1 / 2]; // Get packed value (2 pixels)
|
||||||
c = (bx1 & 1) ? (p & 0xF) : (p >> 4); // Unpack high or low nybble
|
c = (bx1 & 1) ? (p & 0xF) : (p >> 4); // Unpack high or low nibble
|
||||||
if(c == 0) { // Outside ball - just draw grid
|
if(c == 0) { // Outside ball - just draw grid
|
||||||
c = background[bgy][bgx1 / 8] & (0x80 >> (bgx1 & 7)) ? GRIDCOLOR : BGCOLOR;
|
c = background[bgy][bgx1 / 8] & (0x80 >> (bgx1 & 7)) ? GRIDCOLOR : BGCOLOR;
|
||||||
} else if(c > 1) { // In ball area...
|
} else if(c > 1) { // In ball area...
|
||||||
@@ -155,7 +155,7 @@ void loop() {
|
|||||||
} else { // Outside ball bitmap, just draw background bitmap...
|
} else { // Outside ball bitmap, just draw background bitmap...
|
||||||
c = background[bgy][bgx1 / 8] & (0x80 >> (bgx1 & 7)) ? GRIDCOLOR : BGCOLOR;
|
c = background[bgy][bgx1 / 8] & (0x80 >> (bgx1 & 7)) ? GRIDCOLOR : BGCOLOR;
|
||||||
}
|
}
|
||||||
*destPtr++ = c<<8 | c>>8; // Store pixel color
|
*destPtr++ = c<<8 | c>>8; // Store pixel colour
|
||||||
bx1++; // Increment bitmap position counters (X axis)
|
bx1++; // Increment bitmap position counters (X axis)
|
||||||
bgx1++;
|
bgx1++;
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,14 @@
|
|||||||
// An adaption of the "UncannyEyes" sketch (see eye_functions tab)
|
// An adaption of the "UncannyEyes" sketch (see eye_functions tab)
|
||||||
// for the TFT_eSPI library. As written the sketch is for driving
|
// for the TFT_eSPI library. As written the sketch is for driving
|
||||||
// one (240x320 minimum) TFT display, showing 2 eyes. See example
|
// one (240x320 minimum) TFT display, showing 2 eyes. See example
|
||||||
// Animated_Eyes_2 for a dual 128x128 TFT display configued sketch.
|
// Animated_Eyes_2 for a dual 128x128 TFT display configured sketch.
|
||||||
|
|
||||||
|
// The size of the displayed eye is determined by the screen size and
|
||||||
|
// resolution. The eye image is 128 pixels wide. In humans the palpebral
|
||||||
|
// fissure (open eye) width is about 30mm so a low resolution, large
|
||||||
|
// pixel size display works best to show a scale eye image. Note that
|
||||||
|
// display manufacturers usually quote the diagonal measurement, so a
|
||||||
|
// 128 x 128 1.7" display or 128 x 160 2" display is about right.
|
||||||
|
|
||||||
// Configuration settings for the eye, eye style, display count,
|
// Configuration settings for the eye, eye style, display count,
|
||||||
// chip selects and x offsets can be defined in the sketch "config.h" tab.
|
// chip selects and x offsets can be defined in the sketch "config.h" tab.
|
||||||
@@ -9,7 +16,7 @@
|
|||||||
// Performance (frames per second = fps) can be improved by using
|
// Performance (frames per second = fps) can be improved by using
|
||||||
// DMA (for SPI displays only) on ESP32 and STM32 processors. Use
|
// DMA (for SPI displays only) on ESP32 and STM32 processors. Use
|
||||||
// as high a SPI clock rate as is supported by the display. 27MHz
|
// as high a SPI clock rate as is supported by the display. 27MHz
|
||||||
// minimum, some diplays can be operated at higher clock rates in
|
// minimum, some displays can be operated at higher clock rates in
|
||||||
// the range 40-80MHz.
|
// the range 40-80MHz.
|
||||||
|
|
||||||
// Single defaultEye performance for different processors
|
// Single defaultEye performance for different processors
|
||||||
@@ -22,7 +29,7 @@
|
|||||||
// STM32F446 55MHz SPI 83 fps 155 fps
|
// STM32F446 55MHz SPI 83 fps 155 fps
|
||||||
// STM32F767 55MHz SPI 136 fps 197 fps
|
// STM32F767 55MHz SPI 136 fps 197 fps
|
||||||
|
|
||||||
// DMA can be used with STM32 and ESP32 processors when the interface
|
// DMA can be used with RP2040, STM32 and ESP32 processors when the interface
|
||||||
// is SPI, uncomment the next line:
|
// is SPI, uncomment the next line:
|
||||||
//#define USE_DMA
|
//#define USE_DMA
|
||||||
|
|
||||||
@@ -95,7 +102,7 @@ void setup(void) {
|
|||||||
// User call for additional features
|
// User call for additional features
|
||||||
user_setup();
|
user_setup();
|
||||||
|
|
||||||
// Initialiase the eye(s), this will set all chip selects low for the tft.init()
|
// Initialise the eye(s), this will set all chip selects low for the tft.init()
|
||||||
initEyes();
|
initEyes();
|
||||||
|
|
||||||
// Initialise TFT
|
// Initialise TFT
|
||||||
|
@@ -2,6 +2,13 @@
|
|||||||
// for the TFT_eSPI library. As written the sketch is for driving
|
// for the TFT_eSPI library. As written the sketch is for driving
|
||||||
// two TFT displays.
|
// two TFT displays.
|
||||||
|
|
||||||
|
// The size of the displayed eye is determined by the screen size and
|
||||||
|
// resolution. The eye image is 128 pixels wide. In humans the palpebral
|
||||||
|
// fissure (open eye) width is about 30mm so a low resolution, large
|
||||||
|
// pixel size display works best to show a scale eye image. Note that
|
||||||
|
// display manufacturers usually quote the diagonal measurement, so a
|
||||||
|
// 128 x 128 1.7" display or 128 x 160 2" display is about right.
|
||||||
|
|
||||||
// The number of displays and chip selects used are defined in the
|
// The number of displays and chip selects used are defined in the
|
||||||
// config.h tab. The display count can be set to 1. If using one
|
// config.h tab. The display count can be set to 1. If using one
|
||||||
// TFT and the chip select for that display is already defined in
|
// TFT and the chip select for that display is already defined in
|
||||||
@@ -17,7 +24,7 @@
|
|||||||
// Performance (frames per second = fps) can be improved by using
|
// Performance (frames per second = fps) can be improved by using
|
||||||
// DMA (for SPI displays only) on ESP32 and STM32 processors. Use
|
// DMA (for SPI displays only) on ESP32 and STM32 processors. Use
|
||||||
// as high a SPI clock rate as is supported by the display. 27MHz
|
// as high a SPI clock rate as is supported by the display. 27MHz
|
||||||
// minimum, some diplays can be operated at higher clock rates in
|
// minimum, some displays can be operated at higher clock rates in
|
||||||
// the range 40-80MHz.
|
// the range 40-80MHz.
|
||||||
|
|
||||||
// Single defaultEye performance for different processors
|
// Single defaultEye performance for different processors
|
||||||
@@ -30,7 +37,7 @@
|
|||||||
// STM32F446 55MHz SPI 83 fps 155 fps
|
// STM32F446 55MHz SPI 83 fps 155 fps
|
||||||
// STM32F767 55MHz SPI 136 fps 197 fps
|
// STM32F767 55MHz SPI 136 fps 197 fps
|
||||||
|
|
||||||
// DMA can be used with STM32 and ESP32 processors when the interface
|
// DMA can be used with RP2040, STM32 and ESP32 processors when the interface
|
||||||
// is SPI, uncomment the next line:
|
// is SPI, uncomment the next line:
|
||||||
//#define USE_DMA
|
//#define USE_DMA
|
||||||
|
|
||||||
@@ -103,7 +110,7 @@ void setup(void) {
|
|||||||
// User call for additional features
|
// User call for additional features
|
||||||
user_setup();
|
user_setup();
|
||||||
|
|
||||||
// Initialiase the eye(s), this will set all chip selects low for the tft.init()
|
// Initialise the eye(s), this will set all chip selects low for the tft.init()
|
||||||
initEyes();
|
initEyes();
|
||||||
|
|
||||||
// Initialise TFT
|
// Initialise TFT
|
||||||
|
@@ -8,9 +8,9 @@
|
|||||||
// To do, maybe, one day:
|
// To do, maybe, one day:
|
||||||
// 1. Get the eye to blink
|
// 1. Get the eye to blink
|
||||||
// 2. Add another screen for another eye
|
// 2. Add another screen for another eye
|
||||||
// 3. Add varaible to set how wide open the eye is
|
// 3. Add variable to set how wide open the eye is
|
||||||
// 4. Add a reflected highlight to the cornea
|
// 4. Add a reflected highlight to the cornea
|
||||||
// 5. Add top eyelid shaddow to eye surface
|
// 5. Add top eyelid shadow to eye surface
|
||||||
// 6. Add aliasing to blur mask edge
|
// 6. Add aliasing to blur mask edge
|
||||||
//
|
//
|
||||||
// With one lidded eye drawn the code runs at 28-33fps (at 27-40MHz SPI clock)
|
// With one lidded eye drawn the code runs at 28-33fps (at 27-40MHz SPI clock)
|
||||||
@@ -58,8 +58,8 @@
|
|||||||
|
|
||||||
// The ESP8266 is rather constrained here as it only has one analogue port.
|
// The ESP8266 is rather constrained here as it only has one analogue port.
|
||||||
// An I2C ADC could be used for more analogue channels
|
// An I2C ADC could be used for more analogue channels
|
||||||
//#define JOYSTICK_X_PIN A0 // Analog pin for eye horiz pos (else auto)
|
//#define JOYSTICK_X_PIN A0 // Analogue pin for eye horiz pos (else auto)
|
||||||
//#define JOYSTICK_Y_PIN A0 // Analog pin for eye vert position (")
|
//#define JOYSTICK_Y_PIN A0 // Analogue pin for eye vert position (")
|
||||||
//#define JOYSTICK_X_FLIP // If set, reverse stick X axis
|
//#define JOYSTICK_X_FLIP // If set, reverse stick X axis
|
||||||
//#define JOYSTICK_Y_FLIP // If set, reverse stick Y axis
|
//#define JOYSTICK_Y_FLIP // If set, reverse stick Y axis
|
||||||
#define TRACKING // If enabled, eyelid tracks pupil
|
#define TRACKING // If enabled, eyelid tracks pupil
|
||||||
@@ -107,7 +107,7 @@ void setup(void) {
|
|||||||
uint8_t e = 0;
|
uint8_t e = 0;
|
||||||
|
|
||||||
Serial.begin(250000);
|
Serial.begin(250000);
|
||||||
randomSeed(analogRead(A0)); // Seed random() from floating analog input
|
randomSeed(analogRead(A0)); // Seed random() from floating analogue input
|
||||||
|
|
||||||
eye[e].tft.init();
|
eye[e].tft.init();
|
||||||
eye[e].tft.fillScreen(TFT_BLACK);
|
eye[e].tft.fillScreen(TFT_BLACK);
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
https://playground.arduino.cc/Code/UTF-8
|
https://playground.arduino.cc/Code/UTF-8
|
||||||
|
|
||||||
To sumarise, UTF-8 characters are encoded as mor than 1 byte so care must
|
To summarise, UTF-8 characters are encoded as more than 1 byte so care must
|
||||||
be taken:
|
be taken:
|
||||||
|
|
||||||
char c = 'µ'; // Wrong
|
char c = 'µ'; // Wrong
|
||||||
|
@@ -19,7 +19,7 @@
|
|||||||
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
|
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
|
||||||
|
|
||||||
// This is the file name used to store the touch coordinate
|
// This is the file name used to store the touch coordinate
|
||||||
// calibration data. Cahnge the name to start a new calibration.
|
// calibration data. Change the name to start a new calibration.
|
||||||
#define CALIBRATION_FILE "/TouchCalData3"
|
#define CALIBRATION_FILE "/TouchCalData3"
|
||||||
|
|
||||||
// Set REPEAT_CAL to true instead of false to run calibration
|
// Set REPEAT_CAL to true instead of false to run calibration
|
||||||
@@ -115,7 +115,7 @@ void touch_calibrate()
|
|||||||
|
|
||||||
// check file system exists
|
// check file system exists
|
||||||
if (!SPIFFS.begin()) {
|
if (!SPIFFS.begin()) {
|
||||||
Serial.println("Formating file system");
|
Serial.println("Formatting file system");
|
||||||
SPIFFS.format();
|
SPIFFS.format();
|
||||||
SPIFFS.begin();
|
SPIFFS.begin();
|
||||||
}
|
}
|
||||||
|
@@ -133,7 +133,7 @@ void touch_calibrate()
|
|||||||
|
|
||||||
// check file system exists
|
// check file system exists
|
||||||
if (!SPIFFS.begin()) {
|
if (!SPIFFS.begin()) {
|
||||||
Serial.println("Formating file system");
|
Serial.println("Formatting file system");
|
||||||
SPIFFS.format();
|
SPIFFS.format();
|
||||||
SPIFFS.begin();
|
SPIFFS.begin();
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
// Bodmers BMP image rendering function
|
// Bodmer's BMP image rendering function
|
||||||
|
|
||||||
void drawBmp(const char *filename, int16_t x, int16_t y) {
|
void drawBmp(const char *filename, int16_t x, int16_t y) {
|
||||||
|
|
||||||
|
@@ -87,7 +87,7 @@ void loop() {
|
|||||||
// The new larger fonts do not need to use the .setCursor call, coords are embedded
|
// The new larger fonts do not need to use the .setCursor call, coords are embedded
|
||||||
tft.setTextColor(TFT_BLACK); // Do not plot the background colour
|
tft.setTextColor(TFT_BLACK); // Do not plot the background colour
|
||||||
|
|
||||||
// Overlay the black text on top of the rainbow plot (the advantage of not drawing the backgorund colour!)
|
// Overlay the black text on top of the rainbow plot (the advantage of not drawing the background colour!)
|
||||||
tft.drawString("Font size 2", xpos, 14, 2); // Draw text centre at position xpos, 14 using font 2
|
tft.drawString("Font size 2", xpos, 14, 2); // Draw text centre at position xpos, 14 using font 2
|
||||||
tft.drawString("Font size 4", xpos, 30, 4); // Draw text centre at position xpos, 30 using font 4
|
tft.drawString("Font size 4", xpos, 30, 4); // Draw text centre at position xpos, 30 using font 4
|
||||||
tft.drawString("12.34", xpos, 54, 6); // Draw text centre at position xpos, 54 using font 6
|
tft.drawString("12.34", xpos, 54, 6); // Draw text centre at position xpos, 54 using font 6
|
||||||
@@ -150,7 +150,7 @@ void loop() {
|
|||||||
// Fill screen with a rainbow pattern
|
// Fill screen with a rainbow pattern
|
||||||
void rainbow_fill()
|
void rainbow_fill()
|
||||||
{
|
{
|
||||||
// The colours and state are not initialised so the start colour changes each time the funtion is called
|
// The colours and state are not initialised so the start colour changes each time the function is called
|
||||||
int rotation = tft.getRotation();
|
int rotation = tft.getRotation();
|
||||||
tft.setRotation(random(4));
|
tft.setRotation(random(4));
|
||||||
for (int i = tft.height() - 1; i >= 0; i--) {
|
for (int i = tft.height() - 1; i >= 0; i--) {
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
int32_t h = tft.getViewportHeight(); // Always returns height of viewport
|
int32_t h = tft.getViewportHeight(); // Always returns height of viewport
|
||||||
bool f = tft.getViewportDatum(); // Datum of the viewport (false = TFT corner, true = viewport corner)
|
bool f = tft.getViewportDatum(); // Datum of the viewport (false = TFT corner, true = viewport corner)
|
||||||
// To check if all or part of an area is in the viewport
|
// To check if all or part of an area is in the viewport
|
||||||
checkViewport(x, y, w, h); // Retruns "true" if all or part of area is in viewport
|
checkViewport(x, y, w, h); // Returns "true" if all or part of area is in viewport
|
||||||
|
|
||||||
// To draw a rectangular frame outside viewport of width W (when W is negative)
|
// To draw a rectangular frame outside viewport of width W (when W is negative)
|
||||||
tft.frameViewport(TFT_RED, -W); // Note setting the width to a large negative value will clear the screen
|
tft.frameViewport(TFT_RED, -W); // Note setting the width to a large negative value will clear the screen
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
This tests the alpha blending function that is used with the antialiased
|
This tests the alpha blending function that is used with the anti-aliased
|
||||||
fonts:
|
fonts:
|
||||||
|
|
||||||
Alpha = 0 = 100% background, alpha = 255 = 100% foreground colour
|
Alpha = 0 = 100% background, alpha = 255 = 100% foreground colour
|
||||||
|
@@ -144,7 +144,7 @@ void loop() {
|
|||||||
// Mono spaced font
|
// Mono spaced font
|
||||||
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||||
|
|
||||||
spr.loadFont(AA_FONT_MONO); // Mono spaced fonts have fixed intercharacter gaps to
|
spr.loadFont(AA_FONT_MONO); // Mono spaced fonts have fixed inter-character gaps to
|
||||||
// aid formatting
|
// aid formatting
|
||||||
int bnum = 1;
|
int bnum = 1;
|
||||||
|
|
||||||
|
@@ -58,7 +58,7 @@ void setup(void) {
|
|||||||
|
|
||||||
tft.setRotation(1);
|
tft.setRotation(1);
|
||||||
|
|
||||||
spr.setColorDepth(16); // 16 bit colour needed to show antialiased fonts
|
spr.setColorDepth(16); // 16 bit colour needed to show anti-aliased fonts
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
@@ -11,10 +11,10 @@
|
|||||||
The library supports 16 bit unicode characters:
|
The library supports 16 bit unicode characters:
|
||||||
https://en.wikipedia.org/wiki/Unicode_font
|
https://en.wikipedia.org/wiki/Unicode_font
|
||||||
|
|
||||||
The characters supported are in the in the Basic Multilingal Plane:
|
The characters supported are in the in the Basic Multilingual Plane:
|
||||||
https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_Multilingual_Plane
|
https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_Multilingual_Plane
|
||||||
|
|
||||||
Make sure all the display driver and pin connenctions are correct by
|
Make sure all the display driver and pin connections are correct by
|
||||||
editing the User_Setup.h file in the TFT_eSPI library folder.
|
editing the User_Setup.h file in the TFT_eSPI library folder.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
This sketch uses Smooth fonts stored in FLASH program memory. It uses a method
|
This sketch uses Smooth fonts stored in FLASH program memory. It uses a method
|
||||||
for rendering anti-aliased fonts on a graded background. This is acheived by
|
for rendering anti-aliased fonts on a graded background. This is achieved by
|
||||||
telling the TFT_eSPI library the pixel color at each point on the screen. In
|
telling the TFT_eSPI library the pixel color at each point on the screen. In
|
||||||
this sketch a background colour gradient is drawn, the color of each pixel can
|
this sketch a background colour gradient is drawn, the color of each pixel can
|
||||||
therefore be determined by a function. The TFT does not need to support reading
|
therefore be determined by a function. The TFT does not need to support reading
|
||||||
@@ -74,7 +74,7 @@ void setup(void) {
|
|||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|
||||||
// Select a font size comensurate with screen size
|
// Select a font size commensurate with screen size
|
||||||
if (tft.width()>= 320)
|
if (tft.width()>= 320)
|
||||||
tft.loadFont(AA_FONT_LARGE);
|
tft.loadFont(AA_FONT_LARGE);
|
||||||
else
|
else
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
This sketch uses Smooth fonts stored in FLASH program memory. It uses a method
|
This sketch uses Smooth fonts stored in FLASH program memory. It uses a method
|
||||||
for rendering anti-aliased fonts on an arbitrary background. This is acheived
|
for rendering anti-aliased fonts on an arbitrary background. This is achieved
|
||||||
by reading the pixel color at each point on the screen. The TFT must support
|
by reading the pixel color at each point on the screen. The TFT must support
|
||||||
reading the graphics RAM of the screen memory. This sketch has been tested with
|
reading the graphics RAM of the screen memory. This sketch has been tested with
|
||||||
ILI9241 and ILI9481 serial and parallel screens.
|
ILI9241 and ILI9481 serial and parallel screens.
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
String okay = "5µA"; // Good
|
String okay = "5µA"; // Good
|
||||||
|
|
||||||
This is because UTF-8 characters outside the basic Latin set occupy more than
|
This is because UTF-8 characters outside the basic Latin set occupy more than
|
||||||
1 byte per character! A 16 bit unicode character occupies 3 bytes!
|
1 byte per character! A 16 bit Unicode character occupies 3 bytes!
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
This sketch uses method 3, the font characters are first plotted in a Sprite, then the
|
This sketch uses method 3, the font characters are first plotted in a Sprite, then the
|
||||||
Sprite is pushed to the screen. This method is very flexible and the Sprite can be
|
Sprite is pushed to the screen. This method is very flexible and the Sprite can be
|
||||||
created, deleted, resized as needed. To render anit-aliased fonts well the Sprite
|
created, deleted, resized as needed. To render anti-aliased fonts well the Sprite
|
||||||
needs to be 16 bit. The fonts will render in 1 bit per pixel sprites but there
|
needs to be 16 bit. The fonts will render in 1 bit per pixel sprites but there
|
||||||
will then be no anti-aliasing. Using 1 bit per pixel Sprites is however useful
|
will then be no anti-aliasing. Using 1 bit per pixel Sprites is however useful
|
||||||
to use the extended Unicode range in fonts on mono displays like ePaper.
|
to use the extended Unicode range in fonts on mono displays like ePaper.
|
||||||
@@ -112,7 +112,7 @@ void loop() {
|
|||||||
|
|
||||||
tft.fillScreen(TFT_BLACK);
|
tft.fillScreen(TFT_BLACK);
|
||||||
|
|
||||||
// Beware: Sprites are a differerent "class" to TFT, so different fonts can be loaded
|
// Beware: Sprites are a different "class" to TFT, so different fonts can be loaded
|
||||||
// in the tft and sprite instances, so load the font in the class instance you use!
|
// in the tft and sprite instances, so load the font in the class instance you use!
|
||||||
// In this example this means the spr. instance.
|
// In this example this means the spr. instance.
|
||||||
|
|
||||||
@@ -163,7 +163,7 @@ void loop() {
|
|||||||
// Mono spaced font
|
// Mono spaced font
|
||||||
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||||
|
|
||||||
spr.loadFont(AA_FONT_MONO, LittleFS); // Mono spaced fonts have fixed intercharacter gaps to
|
spr.loadFont(AA_FONT_MONO, LittleFS); // Mono spaced fonts have fixed inter-character gaps to
|
||||||
// aid formatting
|
// aid formatting
|
||||||
int bnum = 1;
|
int bnum = 1;
|
||||||
|
|
||||||
|
@@ -61,7 +61,7 @@ void setup(void) {
|
|||||||
|
|
||||||
tft.setRotation(1);
|
tft.setRotation(1);
|
||||||
|
|
||||||
spr.setColorDepth(16); // 16 bit colour needed to show antialiased fonts
|
spr.setColorDepth(16); // 16 bit colour needed to show anti-aliased fonts
|
||||||
|
|
||||||
if (!LittleFS.begin()) {
|
if (!LittleFS.begin()) {
|
||||||
Serial.println("Flash FS initialisation failed!");
|
Serial.println("Flash FS initialisation failed!");
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
Sketch to demonstrate using the print class with smooth fonts
|
Sketch to demonstrate using the print class with smooth fonts
|
||||||
|
|
||||||
Sketch is writtent for a 240 x 320 display
|
Sketch is written for a 240 x 320 display
|
||||||
|
|
||||||
// Upload the fonts and icons to LittleFS (must set at least 1M for LittleFS) using the
|
// Upload the fonts and icons to LittleFS (must set at least 1M for LittleFS) using the
|
||||||
// "Tools" "ESP8266 LittleFS Data Upload" menu option in the IDE.
|
// "Tools" "ESP8266 LittleFS Data Upload" menu option in the IDE.
|
||||||
@@ -12,13 +12,13 @@
|
|||||||
sketch in the library Tools folder. The Processing sketch can convert
|
sketch in the library Tools folder. The Processing sketch can convert
|
||||||
TrueType fonts in *.ttf or *.otf files.
|
TrueType fonts in *.ttf or *.otf files.
|
||||||
|
|
||||||
The library supports 16 bit unicode characters:
|
The library supports 16 bit Unicode characters:
|
||||||
https://en.wikipedia.org/wiki/Unicode_font
|
https://en.wikipedia.org/wiki/Unicode_font
|
||||||
|
|
||||||
The characters supported are in the in the Basic Multilingal Plane:
|
The characters supported are in the in the Basic Multilingual Plane:
|
||||||
https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_Multilingual_Plane
|
https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_Multilingual_Plane
|
||||||
|
|
||||||
Make sure all the display driver and pin connenctions are correct by
|
Make sure all the display driver and pin connections are correct by
|
||||||
editing the User_Setup.h file in the TFT_eSPI library folder.
|
editing the User_Setup.h file in the TFT_eSPI library folder.
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
This sketch is based on Font Demo 1. It introduces a method for rendering
|
This sketch is based on Font Demo 1. It introduces a method for rendering
|
||||||
anti-aliased fonts on a graded background. This is acheived by telling the
|
anti-aliased fonts on a graded background. This is achieved by telling the
|
||||||
TFT_eSPI library the pixel color at each point on the screen. In this sketch
|
TFT_eSPI library the pixel color at each point on the screen. In this sketch
|
||||||
a graded background is drawn, the color of each pixel can therefore be
|
a graded background is drawn, the color of each pixel can therefore be
|
||||||
determined. The TFT does not need to support reading of the graphics memory.
|
determined. The TFT does not need to support reading of the graphics memory.
|
||||||
@@ -99,7 +99,7 @@ void setup(void) {
|
|||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|
||||||
// Select a font size comensurate with screen size
|
// Select a font size commensurate with screen size
|
||||||
if (tft.width()>= 320)
|
if (tft.width()>= 320)
|
||||||
tft.loadFont(AA_FONT_LARGE, LittleFS);
|
tft.loadFont(AA_FONT_LARGE, LittleFS);
|
||||||
else
|
else
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
This sketch is based on Font Demo 1. It introduces a method for rendering
|
This sketch is based on Font Demo 1. It introduces a method for rendering
|
||||||
anti-aliased fonts on an arbitrary background. This is acheived by reading
|
anti-aliased fonts on an arbitrary background. This is achieved by reading
|
||||||
the pixel color at each point on the screen. The TFT must support reading
|
the pixel color at each point on the screen. The TFT must support reading
|
||||||
the graphics RAM of the screen memory. This sketch has been tested with
|
the graphics RAM of the screen memory. This sketch has been tested with
|
||||||
ILI9241 and ILI9481 serial and parallel screens. Other screens may or may
|
ILI9241 and ILI9481 serial and parallel screens. Other screens may or may
|
||||||
@@ -52,7 +52,7 @@ void setup(void) {
|
|||||||
|
|
||||||
tft.begin();
|
tft.begin();
|
||||||
|
|
||||||
tft.setCallback(pixelColor); // The callback is only used durung font rendering
|
tft.setCallback(pixelColor); // The callback is only used during font rendering
|
||||||
//tft.setCallback(nullptr); // Switch off callback (off by default)
|
//tft.setCallback(nullptr); // Switch off callback (off by default)
|
||||||
|
|
||||||
tft.setRotation(1);
|
tft.setRotation(1);
|
||||||
@@ -110,7 +110,7 @@ unsigned int colour = red << 11; // Colour order is RGB 5+6+5 bits each
|
|||||||
|
|
||||||
void rainbow_fill()
|
void rainbow_fill()
|
||||||
{
|
{
|
||||||
// The colours and state are not initialised so the start colour changes each time the funtion is called
|
// The colours and state are not initialised so the start colour changes each time the function is called
|
||||||
|
|
||||||
for (int i = 319; i >= 0; i--) {
|
for (int i = 319; i >= 0; i--) {
|
||||||
// Draw a vertical line 1 pixel wide in the selected colour
|
// Draw a vertical line 1 pixel wide in the selected colour
|
||||||
|
@@ -8,14 +8,14 @@
|
|||||||
The library expects strings to be in UTF-8 encoded format:
|
The library expects strings to be in UTF-8 encoded format:
|
||||||
https://www.fileformat.info/info/unicode/utf8.htm
|
https://www.fileformat.info/info/unicode/utf8.htm
|
||||||
|
|
||||||
Creating varaibles needs to be done with care when using character arrays:
|
Creating variables needs to be done with care when using character arrays:
|
||||||
char c = 'µ'; // Wrong
|
char c = 'µ'; // Wrong
|
||||||
char bad[4] = "5µA"; // Wrong
|
char bad[4] = "5µA"; // Wrong
|
||||||
char good[] = "5µA"; // Good
|
char good[] = "5µA"; // Good
|
||||||
String okay = "5µA"; // Good
|
String okay = "5µA"; // Good
|
||||||
|
|
||||||
This is because UTF-8 characters outside the basic Latin set occupy more than
|
This is because UTF-8 characters outside the basic Latin set occupy more than
|
||||||
1 byte per character! A 16 bit unicode character occupies 3 bytes!
|
1 byte per character! A 16 bit Unicode character occupies 3 bytes!
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@@ -10,13 +10,13 @@
|
|||||||
Load the font file onto the root directory of the SD Card. The font files
|
Load the font file onto the root directory of the SD Card. The font files
|
||||||
used by this sketch can be found in the Data folder, press Ctrl+K to see it.
|
used by this sketch can be found in the Data folder, press Ctrl+K to see it.
|
||||||
|
|
||||||
The library supports 16 bit unicode characters:
|
The library supports 16 bit Unicode characters:
|
||||||
https://en.wikipedia.org/wiki/Unicode_font
|
https://en.wikipedia.org/wiki/Unicode_font
|
||||||
|
|
||||||
The characters supported are in the in the Basic Multilingal Plane:
|
The characters supported are in the in the Basic Multilingual Plane:
|
||||||
https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_Multilingual_Plane
|
https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_Multilingual_Plane
|
||||||
|
|
||||||
Make sure all the display driver and pin connenctions are correct by
|
Make sure all the display driver and pin connections are correct by
|
||||||
editing the User_Setup.h file in the TFT_eSPI library folder.
|
editing the User_Setup.h file in the TFT_eSPI library folder.
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
|
@@ -32,7 +32,7 @@
|
|||||||
#define AA_FONT_SMALL "NotoSansBold15"
|
#define AA_FONT_SMALL "NotoSansBold15"
|
||||||
#define AA_FONT_LARGE "NotoSansBold36"
|
#define AA_FONT_LARGE "NotoSansBold36"
|
||||||
|
|
||||||
// Font files are stored in SPIFFS, so load the linbrary
|
// Font files are stored in SPIFFS, so load the library
|
||||||
#include <FS.h>
|
#include <FS.h>
|
||||||
|
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
This sketch uses method 3, the font characters are first plotted in a Sprite, then the
|
This sketch uses method 3, the font characters are first plotted in a Sprite, then the
|
||||||
Sprite is pushed to the screen. This method is very flexible and the Sprite can be
|
Sprite is pushed to the screen. This method is very flexible and the Sprite can be
|
||||||
created, deleted, resized as needed. To render anit-aliased fonts well the Sprite
|
created, deleted, resized as needed. To render anti-aliased fonts well the Sprite
|
||||||
needs to be 16 bit. The fonts will render in 1 bit per pixel sprites but there
|
needs to be 16 bit. The fonts will render in 1 bit per pixel sprites but there
|
||||||
will then be no anti-aliasing. Using 1 bit per pixel Sprites is however useful
|
will then be no anti-aliasing. Using 1 bit per pixel Sprites is however useful
|
||||||
to use the extended Unicode range in fonts on mono displays like ePaper.
|
to use the extended Unicode range in fonts on mono displays like ePaper.
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
#define AA_FONT_SMALL "NotoSansBold15"
|
#define AA_FONT_SMALL "NotoSansBold15"
|
||||||
#define AA_FONT_LARGE "NotoSansBold36"
|
#define AA_FONT_LARGE "NotoSansBold36"
|
||||||
#define AA_FONT_MONO "NotoSansMonoSCB20" // NotoSansMono-SemiCondensedBold 20pt
|
#define AA_FONT_MONO "NotoSansMonoSCB20" // NotoSansMono-SemiCondensedBold 20pt
|
||||||
// Font files are stored in SPIFFS, so load the linbrary
|
// Font files are stored in SPIFFS, so load the library
|
||||||
#include <FS.h>
|
#include <FS.h>
|
||||||
|
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
@@ -50,7 +50,7 @@ void setup(void) {
|
|||||||
|
|
||||||
tft.setRotation(1);
|
tft.setRotation(1);
|
||||||
|
|
||||||
spr.setColorDepth(16); // 16 bit colour needed to show antialiased fonts
|
spr.setColorDepth(16); // 16 bit colour needed to show anti aliased fonts
|
||||||
|
|
||||||
if (!SPIFFS.begin()) {
|
if (!SPIFFS.begin()) {
|
||||||
Serial.println("SPIFFS initialisation failed!");
|
Serial.println("SPIFFS initialisation failed!");
|
||||||
@@ -112,7 +112,7 @@ void loop() {
|
|||||||
|
|
||||||
tft.fillScreen(TFT_BLACK);
|
tft.fillScreen(TFT_BLACK);
|
||||||
|
|
||||||
// Beware: Sprites are a differerent "class" to TFT, so different fonts can be loaded
|
// Beware: Sprites are a different "class" to TFT, so different fonts can be loaded
|
||||||
// in the tft and sprite instances, so load the font in the class instance you use!
|
// in the tft and sprite instances, so load the font in the class instance you use!
|
||||||
// In this example this means the spr. instance.
|
// In this example this means the spr. instance.
|
||||||
|
|
||||||
@@ -163,7 +163,7 @@ void loop() {
|
|||||||
// Mono spaced font
|
// Mono spaced font
|
||||||
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||||
|
|
||||||
spr.loadFont(AA_FONT_MONO); // Mono spaced fonts have fixed intercharacter gaps to
|
spr.loadFont(AA_FONT_MONO); // Mono spaced fonts have fixed inter-character gaps to
|
||||||
// aid formatting
|
// aid formatting
|
||||||
int bnum = 1;
|
int bnum = 1;
|
||||||
|
|
||||||
|
@@ -44,7 +44,7 @@
|
|||||||
#define AA_FONT_SMALL "NotoSansBold15"
|
#define AA_FONT_SMALL "NotoSansBold15"
|
||||||
#define AA_FONT_LARGE "NotoSansBold36"
|
#define AA_FONT_LARGE "NotoSansBold36"
|
||||||
|
|
||||||
// Font files are stored in SPIFFS, so load the linbrary
|
// Font files are stored in SPIFFS, so load the library
|
||||||
#include <FS.h>
|
#include <FS.h>
|
||||||
|
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
@@ -61,7 +61,7 @@ void setup(void) {
|
|||||||
|
|
||||||
tft.setRotation(1);
|
tft.setRotation(1);
|
||||||
|
|
||||||
spr.setColorDepth(16); // 16 bit colour needed to show antialiased fonts
|
spr.setColorDepth(16); // 16 bit colour needed to show anti-aliased fonts
|
||||||
|
|
||||||
if (!SPIFFS.begin()) {
|
if (!SPIFFS.begin()) {
|
||||||
Serial.println("SPIFFS initialisation failed!");
|
Serial.println("SPIFFS initialisation failed!");
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
Sketch to demonstrate using the print class with smooth fonts
|
Sketch to demonstrate using the print class with smooth fonts
|
||||||
|
|
||||||
Sketch is writtent for a 240 x 320 display
|
Sketch is written for a 240 x 320 display
|
||||||
|
|
||||||
Load the font file into SPIFFS first by using the Arduino IDE
|
Load the font file into SPIFFS first by using the Arduino IDE
|
||||||
Sketch Data Upload menu option. Font files must be stored in the
|
Sketch Data Upload menu option. Font files must be stored in the
|
||||||
@@ -15,13 +15,13 @@
|
|||||||
|
|
||||||
Note: SPIFFS does not accept an underscore _ in filenames!
|
Note: SPIFFS does not accept an underscore _ in filenames!
|
||||||
|
|
||||||
The library supports 16 bit unicode characters:
|
The library supports 16 bit Unicode characters:
|
||||||
https://en.wikipedia.org/wiki/Unicode_font
|
https://en.wikipedia.org/wiki/Unicode_font
|
||||||
|
|
||||||
The characters supported are in the in the Basic Multilingal Plane:
|
The characters supported are in the in the Basic Multilingual Plane:
|
||||||
https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_Multilingual_Plane
|
https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_Multilingual_Plane
|
||||||
|
|
||||||
Make sure all the display driver and pin connenctions are correct by
|
Make sure all the display driver and pin connections are correct by
|
||||||
editing the User_Setup.h file in the TFT_eSPI library folder.
|
editing the User_Setup.h file in the TFT_eSPI library folder.
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
This sketch is based on Font Demo 1. It introduces a method for rendering
|
This sketch is based on Font Demo 1. It introduces a method for rendering
|
||||||
anti-aliased fonts on a graded background. This is acheived by telling the
|
anti-aliased fonts on a graded background. This is achieved by telling the
|
||||||
TFT_eSPI library the pixel color at each point on the screen. In this sketch
|
TFT_eSPI library the pixel color at each point on the screen. In this sketch
|
||||||
a graded background is drawn, the color of each pixel can therefore be
|
a graded background is drawn, the color of each pixel can therefore be
|
||||||
determined. The TFT does not need to support reading of the graphics memory.
|
determined. The TFT does not need to support reading of the graphics memory.
|
||||||
The sketch could be adapted so only part of the screen is gas a color gradient.
|
The sketch could be adapted so only part of the screen is gas a color gradient.
|
||||||
|
|
||||||
The TFT_eSPI library must be given the name of the function in the sketch
|
The TFT_eSPI library must be given the name of the function in the sketch
|
||||||
that will return the pixel xolor at a position x,y on the TFT. In this
|
that will return the pixel color at a position x,y on the TFT. In this
|
||||||
sketch that function is called gradientColor, so this line is included:
|
sketch that function is called gradientColor, so this line is included:
|
||||||
|
|
||||||
tft.setCallback(gradientColor);
|
tft.setCallback(gradientColor);
|
||||||
@@ -100,7 +100,7 @@ void setup(void) {
|
|||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|
||||||
// Select a font size comensurate with screen size
|
// Select a font size commensurate with screen size
|
||||||
if (tft.width()>= 320)
|
if (tft.width()>= 320)
|
||||||
tft.loadFont(AA_FONT_LARGE);
|
tft.loadFont(AA_FONT_LARGE);
|
||||||
else
|
else
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
This sketch is based on Font Demo 1. It introduces a method for rendering
|
This sketch is based on Font Demo 1. It introduces a method for rendering
|
||||||
anti-aliased fonts on an arbitrary background. This is acheived by reading
|
anti-aliased fonts on an arbitrary background. This is achieved by reading
|
||||||
the pixel color at each point on the screen. The TFT must support reading
|
the pixel color at each point on the screen. The TFT must support reading
|
||||||
the graphics RAM of the screen memory. This sketch has been tested with
|
the graphics RAM of the screen memory. This sketch has been tested with
|
||||||
ILI9241 and ILI9481 serial and parallel screens. Other screens may or may
|
ILI9241 and ILI9481 serial and parallel screens. Other screens may or may
|
||||||
@@ -52,7 +52,7 @@ void setup(void) {
|
|||||||
|
|
||||||
tft.begin();
|
tft.begin();
|
||||||
|
|
||||||
tft.setCallback(pixelColor); // The callback is only used durung font rendering
|
tft.setCallback(pixelColor); // The callback is only used during font rendering
|
||||||
//tft.setCallback(nullptr); // Switch off callback (off by default)
|
//tft.setCallback(nullptr); // Switch off callback (off by default)
|
||||||
|
|
||||||
tft.setRotation(1);
|
tft.setRotation(1);
|
||||||
@@ -81,7 +81,7 @@ void loop() {
|
|||||||
|
|
||||||
rainbow_fill(); // Fill the screen with rainbow colours
|
rainbow_fill(); // Fill the screen with rainbow colours
|
||||||
|
|
||||||
// Select a font size comensurate with screen size
|
// Select a font size commensurate with screen size
|
||||||
if (tft.width()>= 320)
|
if (tft.width()>= 320)
|
||||||
tft.loadFont(AA_FONT_LARGE);
|
tft.loadFont(AA_FONT_LARGE);
|
||||||
else
|
else
|
||||||
@@ -110,7 +110,7 @@ unsigned int colour = red << 11; // Colour order is RGB 5+6+5 bits each
|
|||||||
|
|
||||||
void rainbow_fill()
|
void rainbow_fill()
|
||||||
{
|
{
|
||||||
// The colours and state are not initialised so the start colour changes each time the funtion is called
|
// The colours and state are not initialised so the start colour changes each time the function is called
|
||||||
|
|
||||||
for (int i = 319; i >= 0; i--) {
|
for (int i = 319; i >= 0; i--) {
|
||||||
// Draw a vertical line 1 pixel wide in the selected colour
|
// Draw a vertical line 1 pixel wide in the selected colour
|
||||||
|
@@ -8,14 +8,14 @@
|
|||||||
The library expects strings to be in UTF-8 encoded format:
|
The library expects strings to be in UTF-8 encoded format:
|
||||||
https://www.fileformat.info/info/unicode/utf8.htm
|
https://www.fileformat.info/info/unicode/utf8.htm
|
||||||
|
|
||||||
Creating varaibles needs to be done with care when using character arrays:
|
Creating variables needs to be done with care when using character arrays:
|
||||||
char c = 'µ'; // Wrong
|
char c = 'µ'; // Wrong
|
||||||
char bad[4] = "5µA"; // Wrong
|
char bad[4] = "5µA"; // Wrong
|
||||||
char good[] = "5µA"; // Good
|
char good[] = "5µA"; // Good
|
||||||
String okay = "5µA"; // Good
|
String okay = "5µA"; // Good
|
||||||
|
|
||||||
This is because UTF-8 characters outside the basic Latin set occupy more than
|
This is because UTF-8 characters outside the basic Latin set occupy more than
|
||||||
1 byte per character! A 16 bit unicode character occupies 3 bytes!
|
1 byte per character! A 16 bit Unicode character occupies 3 bytes!
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@@ -6,10 +6,10 @@
|
|||||||
|
|
||||||
// The sketch operates by creating a copy of the screen block where
|
// The sketch operates by creating a copy of the screen block where
|
||||||
// the needle will be drawn, the needle is then drawn on the screen.
|
// the needle will be drawn, the needle is then drawn on the screen.
|
||||||
// When the needle moves, the original copy of the sreen area is
|
// When the needle moves, the original copy of the screen area is
|
||||||
// pushed to the screen to over-write the needle graphic. A copy
|
// pushed to the screen to over-write the needle graphic. A copy
|
||||||
// of the screen where the new position will be drawn is then made
|
// of the screen where the new position will be drawn is then made
|
||||||
// before drawing the needle in the new postion. This technique
|
// before drawing the needle in the new position. This technique
|
||||||
// allows the needle to move over other screen graphics.
|
// allows the needle to move over other screen graphics.
|
||||||
|
|
||||||
// The sketch calculates the size of the buffer memory required and
|
// The sketch calculates the size of the buffer memory required and
|
||||||
@@ -195,7 +195,7 @@ void plotNeedle(int16_t angle, uint16_t ms_delay)
|
|||||||
buffer_loaded = true;
|
buffer_loaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the needle in the new postion, black in needle image is transparent
|
// Draw the needle in the new position, black in needle image is transparent
|
||||||
needle.pushRotated(old_angle, TFT_BLACK);
|
needle.pushRotated(old_angle, TFT_BLACK);
|
||||||
|
|
||||||
// Wait before next update
|
// Wait before next update
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
// This sketch draws a rotating Yin and Yang symbol. It illustrates
|
// This sketch draws a rotating Yin and Yang symbol. It illustrates
|
||||||
// the drawimg and rendering of simple animated graphics using
|
// the drawing and rendering of simple animated graphics using
|
||||||
// a 1 bit per pixel (1 bpp) Sprite.
|
// a 1 bit per pixel (1 bpp) Sprite.
|
||||||
|
|
||||||
// Note: TFT_BLACK sets the pixel value to 0
|
// Note: TFT_BLACK sets the pixel value to 0
|
||||||
|
@@ -87,7 +87,7 @@ void loop() {
|
|||||||
// it is rotated and hence it clears the swept area to black
|
// it is rotated and hence it clears the swept area to black
|
||||||
for (int16_t angle = 0; angle <= 360; angle += 5)
|
for (int16_t angle = 0; angle <= 360; angle += 5)
|
||||||
{
|
{
|
||||||
needle.pushRotated(angle); // Plot direct to TFT at specifed angle
|
needle.pushRotated(angle); // Plot direct to TFT at specified angle
|
||||||
yield(); // Avoid a watchdog time-out
|
yield(); // Avoid a watchdog time-out
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
This example draws a jpeg image in a Sprite then plot a rotated copy of the Sprite
|
This example draws a jpeg image in a Sprite then plot a rotated copy of the Sprite
|
||||||
to the TFT.
|
to the TFT.
|
||||||
|
|
||||||
The jpeg used in in the sketch Data folder (presss Ctrl+K to see folder)
|
The jpeg used in in the sketch Data folder (press Ctrl+K to see folder)
|
||||||
|
|
||||||
The jpeg must be uploaded to the ESP8266 or ESP32 SPIFFS by using the Tools menu
|
The jpeg must be uploaded to the ESP8266 or ESP32 SPIFFS by using the Tools menu
|
||||||
sketch data upload option of the Arduino IDE. If you do not have that option it can
|
sketch data upload option of the Arduino IDE. If you do not have that option it can
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
Created by Bodmer 6/1/19 as an example to the TFT_eSPI library:
|
Created by Bodmer 6/1/19 as an example to the TFT_eSPI library:
|
||||||
https://github.com/Bodmer/TFT_eSPI
|
https://github.com/Bodmer/TFT_eSPI
|
||||||
|
|
||||||
Extension funtions in the TFT_eFEX library are used to list SPIFFS files and render
|
Extension functions in the TFT_eFEX library are used to list SPIFFS files and render
|
||||||
the jpeg to the TFT and to the Sprite:
|
the jpeg to the TFT and to the Sprite:
|
||||||
https://github.com/Bodmer/TFT_eFEX
|
https://github.com/Bodmer/TFT_eFEX
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
Display all the fast rendering fonts in a sprite
|
Display all the fast rendering fonts in a sprite
|
||||||
|
|
||||||
Make sure all the display driver and pin comnections are correct by
|
Make sure all the display driver and pin connections are correct by
|
||||||
editing the User_Setup.h file in the TFT_eSPI library folder.
|
editing the User_Setup.h file in the TFT_eSPI library folder.
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
|
@@ -107,7 +107,7 @@ void loop() {
|
|||||||
// The new larger fonts do not use the .setCursor call, coords are embedded
|
// The new larger fonts do not use the .setCursor call, coords are embedded
|
||||||
img.setTextColor(TFT_BLACK, TFT_BLACK); // Do not plot the background colour
|
img.setTextColor(TFT_BLACK, TFT_BLACK); // Do not plot the background colour
|
||||||
|
|
||||||
// Overlay the black text on top of the rainbow plot (the advantage of not drawing the backgorund colour!)
|
// Overlay the black text on top of the rainbow plot (the advantage of not drawing the background colour!)
|
||||||
img.drawCentreString("Font size 2", 80, 14, 2); // Draw text centre at position 80, 12 using font 2
|
img.drawCentreString("Font size 2", 80, 14, 2); // Draw text centre at position 80, 12 using font 2
|
||||||
|
|
||||||
//img.drawCentreString("Font size 2",81,12,2); // Draw text centre at position 80, 12 using font 2
|
//img.drawCentreString("Font size 2",81,12,2); // Draw text centre at position 80, 12 using font 2
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
A 16 bit Sprite occupies (2 * width * height) bytes in RAM.
|
A 16 bit Sprite occupies (2 * width * height) bytes in RAM.
|
||||||
|
|
||||||
On a ESP8266 Sprite sizes up to 126 x 160 can be accomodated,
|
On a ESP8266 Sprite sizes up to 126 x 160 can be accommodated,
|
||||||
this size requires 40kBytes of RAM for a 16 bit colour depth.
|
this size requires 40kBytes of RAM for a 16 bit colour depth.
|
||||||
|
|
||||||
When 8 bit colour depth sprites are created they occupy
|
When 8 bit colour depth sprites are created they occupy
|
||||||
@@ -46,7 +46,7 @@ void setup()
|
|||||||
// Initialise the TFT registers
|
// Initialise the TFT registers
|
||||||
tft.init();
|
tft.init();
|
||||||
|
|
||||||
// Optionally set colour depth to 8 or 16 bits, default is 16 if not spedified
|
// Optionally set colour depth to 8 or 16 bits, default is 16 if not specified
|
||||||
// spr.setColorDepth(8);
|
// spr.setColorDepth(8);
|
||||||
|
|
||||||
// Create a sprite of defined size
|
// Create a sprite of defined size
|
||||||
@@ -123,7 +123,7 @@ void loop(void)
|
|||||||
{
|
{
|
||||||
if (updateTime <= millis())
|
if (updateTime <= millis())
|
||||||
{
|
{
|
||||||
// Use time delay so sprtie does not move fast when not all on screen
|
// Use time delay so sprite does not move fast when not all on screen
|
||||||
updateTime = millis() + wait;
|
updateTime = millis() + wait;
|
||||||
|
|
||||||
// Push the sprite to the TFT screen
|
// Push the sprite to the TFT screen
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
A 16 bit Sprite occupies (2 * width * height) bytes in RAM.
|
A 16 bit Sprite occupies (2 * width * height) bytes in RAM.
|
||||||
|
|
||||||
On a ESP8266 Sprite sizes up to 126 x 160 can be accomodated,
|
On a ESP8266 Sprite sizes up to 126 x 160 can be accommodated,
|
||||||
this size requires 40kBytes of RAM for a 16 bit color depth.
|
this size requires 40kBytes of RAM for a 16 bit color depth.
|
||||||
|
|
||||||
When 8 bit color depth sprites are created they occupy
|
When 8 bit color depth sprites are created they occupy
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
Sketch to show scrolling of the graphics in sprites.
|
Sketch to show scrolling of the graphics in sprites.
|
||||||
Scrolling in this way moves the pixels in a defined rectangle
|
Scrolling in this way moves the pixels in a defined rectangle
|
||||||
within the Sprite. By defalt the whole sprite is scrolled.
|
within the Sprite. By default the whole sprite is scrolled.
|
||||||
The gap left by scrolling is filled with a defined colour.
|
The gap left by scrolling is filled with a defined colour.
|
||||||
|
|
||||||
Example for library:
|
Example for library:
|
||||||
@@ -74,7 +74,7 @@ void loop() {
|
|||||||
// Draw number in stext1 sprite at 31,63 (bottom right datum set)
|
// Draw number in stext1 sprite at 31,63 (bottom right datum set)
|
||||||
stext1.drawNumber(graphVal, 31, 63, 2); // plot value in font 2
|
stext1.drawNumber(graphVal, 31, 63, 2); // plot value in font 2
|
||||||
|
|
||||||
// Push the sprites onto the TFT at specied coordinates
|
// Push the sprites onto the TFT at specified coordinates
|
||||||
graph1.pushSprite(0, 0);
|
graph1.pushSprite(0, 0);
|
||||||
stext1.pushSprite(0, 64);
|
stext1.pushSprite(0, 64);
|
||||||
stext2.pushSprite(40, 70);
|
stext2.pushSprite(40, 70);
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
https://github.com/Bodmer/TFT_eSPI
|
https://github.com/Bodmer/TFT_eSPI
|
||||||
|
|
||||||
The sketch has been tested on a 320x240 ILI9341 based TFT, it
|
The sketch has been tested on a 320x240 ILI9341 based TFT, it
|
||||||
coule be adapted for other screen sizes.
|
could be adapted for other screen sizes.
|
||||||
|
|
||||||
A Sprite is notionally an invisible graphics screen that is
|
A Sprite is notionally an invisible graphics screen that is
|
||||||
kept in the processors RAM. Graphics can be drawn into the
|
kept in the processors RAM. Graphics can be drawn into the
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
The Sprite occupies (2 * width * height) bytes.
|
The Sprite occupies (2 * width * height) bytes.
|
||||||
|
|
||||||
On a ESP8266 Sprite sizes up to 128 x 160 can be accomodated,
|
On a ESP8266 Sprite sizes up to 128 x 160 can be accommodated,
|
||||||
this size requires 128*160*2 bytes (40kBytes) of RAM, this must be
|
this size requires 128*160*2 bytes (40kBytes) of RAM, this must be
|
||||||
available or the processor will crash. You need to make the sprite
|
available or the processor will crash. You need to make the sprite
|
||||||
small enough to fit, with RAM spare for any "local variables" that
|
small enough to fit, with RAM spare for any "local variables" that
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
tft.setBitmapColor(ON_COLOR, OFF_COLOR);
|
tft.setBitmapColor(ON_COLOR, OFF_COLOR);
|
||||||
|
|
||||||
Scrolling moves the pixels in a defined rectangle within
|
Scrolling moves the pixels in a defined rectangle within
|
||||||
the Sprite. By defalt the whole sprite is scrolled.
|
the Sprite. By default the whole sprite is scrolled.
|
||||||
The gap left by scrolling is filled with a defined colour.
|
The gap left by scrolling is filled with a defined colour.
|
||||||
|
|
||||||
Example for library:
|
Example for library:
|
||||||
@@ -82,7 +82,7 @@ void loop() {
|
|||||||
// Draw number in stext1 sprite at 31,63 (bottom right datum set)
|
// Draw number in stext1 sprite at 31,63 (bottom right datum set)
|
||||||
stext1.drawNumber(graphVal, 31, 63, 2); // plot value in font 2
|
stext1.drawNumber(graphVal, 31, 63, 2); // plot value in font 2
|
||||||
|
|
||||||
// Push the sprites onto the TFT at specied coordinates
|
// Push the sprites onto the TFT at specified coordinates
|
||||||
tft.setBitmapColor(TFT_WHITE, TFT_BLUE); // Specify the colours of the ON and OFF pixels
|
tft.setBitmapColor(TFT_WHITE, TFT_BLUE); // Specify the colours of the ON and OFF pixels
|
||||||
graph1.pushSprite(0, 0);
|
graph1.pushSprite(0, 0);
|
||||||
|
|
||||||
|
@@ -41,7 +41,7 @@ void setup() {
|
|||||||
tft.init();
|
tft.init();
|
||||||
tft.fillScreen(TFT_BLACK);
|
tft.fillScreen(TFT_BLACK);
|
||||||
|
|
||||||
// Populate the palette table, table must have 16 entires
|
// Populate the palette table, table must have 16 entries
|
||||||
palette[0] = TFT_BLACK;
|
palette[0] = TFT_BLACK;
|
||||||
palette[1] = TFT_ORANGE;
|
palette[1] = TFT_ORANGE;
|
||||||
palette[2] = TFT_DARKGREEN;
|
palette[2] = TFT_DARKGREEN;
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
An 8 bit colour Sprite occupies (width * height) bytes.
|
An 8 bit colour Sprite occupies (width * height) bytes.
|
||||||
|
|
||||||
On a ESP8266, 16 bit Sprite sizes up to 128 x 160 can be accomodated,
|
On a ESP8266, 16 bit Sprite sizes up to 128 x 160 can be accommodated,
|
||||||
this size requires 128*160*2 bytes (40kBytes) of RAM.
|
this size requires 128*160*2 bytes (40kBytes) of RAM.
|
||||||
|
|
||||||
This sketch sets the colour depth to 8 bits so larger sprites can be
|
This sketch sets the colour depth to 8 bits so larger sprites can be
|
||||||
@@ -108,7 +108,7 @@ void build_banner(String msg, int xpos)
|
|||||||
// Fill with rainbow stripes
|
// Fill with rainbow stripes
|
||||||
while (h--) img.drawFastHLine(0, h, IWIDTH, rainbow(h * 4));
|
while (h--) img.drawFastHLine(0, h, IWIDTH, rainbow(h * 4));
|
||||||
|
|
||||||
// Draw some graphics, the text will apear to scroll over these
|
// Draw some graphics, the text will appear to scroll over these
|
||||||
img.fillRect (IWIDTH / 2 - 20, IHEIGHT / 2 - 10, 40, 20, TFT_YELLOW);
|
img.fillRect (IWIDTH / 2 - 20, IHEIGHT / 2 - 10, 40, 20, TFT_YELLOW);
|
||||||
img.fillCircle(IWIDTH / 2, IHEIGHT / 2, 10, TFT_ORANGE);
|
img.fillCircle(IWIDTH / 2, IHEIGHT / 2, 10, TFT_ORANGE);
|
||||||
|
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
A 16 bit Sprite occupies (2 * width * height) bytes in RAM.
|
A 16 bit Sprite occupies (2 * width * height) bytes in RAM.
|
||||||
|
|
||||||
On a ESP8266 Sprite sizes up to 126 x 160 can be accomodated,
|
On a ESP8266 Sprite sizes up to 126 x 160 can be accommodated,
|
||||||
this size requires 40kBytes of RAM for a 16 bit colour depth.
|
this size requires 40kBytes of RAM for a 16 bit colour depth.
|
||||||
|
|
||||||
When 8 bit colour depth sprites are created they occupy
|
When 8 bit colour depth sprites are created they occupy
|
||||||
@@ -54,7 +54,7 @@ void loop() {
|
|||||||
|
|
||||||
uint32_t dt = millis();
|
uint32_t dt = millis();
|
||||||
|
|
||||||
// Now go bananas and draw 500 nore
|
// Now go bananas and draw 500 more
|
||||||
for (int i = 0; i < 500; i++)
|
for (int i = 0; i < 500; i++)
|
||||||
{
|
{
|
||||||
int x = random(240-70);
|
int x = random(240-70);
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
// Diagnostic test for the displayed colour order
|
// Diagnostic test for the displayed colour order
|
||||||
//
|
//
|
||||||
// Writen by Bodmer 17/2/19 for the TFT_eSPI library:
|
// Written by Bodmer 17/2/19 for the TFT_eSPI library:
|
||||||
// https://github.com/Bodmer/TFT_eSPI
|
// https://github.com/Bodmer/TFT_eSPI
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -66,7 +66,7 @@ void setup(void) {
|
|||||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||||
|
|
||||||
// We can now plot text on screen using the "print" class
|
// We can now plot text on screen using the "print" class
|
||||||
tft.println("Intialised default\n");
|
tft.println("Initialised default\n");
|
||||||
tft.println("White text");
|
tft.println("White text");
|
||||||
|
|
||||||
tft.setTextColor(TFT_RED, TFT_BLACK);
|
tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||||
|
@@ -118,7 +118,7 @@ void loop() {
|
|||||||
|
|
||||||
frame.fillSprite(PAPER); // Fill frame with white
|
frame.fillSprite(PAPER); // Fill frame with white
|
||||||
|
|
||||||
// Draw circle in frame buffer (x, y, r, color) in center of screen
|
// Draw circle in frame buffer (x, y, r, color) in centre of screen
|
||||||
frame.drawCircle(frame.width()/2, frame.height()/2, frame.width()/6, INK);
|
frame.drawCircle(frame.width()/2, frame.height()/2, frame.width()/6, INK);
|
||||||
|
|
||||||
// Draw diagonal lines
|
// Draw diagonal lines
|
||||||
|
Reference in New Issue
Block a user