Fork of https://os.mbed.com/users/sebastiken/code/Adafruit_RA8875/ ; Adapted for use with K64F and in the process of adding more functions.
main.cpp
- Committer:
- sebastiken
- Date:
- 2017-09-08
- Revision:
- 2:040a687cea93
- Parent:
- 0:66c1aa3d198e
- Child:
- 3:4a3e169866a2
File content as of revision 2:040a687cea93:
#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[] = "Hello, Nehuen! "; 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); tft.drawCircle(100, 100, 50, RA8875_RED); tft.fillCircle(100, 100, 50, RA8875_RED); }