Hey Guys,
I might have missed it, but are we able to choose one of the secondary busses on the T4.x boards? If so is there a reference to how to?
RA8875(const uint8_t CSp,const uint8_t RSTp=255,const uint8_t mosi_pin=11,const uint8_t sclk_pin=13,const uint8_t miso_pin=12);
//always uses SPI transaction
if (SPI.pinIsMISO(_miso) && SPI.pinIsMOSI(_mosi) && SPI.pinIsSCK(_sclk)) {
_pspi = &SPI;
} else if (SPI1.pinIsMISO(_miso) && SPI1.pinIsMOSI(_mosi) && SPI1.pinIsSCK(_sclk)) {
_pspi = &SPI1;
} else if (SPI2.pinIsMISO(_miso) && SPI2.pinIsMOSI(_mosi) && SPI2.pinIsSCK(_sclk)) {
_pspi = &SPI2;
} else {
_errorCode |= (1 << 1);//set
return;
}
// Make sure we select the right pins.
// On T4 does nothing, and on T4.1 only miso matters, but just in case.
_pspi->setMISO(_miso);
_pspi->setMOSI(_mosi);
_pspi->setSCK(_sclk);
tft.fillRect(0, 290, 110, 20, HX8357_BLACK); // Blank slate for new value
tft.setFont(Arial_14);
tft.setTextColor(HX8357_YELLOW);
tft.setCursor(0,290);
tft.print("RF Pwr: "); tft.print(fRig.transmit.rfpower);
tft.setTextColor(fgColor, bgColor
tft.setCursor(fieldX, FieldY)'
tft.drawText(newtime);
int16_t xcursor = tft.getCursorX();
tft.fillRect(xCursor, fieldY, (fieldX_end - xcursor), field_height);
@KurtE
Just wanted to know if you have your RA8875 display working with the T4x. For some reason its not working for me with the T4.1. I tried it with a T3.5 and it works without a problem?
The one I am running is on a T4. Maybe you are setup with non-standard pins like T14 for SCK?
#include <Adafruit_GFX.h>
#include <SPI.h>
#include <RA8875.h>
#include "font_Arial.h"
#include "font_OpenSans.h"
//****************************************************************************
// Settings and objects
//****************************************************************************
#define RA8875_CS 9
#define RA8875_RST 8
RA8875 tft = RA8875(RA8875_CS, RA8875_RST);
void drawTextWithBoundingRect(uint16_t x, uint16_t y, const char *str, ILI9341_t3_font_t *font) {
int16_t x1, y1;
uint16_t w, h;
tft.setFont(*font);
tft.setCursor(x, y);
tft.getTextBounds(str, x, y, &x1, &y1, &w, &h);
tft.print(str);
tft.drawRect(x1, y1, w, h, RA8875_RED);
}
void drawCenteredText(uint16_t x, uint16_t y, uint16_t w, uint16_t h,
const char *str,
ILI9341_t3_font_t *font,
uint16_t bg, uint16_t text_fg, uint16_t text_bg) {
tft.setFont(*font);
tft.fillRect(x, y, w, h, bg);
if (text_fg == text_bg) tft.setTextColor(text_fg);
else tft.setTextColor(text_fg, text_bg);
tft.setCursor(x + w / 2, y + h / 2, true);
tft.setClipRect(x, y, w, h);
tft.print(str);
tft.setClipRect();
}
void setup()
{
Serial.begin(9600);
delay(3000);
while (!Serial && millis() < 5000) ;
Serial.println("Initializing TFT display");
// begin display: Choose from: RA8875_480x272, RA8875_800x480, RA8875_800x480ALT, Adafruit_480x272, Adafruit_800x480
tft.begin(Adafruit_800x480, 16, 15000000);
tft.fillWindow(RA8875_BLACK);
tft.setTextColor(RA8875_YELLOW);
tft.setTextSize(2);
tft.setRotation(1);
tft.setFont(Arial_40);
drawTextWithBoundingRect(20, 20, "-", &Arial_40);
drawTextWithBoundingRect(60, 20, "+", &Arial_40);
drawTextWithBoundingRect(100, 20, "X", &Arial_40);
drawTextWithBoundingRect(140, 20, "Next", &Arial_40);
drawCenteredText(20, 100, 35, 50, "-", &Arial_40, RA8875_YELLOW, RA8875_RED, RA8875_YELLOW);
drawCenteredText(60, 100, 35, 50, "+", &Arial_40, RA8875_YELLOW, RA8875_RED, RA8875_YELLOW);
drawCenteredText(100, 100, 40, 50, "X", &Arial_40, RA8875_YELLOW, RA8875_RED, RA8875_YELLOW);
drawCenteredText(150, 100, 130, 50, "Next", &Arial_40, RA8875_YELLOW, RA8875_RED, RA8875_YELLOW);
drawCenteredText(20, 200, 35, 50, "-", &Arial_40, RA8875_YELLOW, RA8875_BLUE, RA8875_BLUE);
drawCenteredText(60, 200, 35, 50, "+", &Arial_40, RA8875_YELLOW, RA8875_BLUE, RA8875_BLUE);
drawCenteredText(100, 200, 40, 50, "X", &Arial_40, RA8875_YELLOW, RA8875_BLUE, RA8875_BLUE);
drawCenteredText(150, 200, 130, 50, "Next", &Arial_40, RA8875_YELLOW, RA8875_BLUE, RA8875_BLUE);
drawTextWithBoundingRect(20, 300, "-", &OpenSans40);
drawTextWithBoundingRect(60, 300, "+", &OpenSans40);
drawTextWithBoundingRect(100, 300, "X", &OpenSans40);
drawTextWithBoundingRect(140, 300, "Next", &OpenSans40);
drawCenteredText(20, 400, 35, 50, "-", &OpenSans40, RA8875_YELLOW, RA8875_RED, RA8875_YELLOW);
drawCenteredText(60, 400, 35, 50, "+", &OpenSans40, RA8875_YELLOW, RA8875_RED, RA8875_YELLOW);
drawCenteredText(100, 400, 40, 50, "X", &OpenSans40, RA8875_YELLOW, RA8875_RED, RA8875_YELLOW);
drawCenteredText(150, 400, 130, 50, "Next", &OpenSans40, RA8875_YELLOW, RA8875_RED, RA8875_YELLOW);
drawCenteredText(20, 500, 35, 50, "-", &OpenSans40, RA8875_YELLOW, RA8875_BLUE, RA8875_BLUE);
drawCenteredText(60, 500, 35, 50, "+", &OpenSans40, RA8875_YELLOW, RA8875_BLUE, RA8875_BLUE);
drawCenteredText(100, 500, 40, 50, "X", &OpenSans40, RA8875_YELLOW, RA8875_BLUE, RA8875_BLUE);
drawCenteredText(150, 500, 130, 50, "Next", &OpenSans40, RA8875_YELLOW, RA8875_BLUE, RA8875_BLUE);
}
void loop(void)
{
}
#include <Adafruit_GFX.h>
//#define HAS_9488
//#define HAS_8357
#define HAS_8875
#include <SPI.h>
#ifdef HAS_9488
#include "ILI9488_t3.h"
#elif defined(HAS_8357)
#include "HX8357_t3n.h"
#elif defined(HAS_8875)
#include "RA8875.h"
#endif
#define Arial_40 Arial_40
#define OpenSans40 OpenSans40
//-----------------------------------------------------
#include "font_Arial.h"
#include "font_OpenSans.h"
//****************************************************************************
// Settings and objects
//****************************************************************************
// For the Adafruit shield, these are the default.
#define TFT_DC 9
#define TFT_CS 10
#define TFT_RST 8
// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
#include <SPI.h>
#ifdef HAS_9488
ILI9488_t3 tft = ILI9488_t3(&SPI, TFT_CS, TFT_DC, TFT_RST);
#elif defined(HAS_8357)
HX8357_t3n tft = HX8357_t3n(TFT_CS, TFT_DC, TFT_RST);
#elif defined(HAS_8875)
RA8875 tft = RA8875(TFT_CS, TFT_RST);
#endif
#ifdef HAS_9488
#define RA8875_RED ILI9488_RED
#define RA8875_YELLOW ILI9488_YELLOW
#define RA8875_BLUE ILI9488_BLUE
#define RA8875_BLACK ILI9488_BLACK
#elif defined(HAS_8357)
#define RA8875_BLACK HX8357_BLACK
#define RA8875_RED HX8357_RED
#define RA8875_YELLOW HX8357_YELLOW
#define RA8875_BLUE HX8357_BLUE
#define RA8875_BLACK HX8357_BLACK
#endif
uint16_t y_loc;
void drawTextWithBoundingRect(uint16_t x, uint16_t y, const char *str, ILI9341_t3_font_t *font) {
int16_t x1, y1;
uint16_t w, h;
tft.setFont(*font);
tft.setCursor(x, y);
tft.getTextBounds(str, x, y, &x1, &y1, &w, &h);
tft.print(str);
tft.drawRect(x1, y1, w, h, RA8875_RED);
}
void drawCenteredText(uint16_t x, uint16_t y, uint16_t w, uint16_t h,
const char *str,
ILI9341_t3_font_t *font,
uint16_t bg, uint16_t text_fg, uint16_t text_bg) {
tft.setFont(*font);
tft.fillRect(x, y, w, h, bg);
if (text_fg == text_bg) tft.setTextColor(text_fg);
else tft.setTextColor(text_fg, text_bg);
tft.setCursor(x + w / 2, y + h / 2, true);
tft.setClipRect(x, y, w, h);
tft.print(str);
tft.setClipRect();
}
void nextPage()
{
Serial.println("Press anykey to continue");
while (Serial.read() == -1) ;
while (Serial.read() != -1) ;
#ifdef HAS_8875
tft.fillWindow(RA8875_BLACK);
#else
tft.fillScreen(RA8875_BLACK);
#endif
tft.setCursor(0, 0);
}
void setup()
{
Serial.begin(9600);
delay(3000);
while (!Serial && millis() < 5000) ;
Serial.println("Initializing TFT display");
// begin display: Choose from: HX8357_480x272, HX8357_800x480, HX8357_800x480ALT, Adafruit_480x272, Adafruit_800x480
#ifdef HAS_8875
tft.begin(Adafruit_800x480, 16, 15000000);
tft.fillWindow(RA8875_BLACK);
#else
tft.begin();
tft.fillScreen(RA8875_BLACK);
#endif
tft.setTextColor(RA8875_YELLOW);
tft.setTextSize(2);
tft.setRotation(1);
}
void loop(void)
{
Serial.println("Arial");
tft.setFont(Arial_40);
drawTextWithBoundingRect(20, 20, "-", &Arial_40);
drawTextWithBoundingRect(60, 20, "+", &Arial_40);
drawTextWithBoundingRect(100, 20, "X", &Arial_40);
drawTextWithBoundingRect(140, 20, "Next", &Arial_40);
drawCenteredText(20, 80, 35, 50, "-", &Arial_40, RA8875_YELLOW, RA8875_RED, RA8875_YELLOW);
drawCenteredText(60, 80, 35, 50, "+", &Arial_40, RA8875_YELLOW, RA8875_RED, RA8875_YELLOW);
drawCenteredText(100, 80, 40, 50, "X", &Arial_40, RA8875_YELLOW, RA8875_RED, RA8875_YELLOW);
drawCenteredText(150, 80, 130, 50, "Next", &Arial_40, RA8875_YELLOW, RA8875_RED, RA8875_YELLOW);
drawCenteredText(20, 180, 35, 50, "-", &Arial_40, RA8875_YELLOW, RA8875_BLUE, RA8875_BLUE);
drawCenteredText(60, 180, 35, 50, "+", &Arial_40, RA8875_YELLOW, RA8875_BLUE, RA8875_BLUE);
drawCenteredText(100, 180, 40, 50, "X", &Arial_40, RA8875_YELLOW, RA8875_BLUE, RA8875_BLUE);
drawCenteredText(150, 180, 130, 50, "Next", &Arial_40, RA8875_YELLOW, RA8875_BLUE, RA8875_BLUE);
#if !defined(HAS_8875)
nextPage();
Serial.println("OpenSans");
drawTextWithBoundingRect(20, 20, "-", &OpenSans40);
drawTextWithBoundingRect(60, 20, "+", &OpenSans40);
drawTextWithBoundingRect(100, 20, "X", &OpenSans40);
drawTextWithBoundingRect(140, 20, "Next", &OpenSans40);
drawCenteredText(20, 80, 35, 50, "-", &OpenSans40, RA8875_YELLOW, RA8875_RED, RA8875_YELLOW);
drawCenteredText(60, 80, 35, 50, "+", &OpenSans40, RA8875_YELLOW, RA8875_RED, RA8875_YELLOW);
drawCenteredText(100, 80, 40, 50, "X", &OpenSans40, RA8875_YELLOW, RA8875_RED, RA8875_YELLOW);
drawCenteredText(150, 80, 130, 50, "Next", &OpenSans40, RA8875_YELLOW, RA8875_RED, RA8875_YELLOW);
drawCenteredText(20, 180, 35, 50, "-", &OpenSans40, RA8875_YELLOW, RA8875_BLUE, RA8875_BLUE);
drawCenteredText(60, 180, 35, 50, "+", &OpenSans40, RA8875_YELLOW, RA8875_BLUE, RA8875_BLUE);
drawCenteredText(100, 180, 40, 50, "X", &OpenSans40, RA8875_YELLOW, RA8875_BLUE, RA8875_BLUE);
drawCenteredText(150, 180, 130, 50, "Next", &OpenSans40, RA8875_YELLOW, RA8875_BLUE, RA8875_BLUE);
#else
drawTextWithBoundingRect(20, 300, "-", &OpenSans40);
drawTextWithBoundingRect(60, 300, "+", &OpenSans40);
drawTextWithBoundingRect(100, 300, "X", &OpenSans40);
drawTextWithBoundingRect(140, 300, "Next", &OpenSans40);
drawCenteredText(20, 400, 35, 50, "-", &OpenSans40, RA8875_YELLOW, RA8875_RED, RA8875_YELLOW);
drawCenteredText(60, 400, 35, 50, "+", &OpenSans40, RA8875_YELLOW, RA8875_RED, RA8875_YELLOW);
drawCenteredText(100, 400, 40, 50, "X", &OpenSans40, RA8875_YELLOW, RA8875_RED, RA8875_YELLOW);
drawCenteredText(150, 400, 130, 50, "Next", &OpenSans40, RA8875_YELLOW, RA8875_RED, RA8875_YELLOW);
drawCenteredText(20, 500, 35, 50, "-", &OpenSans40, RA8875_YELLOW, RA8875_BLUE, RA8875_BLUE);
drawCenteredText(60, 500, 35, 50, "+", &OpenSans40, RA8875_YELLOW, RA8875_BLUE, RA8875_BLUE);
drawCenteredText(100, 500, 40, 50, "X", &OpenSans40, RA8875_YELLOW, RA8875_BLUE, RA8875_BLUE);
drawCenteredText(150, 500, 130, 50, "Next", &OpenSans40, RA8875_YELLOW, RA8875_BLUE, RA8875_BLUE);
#endif
nextPage();
}
I just put in a hack version that the opaque font code calls off to a new fillRect function that does clipping.
The current code did not do any clipping... Not sure if it will impact other parts or not, but test cases appear to work better.
// when used w/ Audio Adapter, must use an alternate CS pin for the display
const int RA8875_CHIP_SELECT = A14; // Teensy 38 -to- RA8875 05
const int RA8875_RESET = 3; // Teensy 03 -to -RA8875 11
const int RA8875_MISO = A15; // Teensy 39 -to- RA8875 06
const int RA8875_MOSI = A12; // Teensy 26 -to- RA8875 07
const int RA8875_SCLK = A13; // Teensy 27 -to- RA8875 08
const int RA8875_TS_INT = 2; // Teensy 02 -to- RA8875 33
const int RA8875_MAX_TOUCH_LIMIT = 1;
RA8875 tft = RA8875(RA8875_CHIP_SELECT, RA8875_RESET, RA8875_MOSI, RA8875_SCLK, RA8875_MISO);
#ifdef USE_RA8875_TOUCH
tft.useINT(RA8875_TS_INT); // use generic int helper for Internal Resistive Touch
#else
tft.useCapINT(RA8875_TS_INT); // use the capacitive chip interrupt
#endif
/* Simply Touch screen library calibration V2:
this will help you to calibrate your touch screen by modify
4 parameters inside RA8875/_utility/RA8875Calibration.h file:
TOUCSRCAL_XLOW //min value of x you can get
TOUCSRCAL_XHIGH //max value of x you can get
TOUCSRCAL_YLOW //min value of y you can get
TOUCSRCAL_YHIGH //max value of y you can get
Normally those parameters are set as 0.
Only for RESISTIVE TOUCH SCREEN!
It's not a bullet-proof scientist alghorithm but calibrate
using this method will be fast and enough accurate for basic
touch screen operations like buttons, etc. If you need more
precision and you don't want waste resources consider a capacitive touch!
Now run this program and open Serial Monitor or follow screen instrunctions.
Works with Arduino 1.0.6 IDE, Arduino 1.6.x IDE
*/
#include <SPI.h>
#include <RA8875.h>
/*
Arduino's
You are using 4 wire SPI here, so:
MOSI: 11//DUE refere to arduino site
MISO: 12//DUE refere to arduino site
SCK: 13//DUE refere to arduino site
the rest of pin below:
*/
//#define RA8875_INT 2 //any pin
//#define RA8875_CS 10 //any digital pin
//#define RA8875_RESET 9//any pin or nothing!
//
//RA8875 tft = RA8875(RA8875_CS,RA8875_RESET);//arduino's
// when used w/ Audio Adapter, must use an alternate CS pin for the display
const int RA8875_CHIP_SELECT = A14; // Teensy 38 -to- RA8875 05
const int RA8875_RESET = 3; // Teensy 03 -to -RA8875 11
const int RA8875_MISO = A15; // Teensy 39 -to- RA8875 06
const int RA8875_MOSI = A12; // Teensy 26 -to- RA8875 07
const int RA8875_SCLK = A13; // Teensy 27 -to- RA8875 08
const int RA8875_TS_INT = 2; // Teensy 02 -to- RA8875 33
const int RA8875_MAX_TOUCH_LIMIT = 1;
RA8875 tft = RA8875(RA8875_CHIP_SELECT, RA8875_RESET, RA8875_MOSI, RA8875_SCLK, RA8875_MISO);
const uint8_t samples = 20;
uint16_t tempData[samples][2];
volatile int count = 0;
uint16_t tx, ty;//used as temp
uint16_t _XLOW_VAR;
uint16_t _YLOW_VAR;
uint16_t _XHIGH_VAR;
uint16_t _YHIGH_VAR;
bool proceed;
int scount = 0;
#if !defined(USE_RA8875_TOUCH) || defined(_AVOID_TOUCHSCREEN)
#error "you need to enable resistive touchscreen by uncommenting USE_RA8875_TOUCH in settings!"
#endif
void setup() {
Serial.begin(38400);
long unsigned debug_start = millis ();
while (!Serial && ((millis () - debug_start) <= 5000)) ;
// begin display: Choose from: RA8875_480x272, RA8875_800x480, RA8875_800x480ALT, Adafruit_480x272, Adafruit_800x480
tft.begin(RA8875_800x480);//initialize RA8875
/* Adafruit_480x272 Adafruit_800x480 RA8875_480x272 RA8875_800x480 */
tft.useINT(RA8875_TS_INT);//We use generic int helper for Internal Resistive Touch
tft.touchBegin();//enable touch support for RA8875
if (tft.touchCalibrated()) {//already calibrated?
if (tft.width() > 480) tft.setFontScale(1);
Serial.println("You have old calibration data present!\n");
Serial.println("\nPlease open RA8875/_utility/RA8875calibration.h and put zero on the following:\n");
Serial.println("#define TOUCSRCAL_XLOW 0");
Serial.println("#define TOUCSRCAL_YLOW 0");
Serial.println("#define TOUCSRCAL_XHIGH 0");
Serial.println("#define TOUCSRCAL_YHIGH 0\n");
Serial.println("Then save and try to run this again!");
tft.setCursor(0, 0);
tft.setTextColor(RA8875_RED);
tft.println("---> You have old calibration data present! <---");
tft.setTextColor(RA8875_WHITE);
tft.println("Please open RA8875/_utility/RA8875calibration.h");
tft.println("and put zero on the following:");
tft.println(" ");
tft.println(" #define TOUCSRCAL_XLOW 0");
tft.println(" #define TOUCSRCAL_YLOW 0");
tft.println(" #define TOUCSRCAL_XHIGH 0");
tft.println(" #define TOUCSRCAL_YHIGH 0");
tft.println(" ");
tft.print("Then save and try to run this again!");
proceed = false;
} else {
Serial.println("Start calibration, please follow indications...\n");
Serial.println("\nPlease press FIRMLY the TOP/LEFT angle of your screen now!\n");
if (tft.width() > 480) tft.setFontScale(1);
tft.setCursor(CENTER, CENTER);
tft.setTextColor(RA8875_WHITE);
tft.print("Please press the TOP/LEFT angle now!");
tft.fillCircle(5, 5, 5, RA8875_RED);
proceed = true;
//this enable an ISR on CPU and RA8875 INT
tft.enableISR(true);
//You can avoid ISR by simple ignore the line above
//it will use the slower digitalRead(pin) alternative internally
}
}
void loop() {
if (proceed) {
if (tft.touched()) {
if (count >= samples) {
tft.touchEnable(false);
count = 0;//reset counts
uint32_t valx = 0;
uint32_t valy = 0;
if (scount < 1) {
for (uint8_t i = 0; i < samples; i++) {
valx += tempData[i][0];
valy += tempData[i][1];
}
valx = valx / samples;
valy = valy / samples;
tft.fillWindow();
if (tft.width() > 480) tft.setFontScale(1);
tft.setCursor(CENTER, CENTER);
tft.setTextColor(RA8875_WHITE);
tft.println("Top/Left done. Please do not touch screen...");
tft.setTextColor(RA8875_RED);
tft.setFontScale(1);
tft.print("Please do not touch screen!");
tft.setFontScale(0);
Serial.print("Top/Left done...");
Serial.print("Please do not touch screen...");
_XLOW_VAR = valx;
_YLOW_VAR = valy;
delay(3000);
tft.fillWindow();
tft.fillCircle(tft.width() - 5, tft.height() - 5, 5, RA8875_RED);
if (tft.width() > 480) tft.setFontScale(1);
tft.setCursor(CENTER, CENTER);
tft.setTextColor(RA8875_WHITE);
tft.print("ok, Now Touch Bottom/Right angle!");
Serial.println("\n...done, Now Touch Bottom/Right angle!");
delay(2000);
tft.touchEnable(true);
scount++;
} else if (scount >= 1) {
for (uint8_t i = 0; i < samples; i++) {
valx += tempData[i][0];
valy += tempData[i][1];
}
valx = valx / samples;
valy = valy / samples;
tft.fillWindow();
tft.setCursor(0, 20);
tft.setTextColor(RA8875_WHITE);
tft.println("Calibration done...watch results!");
Serial.println("\nCalibration done...watch results");
_XHIGH_VAR = valx;
_YHIGH_VAR = valy;
tft.println("Now open file:");
tft.setTextColor(RA8875_YELLOW);
tft.println("RA8875/_utility/RA8875Calibration.h");
tft.setTextColor(RA8875_WHITE);
Serial.println("\nNow open file RA8875/_utility/RA8875Calibration.h\n");
Serial.println("Change the following:\n");
tft.println("Change the following:");
tft.println(" ");
tft.setTextColor(RA8875_GREEN);
tft.print("#define TOUCSRCAL_XLOW ");
tft.setTextColor(RA8875_YELLOW);
tft.println(_XLOW_VAR, DEC);
tft.setTextColor(RA8875_GREEN);
tft.print("#define TOUCSRCAL_YLOW ");
tft.setTextColor(RA8875_YELLOW);
tft.println(_YLOW_VAR, DEC);
tft.setTextColor(RA8875_GREEN);
tft.print("#define TOUCSRCAL_XHIGH ");
tft.setTextColor(RA8875_YELLOW);
tft.println(_XHIGH_VAR, DEC);
tft.setTextColor(RA8875_GREEN);
tft.print("#define TOUCSRCAL_YHIGH ");
tft.setTextColor(RA8875_YELLOW);
tft.println(_YHIGH_VAR, DEC);
tft.setTextColor(RA8875_WHITE);
tft.println(" ");
tft.println("...then save file and you are calibrated!");
Serial.println("#define TOUCSRCAL_XLOW 0");
Serial.println("#define TOUCSRCAL_YLOW 0");
Serial.println("#define TOUCSRCAL_XHIGH 0");
Serial.println("#define TOUCSRCAL_YHIGH 0");
Serial.println("\nInto:\n");
Serial.print("#define TOUCSRCAL_XLOW ");
Serial.println(_XLOW_VAR, DEC);
Serial.print("#define TOUCSRCAL_YLOW ");
Serial.println(_YLOW_VAR, DEC);
Serial.print("#define TOUCSRCAL_XHIGH ");
Serial.println(_XHIGH_VAR, DEC);
Serial.print("#define TOUCSRCAL_YHIGH ");
Serial.println(_YHIGH_VAR, DEC);
Serial.println("\nSave and Have a nice day!");
proceed = false;
tft.touchEnable(false);
}
} else {//continue get samples
delay(1);
tft.touchReadAdc(&tx, &ty);//we using 10bit adc data here
if (count >= 0) {
tempData[count][0] = tx;
tempData[count][1] = ty;
}
count++;
}
}
}//proceed
}
#include <SPI.h>
#include <RA8875.h>
#define RA8875_RESET 255
#define RA8875_CS 10
RA8875 tft = RA8875(RA8875_CS, RA8875_RESET, 11, 13, 12); // 11=MOSI 13=SCLK 12=MISO 10=CS
#include "fonts/Liberation_Mono_28.c"
#include "font_AwesomeF000.h"
#include "font_AwesomeF200.h"
#include "font_AwesomeF180.h"
#include "font_AwesomeF100.h"
#include "font_AwesomeF080.h"
void setup()
{
tft.begin(RA8875_800x480);
tft.setFont(AwesomeF100_48);
tft.setCursor(300,100);
tft.print(char(18)); // icon
tft.setCursor(300,350);
tft.setFont(&Liberation_Mono_28);
tft.print("Hi");
}
void loop()
{
}
// test sketch for LolinD32 (ESP32)
// Johan Holstein @2021
#include <SPI.h>
#include <RA8875.h>
#define RA8875_CS 5
int i;
RA8875 tft = RA8875(RA8875_CS);
#include "font_DroidSansMono.h"
#include "font_AwesomeF000.h"
#include "font_AwesomeF200.h"
#include "font_AwesomeF180.h"
#include "font_AwesomeF100.h"
#include "font_AwesomeF080.h"
// colors
#define BackgroundColor 0x0000
#define TextColor 0xFFFF
char count[1000];
char old_count[1000];
uint16_t counter = 0;
int direction = 1;
void setup() {
tft.begin(RA8875_800x480);
tft.setCursor(250, 220);
tft.setFont(DroidSansMono_96);
tft.clearMemory();
}
void loop() {
dtostrf(counter, 4, 0, count);
for (int i = 0; i <= 3; i++) {
if (count[i] != old_count[i]) {
tft.setCursor(200 + i * 70, 250);
tft.setTextColor(BackgroundColor);
tft.print(old_count[i]);
tft.setCursor(200 + i * 70, 250);
tft.setTextColor(TextColor);
tft.print(count[i]);
}
}
counter = counter + direction;
if (counter == 12000) {
direction = -1;
}
if (counter == 0) {
direction = 1;
}
strncpy(old_count, count, 1000);
}