Update TFT_eSPI to v2.5.43
This commit is contained in:
@@ -376,7 +376,7 @@ void loop() {
|
||||
}
|
||||
|
||||
// There follows a crude way of flagging that this example sketch needs fonts which
|
||||
// have not been enbabled in the User_Setup.h file inside the TFT_HX8357 library.
|
||||
// have not been enabled in the User_Setup.h file inside the TFT_HX8357 library.
|
||||
//
|
||||
// These lines produce errors during compile time if settings in User_Setup are not correct
|
||||
//
|
||||
|
||||
@@ -280,7 +280,7 @@ void drawDatumMarker(int x, int y)
|
||||
|
||||
|
||||
// There follows a crude way of flagging that this example sketch needs fonts which
|
||||
// have not been enbabled in the User_Setup.h file inside the TFT_HX8357 library.
|
||||
// have not been enabled in the User_Setup.h file inside the TFT_HX8357 library.
|
||||
//
|
||||
// These lines produce errors during compile time if settings in User_Setup are not correct
|
||||
//
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
button handling class, this sketch is based on the Arduin-o-phone
|
||||
example.
|
||||
|
||||
This example diplays a keypad where numbers can be entered and
|
||||
send to the Serial Monitor window.
|
||||
This example displays a keypad where numbers can be entered and
|
||||
sent to the Serial Monitor window.
|
||||
|
||||
The sketch has been tested on the ESP8266 (which supports SPIFFS)
|
||||
|
||||
@@ -164,7 +164,7 @@ void loop(void) {
|
||||
|
||||
// Update the number display field
|
||||
tft.setTextDatum(TL_DATUM); // Use top left corner as text coord datum
|
||||
tft.setFreeFont(&FreeSans18pt7b); // Choose a nicefont that fits box
|
||||
tft.setFreeFont(&FreeSans18pt7b); // Choose a nice font that fits box
|
||||
tft.setTextColor(DISP_TCOLOR); // Set the font colour
|
||||
|
||||
// Draw the string, the value returned is the width in pixels
|
||||
@@ -209,7 +209,7 @@ void touch_calibrate()
|
||||
|
||||
// check file system exists
|
||||
if (!SPIFFS.begin()) {
|
||||
Serial.println("Formating file system");
|
||||
Serial.println("formatting file system");
|
||||
SPIFFS.format();
|
||||
SPIFFS.begin();
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
// Change the pin settings to suit your hardware
|
||||
|
||||
// UNO etc
|
||||
// UNO etc.
|
||||
//#define TFT_MOSI 11
|
||||
//#define TFT_SCK 13
|
||||
//#define TFT_CS 9
|
||||
@@ -116,7 +116,7 @@ void setup() {
|
||||
uint32_t ID = 0;
|
||||
Serial.begin(115200);
|
||||
|
||||
delay(4000); // Delay to allow USB to connect to a Leonardo etc
|
||||
delay(4000); // Delay to allow USB to connect to a Leonardo etc.
|
||||
|
||||
Serial.println("TFT driver register values:");
|
||||
Serial.println("===========================");
|
||||
|
||||
@@ -11,7 +11,7 @@ TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
|
||||
byte inc = 0;
|
||||
unsigned int col = 0;
|
||||
|
||||
byte red = 31; // Red is the top 5 bits of a 16 bit colour value
|
||||
byte red = 31; // Red is the top 5 bits of a 16-bit colour value
|
||||
byte green = 0;// Green is the middle 6 bits
|
||||
byte blue = 0; // Blue is the bottom 5 bits
|
||||
byte state = 0;
|
||||
@@ -56,7 +56,7 @@ void loop() {
|
||||
// rx = x axis outer radius
|
||||
// ry = y axis outer radius
|
||||
// w = width (thickness) of arc in pixels
|
||||
// colour = 16 bit colour value
|
||||
// colour = 16-bit colour value
|
||||
// Note if rx and ry are the same then an arc of a circle is drawn
|
||||
|
||||
void fillArc(int x, int y, int start_angle, int seg_count, int rx, int ry, int w, unsigned int colour)
|
||||
@@ -87,7 +87,7 @@ void fillArc(int x, int y, int start_angle, int seg_count, int rx, int ry, int w
|
||||
tft.fillTriangle(x0, y0, x1, y1, x2, y2, colour);
|
||||
tft.fillTriangle(x1, y1, x2, y2, x3, y3, colour);
|
||||
|
||||
// Copy segment end to sgement start for next segment
|
||||
// Copy segment end to segment start for next segment
|
||||
x0 = x2;
|
||||
y0 = y2;
|
||||
x1 = x3;
|
||||
@@ -96,7 +96,7 @@ void fillArc(int x, int y, int start_angle, int seg_count, int rx, int ry, int w
|
||||
}
|
||||
|
||||
// #########################################################################
|
||||
// Return the 16 bit colour with brightness 0-100%
|
||||
// Return the 16-bit colour with brightness 0-100%
|
||||
// #########################################################################
|
||||
unsigned int brightness(unsigned int colour, int brightness)
|
||||
{
|
||||
@@ -112,7 +112,7 @@ unsigned int brightness(unsigned int colour, int brightness)
|
||||
}
|
||||
|
||||
// #########################################################################
|
||||
// Return a 16 bit rainbow colour
|
||||
// Return a 16-bit rainbow colour
|
||||
// #########################################################################
|
||||
unsigned int rainbow(byte value)
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#########################################################################
|
||||
*/
|
||||
|
||||
// Note the the tilda symbol ~ does not exist in some fonts at the moment
|
||||
// Note the the tilde symbol ~ does not exist in some fonts at the moment
|
||||
#define TEXT "abc MWy 123 |" // Text that will be printed on screen in any font
|
||||
|
||||
#include "SPI.h"
|
||||
|
||||
@@ -13,7 +13,7 @@ int segment = 0;
|
||||
unsigned int col = 0;
|
||||
int delta = -1;
|
||||
|
||||
byte red = 31; // Red is the top 5 bits of a 16 bit colour value
|
||||
byte red = 31; // Red is the top 5 bits of a 16-bit colour value
|
||||
byte green = 0;// Green is the middle 6 bits
|
||||
byte blue = 0; // Blue is the bottom 5 bits
|
||||
byte state = 0;
|
||||
@@ -48,7 +48,7 @@ void loop() {
|
||||
// rx = x axis radius
|
||||
// yx = y axis radius
|
||||
// w = width (thickness) of arc in pixels
|
||||
// colour = 16 bit colour value
|
||||
// colour = 16-bit colour value
|
||||
// Note if rx and ry are the same an arc of a circle is drawn
|
||||
|
||||
void fillArc(int x, int y, int start_angle, int seg_count, int rx, int ry, int w, unsigned int colour)
|
||||
@@ -82,7 +82,7 @@ void fillArc(int x, int y, int start_angle, int seg_count, int rx, int ry, int w
|
||||
}
|
||||
|
||||
// #########################################################################
|
||||
// Return a 16 bit colour with brightness 0 - 100%
|
||||
// Return a 16-bit colour with brightness 0 - 100%
|
||||
// #########################################################################
|
||||
unsigned int brightness(unsigned int colour, int brightness)
|
||||
{
|
||||
@@ -98,7 +98,7 @@ unsigned int brightness(unsigned int colour, int brightness)
|
||||
}
|
||||
|
||||
// #########################################################################
|
||||
// Return a 16 bit rainbow colour
|
||||
// Return a 16-bit rainbow colour
|
||||
// #########################################################################
|
||||
unsigned int rainbow(byte value)
|
||||
{
|
||||
|
||||
@@ -62,7 +62,7 @@ unsigned int rainbow(int value)
|
||||
// Value is expected to be in range 0-127
|
||||
// The value is converted to a spectrum colour from 0 = blue through to red = blue
|
||||
|
||||
byte red = 0; // Red is the top 5 bits of a 16 bit colour value
|
||||
byte red = 0; // Red is the top 5 bits of a 16-bit colour value
|
||||
byte green = 0;// Green is the middle 6 bits
|
||||
byte blue = 0; // Blue is the bottom 5 bits
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ void setup(void) {
|
||||
|
||||
void loop() {
|
||||
if (updateTime <= millis()) {
|
||||
updateTime = millis() + 35; // Update emter every 35 milliseconds
|
||||
updateTime = millis() + 35; // Update meter every 35 milliseconds
|
||||
|
||||
// Create a Sine wave for testing
|
||||
d += 4; if (d >= 360) d = 0;
|
||||
@@ -75,7 +75,7 @@ void analogMeter()
|
||||
// Long scale tick length
|
||||
int tl = 15;
|
||||
|
||||
// Coodinates of tick to draw
|
||||
// Coordinates of tick to draw
|
||||
float sx = cos((i - 90) * 0.0174532925);
|
||||
float sy = sin((i - 90) * 0.0174532925);
|
||||
uint16_t x0 = sx * (M_SIZE*100 + tl) + M_SIZE*120;
|
||||
@@ -175,7 +175,7 @@ void plotNeedle(int value, byte ms_delay)
|
||||
if (ms_delay == 0) old_analog = value; // Update immediately if delay is 0
|
||||
|
||||
float sdeg = map(old_analog, -10, 110, -150, -30); // Map value to angle
|
||||
// Calcualte tip of needle coords
|
||||
// Calculate tip of needle coords
|
||||
float sx = cos(sdeg * 0.0174532925);
|
||||
float sy = sin(sdeg * 0.0174532925);
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ void analogMeter()
|
||||
// Long scale tick length
|
||||
int tl = 15;
|
||||
|
||||
// Coodinates of tick to draw
|
||||
// Coordinates of tick to draw
|
||||
float sx = cos((i - 90) * 0.0174532925);
|
||||
float sy = sin((i - 90) * 0.0174532925);
|
||||
uint16_t x0 = sx * (100 + tl) + 120;
|
||||
@@ -195,7 +195,7 @@ void plotNeedle(int value, byte ms_delay)
|
||||
if (ms_delay == 0) old_analog = value; // Update immediately id delay is 0
|
||||
|
||||
float sdeg = map(old_analog, -10, 110, -150, -30); // Map value to angle
|
||||
// Calcualte tip of needle coords
|
||||
// Calculate tip of needle coords
|
||||
float sx = cos(sdeg * 0.0174532925);
|
||||
float sy = sin(sdeg * 0.0174532925);
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ void loop() {
|
||||
// start_angle = 0 - 359
|
||||
// sub_angle = 0 - 360 = subtended angle
|
||||
// r = radius
|
||||
// colour = 16 bit colour value
|
||||
// colour = 16-bit colour value
|
||||
|
||||
int fillSegment(int x, int y, int start_angle, int sub_angle, int r, unsigned int colour)
|
||||
{
|
||||
@@ -63,7 +63,7 @@ int fillSegment(int x, int y, int start_angle, int sub_angle, int r, unsigned in
|
||||
|
||||
tft.fillTriangle(x1, y1, x2, y2, x, y, colour);
|
||||
|
||||
// Copy segment end to sgement start for next segment
|
||||
// Copy segment end to segment start for next segment
|
||||
x1 = x2;
|
||||
y1 = y2;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ int fillSegment(int x, int y, int start_angle, int sub_angle, int r, unsigned in
|
||||
|
||||
|
||||
// #########################################################################
|
||||
// Return the 16 bit colour with brightness 0-100%
|
||||
// Return the 16-bit colour with brightness 0-100%
|
||||
// #########################################################################
|
||||
unsigned int brightness(unsigned int colour, int brightness)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Test the tft.print() viz embedded tft.write() function
|
||||
Test the tft.print() viz. embedded tft.write() function
|
||||
|
||||
This sketch used font 2, 4, 7
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ void loop() {
|
||||
|
||||
// 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
|
||||
// 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.drawCentreString("Font size 2", 120, 14, 2); // Draw text centre at position 120, 14 using font 2
|
||||
tft.drawCentreString("Font size 4", 120, 30, 4); // Draw text centre at position 120, 30 using font 4
|
||||
tft.drawCentreString("12.34", 120, 54, 6); // Draw text centre at position 120, 54 using font 6
|
||||
@@ -98,7 +98,7 @@ void loop() {
|
||||
// Fill screen with a rainbow pattern
|
||||
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--) {
|
||||
// Draw a vertical line 1 pixel wide in the selected colour
|
||||
|
||||
@@ -56,7 +56,7 @@ void loop() {
|
||||
|
||||
printSubset(); // Print a useful subset of the readable registers
|
||||
|
||||
readTest(); // Test 8, 16 and 32 bit reads and index on the ID register
|
||||
readTest(); // Test 8, 16 and 32-bit reads and index on the ID register
|
||||
|
||||
//printRange32(0x00, 0xFF); // Print a range of registers (32 bits, index = 0)
|
||||
|
||||
@@ -70,8 +70,8 @@ void loop() {
|
||||
|
||||
void readTest(void)
|
||||
{
|
||||
Serial.println(); Serial.println("Test 8, 16 and 32 bit reads and the index...");
|
||||
// Test 8, 16 and 32 bit reads and index
|
||||
Serial.println(); Serial.println("Test 8, 16 and 32-bit reads and the index...");
|
||||
// Test 8, 16 and 32-bit reads and index
|
||||
// Note at index 0 the register values are typically undefined (Bxxxxxxxx)
|
||||
Serial.println(tft.readcommand8(ILI9341_RDID4, 2), HEX);
|
||||
Serial.println(tft.readcommand16(ILI9341_RDID4, 2), HEX);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Spiro
|
||||
// Rainbow patern generator
|
||||
// Rainbow pattern generator
|
||||
|
||||
#include <TFT_eSPI.h> // Hardware-specific library
|
||||
#include <SPI.h>
|
||||
@@ -67,7 +67,7 @@ unsigned int rainbow(int value)
|
||||
// Value is expected to be in range 0-127
|
||||
// The value is converted to a spectrum colour from 0 = blue through to red = blue
|
||||
//int value = random (128);
|
||||
byte red = 0; // Red is the top 5 bits of a 16 bit colour value
|
||||
byte red = 0; // Red is the top 5 bits of a 16-bit colour value
|
||||
byte green = 0;// Green is the middle 6 bits
|
||||
byte blue = 0; // Blue is the bottom 5 bits
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ void loop()
|
||||
int old_screen_x = ((int)sx[i] - 160) * 256 / sz[i] + 160;
|
||||
int old_screen_y = ((int)sy[i] - 120) * 256 / sz[i] + 120;
|
||||
|
||||
// This is a faster pixel drawing function for occassions where many single pixels must be drawn
|
||||
// This is a faster pixel drawing function for occasions where many single pixels must be drawn
|
||||
tft.drawPixel(old_screen_x, old_screen_y,TFT_BLACK);
|
||||
|
||||
sz[i] -= 2;
|
||||
@@ -82,7 +82,7 @@ void loop()
|
||||
unsigned long t1 = micros();
|
||||
//static char timeMicros[8] = {};
|
||||
|
||||
// Calcualte frames per second
|
||||
// Calculate frames per second
|
||||
Serial.println(1.0/((t1 - t0)/1000000.0));
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
Connect GND to target board GND
|
||||
Connect RX line to TX line of target board
|
||||
Make sure the target and terminal have the same baud rate
|
||||
and serial stettings!
|
||||
and serial settings!
|
||||
|
||||
The sketch works with the ILI9341 TFT 240x320 display and
|
||||
the called up libraries.
|
||||
|
||||
Reference in New Issue
Block a user