Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
- Committer:
- WiredHome
- Date:
- 2017-08-06
- Revision:
- 16:231837aa2c37
- Parent:
- 15:ab07c064c952
- Child:
- 17:c8ef96a6e43b
File content as of revision 16:231837aa2c37:
//
// Demo Program
#include "mbed.h" // v128 - tested working
#include "RA8875.h" // v148 - tested working
#include "MyFont18x32.h"
#include "BPG_Arial08x08.h"
#include "BPG_Arial10x10.h"
#include "BPG_Arial20x20.h"
#include "BPG_Arial31x32.h"
#include "BPG_Arial63x63.h"
// These two defines can be enabled, or commented out
#define BIG_SCREEN
#define CAP_TOUCH
#define LCD_C 16 // color - bits per pixel
#ifdef CAP_TOUCH
RA8875 lcd(p5, p6, p7, p12, NC, p9,p10,p13, "tft"); // MOSI,MISO,SCK,/ChipSelect,/reset, SDA,SCL,/IRQ, name
#else
RA8875 lcd(p5, p6, p7, p12, NC, "tft"); //MOSI, MISO, SCK, /ChipSelect, /reset, name
#endif
LocalFileSystem local("local"); // access to calibration file for resistive touch.
#ifdef BIG_SCREEN
#define LCD_W 800
#define LCD_H 480
#else
#define LCD_W 480
#define LCD_H 272
#endif
Serial pc(USBTX, USBRX); // And a little feedback
Timer measurement;
int main()
{
pc.baud(460800); // I like a snappy terminal, so crank it up!
pc.printf("\r\nRA8875 Soft Fonts - Build " __DATE__ " " __TIME__ "\r\n");
measurement.start();
lcd.init(LCD_W, LCD_H, LCD_C);
lcd.Backlight(0.5f);
// **************************
//RunTestSet(lcd, pc); // If the library was compiled for test mode...
lcd.foreground(RGB(255,255,0));
lcd.puts(0,0, "RA8875 Soft Fonts - Build " __DATE__ " " __TIME__ "\r\n");
lcd.SelectUserFont(Dave_Smart18x32);
lcd.puts("**** ! Soft Fonts ! **** 0123456789\r\n");
lcd.puts("ABCDEFGHIJKLMNOPQRSTUVWXYZ\r\n");
//lcd.puts("abcdefghijklmnopqrstuvwxyz\r\n");
lcd.SelectUserFont();
lcd.puts("Back to normal\r\n");
lcd.SelectUserFont(BPG_Arial08x08);
lcd.puts("BPG_Arial08x08 ABCDEFGHIJKLMNOPQRSTUVWXYZ\r\n");
//lcd.puts("BPG_Arial08x08 abcdefghijklmnopqrstuvwxyz\r\n");
lcd.SelectUserFont(BPG_Arial10x10);
lcd.puts("BPG_Arial10x10 ABCDEFGHIJKLMNOPQRSTUVWXYZ\r\n");
//lcd.puts("BPG_Arial10x10 abcdefghijklmnopqrstuvwxyz\r\n");
lcd.SelectUserFont(BPG_Arial20x20);
lcd.puts("BPG_Arial20x20 ");
lcd.SelectUserFont(BPG_Arial31x32);
lcd.puts("BPG_Arial31x32\r\n");
lcd.SelectUserFont(BPG_Arial63x63);
lcd.puts("BPG_Arial63x63");
pc.printf("Time trial completed in %d uSec\r\n", measurement.read_us());
pc.printf("PrintScreen activated ...\r\n");
RetCode_t r = lcd.PrintScreen(0,0,LCD_W,LCD_H,"/local/file.bmp");
pc.printf(" PrintScreen returned %d\r\n", r);
while(1) {
; // end
}
}
RA8875: 4" to 8" (WQVGA, WVGA, Multi-Touch, Keypad)