yay!
This commit is contained in:
@@ -1,7 +1,28 @@
|
||||
/******************************************************************
|
||||
This is an example for the Adafruit RA8875 Driver board for TFT displays
|
||||
---------------> http://www.adafruit.com/products/1590
|
||||
The RA8875 is a TFT driver for up to 800x480 dotclock'd displays
|
||||
It is tested to work with displays in the Adafruit shop. Other displays
|
||||
may need timing adjustments and are not guanteed to work.
|
||||
|
||||
Adafruit invests time and resources providing this open
|
||||
source code, please support Adafruit and open-source hardware
|
||||
by purchasing products from Adafruit!
|
||||
|
||||
Written by Limor Fried/Ladyada for Adafruit Industries.
|
||||
BSD license, check license.txt for more information.
|
||||
All text above must be included in any redistribution.
|
||||
******************************************************************/
|
||||
|
||||
|
||||
#include <SPI.h>
|
||||
#include "Adafruit_GFX.h"
|
||||
#include "Adafruit_RA8875.h"
|
||||
|
||||
// Library only supports hardware SPI at this time
|
||||
// Connect SCLK to UNO Digital #13 (Hardware SPI clock)
|
||||
// Connect MISO to UNO Digital #12 (Hardware SPI MISO)
|
||||
// Connect MOSI to UNO Digital #13 (Hardware SPI MOSI)
|
||||
#define RA8875_INT 3
|
||||
#define RA8875_CS 10
|
||||
#define RA8875_RESET 9
|
||||
@@ -15,7 +36,7 @@ void setup()
|
||||
Serial.println("RA8875 start");
|
||||
|
||||
/* Initialise the display using 'RA8875_480x272' or 'RA8875_800x480' */
|
||||
if (!tft.begin(RA8875_800x480)) {
|
||||
if (!tft.begin(RA8875_480x272)) {
|
||||
Serial.println("RA8875 Not Found!");
|
||||
while (1);
|
||||
}
|
||||
@@ -29,32 +50,41 @@ void setup()
|
||||
/* Switch to text mode */
|
||||
tft.textMode();
|
||||
|
||||
/* If necessary, enlarge the font */
|
||||
// tft.textEnlarge(0);
|
||||
|
||||
|
||||
/* Set a solid for + bg color ... */
|
||||
// tft.textColor(RA8875_WHITE, RA8875_RED);
|
||||
|
||||
/* ... or a fore color plus a transparent background */
|
||||
tft.textTransparent(RA8875_WHITE);
|
||||
|
||||
|
||||
/* Set the cursor location (in pixels) */
|
||||
tft.textSetCursor(10, 10);
|
||||
|
||||
/* Render some text! */
|
||||
uint8_t string[15] = "Hello, World! ";
|
||||
tft.textWrite(string, 15);
|
||||
tft.textWrite(string, 15);
|
||||
tft.textWrite(string, 15);
|
||||
tft.textWrite(string, 15);
|
||||
tft.textWrite(string, 15);
|
||||
tft.textWrite(string, 15);
|
||||
char string[15] = "Hello, World! ";
|
||||
tft.textTransparent(RA8875_WHITE);
|
||||
tft.textWrite(string);
|
||||
tft.textColor(RA8875_WHITE, RA8875_RED);
|
||||
tft.textWrite(string);
|
||||
tft.textTransparent(RA8875_CYAN);
|
||||
tft.textWrite(string);
|
||||
tft.textTransparent(RA8875_GREEN);
|
||||
tft.textWrite(string);
|
||||
tft.textColor(RA8875_YELLOW, RA8875_CYAN);
|
||||
tft.textWrite(string);
|
||||
tft.textColor(RA8875_BLACK, RA8875_MAGENTA);
|
||||
tft.textWrite(string);
|
||||
|
||||
/* Change the cursor location and color ... */
|
||||
tft.textSetCursor(100, 100);
|
||||
tft.textTransparent(RA8875_RED);
|
||||
/* If necessary, enlarge the font */
|
||||
tft.textEnlarge(1);
|
||||
/* ... and render some more text! */
|
||||
tft.textWrite(string, 15);
|
||||
tft.textWrite(string, 15);
|
||||
tft.textWrite(string);
|
||||
tft.textSetCursor(100, 150);
|
||||
tft.textEnlarge(2);
|
||||
tft.textWrite(string);
|
||||
}
|
||||
|
||||
void loop()
|
||||
|
||||
Reference in New Issue
Block a user