![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Fork of https://os.mbed.com/users/sebastiken/code/Adafruit_RA8875/ ; Adapted for use with K64F and in the process of adding more functions.
Diff: main.cpp
- Revision:
- 0:66c1aa3d198e
- Child:
- 2:040a687cea93
diff -r 000000000000 -r 66c1aa3d198e main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Sep 08 14:05:04 2017 +0000 @@ -0,0 +1,75 @@ +#include "RA8875.h" +//#include "Adafruit_GFX.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 #11 (Hardware SPI MOSI) +#define MOSI PTD6 +#define MISO PTD7 +#define SCLK PTD5 +#define CS PTD4 +#define RST PTD2 + + +Adafruit_RA8875 tft = Adafruit_RA8875(MOSI, MISO, SCLK, CS, RST); +uint16_t tx, ty; + +Serial pc(USBTX, USBRX); // tx, rxSerial pc(USBTX, USBRX); // tx, rx + +int main() +{ + pc.baud(9600); + pc.printf("RA8875 start\n"); + + /* Initialise the display using 'RA8875_480x272' or 'RA8875_800x480' */ + if (!tft.begin(RA8875_480x272)) { + pc.printf("RA8875 Not Found!\n"); + while (1); + } + + tft.displayOn(true); + tft.GPIOX(true); // Enable TFT - display enable tied to GPIOX + tft.PWM1config(true, RA8875_PWM_CLK_DIV1024); // PWM output for backlight + tft.PWM1out(255); + tft.fillScreen(RA8875_BLACK); + + /* Switch to text mode */ + tft.textMode(); + + + + /* Set a solid for + bg color ... */ + + /* ... or a fore color plus a transparent background */ + + + /* Set the cursor location (in pixels) */ + tft.textSetCursor(10, 10); + + /* Render some text! */ + 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); + tft.textSetCursor(100, 150); + tft.textEnlarge(2); + tft.textWrite(string); +} \ No newline at end of file