Demonstration of Soft Fonts

Dependencies:   mbed RA8875

Fork of RA8875_Demo by David Smart

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 //  mbed version   Graphics Working   PrintScreen Working? "/local/file.bmp"
00002 //  v148           Yes                No,   FILE *Image = fopen(Name_BMP, "wb"); fails
00003 //  v142           Yes                No,   FILE *Image = fopen(Name_BMP, "wb"); fails
00004 //  v140           Yes                No,   FILE *Image = fopen(Name_BMP, "wb"); fails
00005 //  v138           Yes                No,   FILE *Image = fopen(Name_BMP, "wb"); fails
00006 //  v137           Yes                Yes
00007 //  v136           Yes                Yes
00008 //  v128           Yes                Yes
00009 
00010 #include "mbed.h"           // v137
00011 #include "RA8875.h"         // v148
00012 #include "BPG_Arial08x08.h"
00013 #include "BPG_Arial10x10.h"
00014 #include "BPG_Arial20x20.h"
00015 #include "BPG_Arial31x32.h"
00016 #include "BPG_Arial63x63.h"
00017 #include "FixedFont54x96.h"
00018 #include "MyFont18x32.h"
00019 
00020 RA8875 lcd(p5,p6,p7,p12,NC, "tft");    // MOSI, MISO, SCK, /ChipSelect, /reset, name
00021 LocalFileSystem local("local");     // Because I want <PrintScreen>
00022 Serial pc(USBTX, USBRX);            // And a little feedback
00023 Timer measurement;
00024 
00025 
00026 int main()
00027 {
00028     pc.baud(460800);                            // I like a snappy terminal, so crank it up!
00029     pc.printf("\r\nRA8875 Soft Fonts - Build " __DATE__ " " __TIME__ "\r\n");
00030 
00031     measurement.start();
00032     lcd.init(800,480,8, 30);
00033     
00034     // **************************
00035     //RunTestSet(lcd, pc);  // If the library was compiled for test mode...
00036     
00037     lcd.foreground(RGB(255,255,0));
00038     lcd.puts(0,0, "RA8875 Soft Fonts - Build " __DATE__ " " __TIME__ "\r\n");
00039 
00040     lcd.SelectUserFont(Dave_Smart18x32);
00041     lcd.puts("**** ! Soft Fonts ! **** 0123456789\r\n");
00042     lcd.puts("ABCDEFGHIJKLMNOPQRSTUVWXYZ\r\n");
00043     //lcd.puts("abcdefghijklmnopqrstuvwxyz\r\n");
00044     lcd.SelectUserFont();
00045     lcd.puts("Back to normal\r\n");
00046     lcd.SelectUserFont(BPG_Arial08x08);
00047     lcd.puts("BPG_Arial08x08 ABCDEFGHIJKLMNOPQRSTUVWXYZ\r\n");
00048     //lcd.puts("BPG_Arial08x08 abcdefghijklmnopqrstuvwxyz\r\n");    
00049     lcd.SelectUserFont(BPG_Arial10x10);
00050     lcd.puts("BPG_Arial10x10 ABCDEFGHIJKLMNOPQRSTUVWXYZ\r\n");
00051     //lcd.puts("BPG_Arial10x10 abcdefghijklmnopqrstuvwxyz\r\n");
00052     lcd.SelectUserFont(BPG_Arial20x20);
00053     lcd.puts("BPG_Arial20x20  ");
00054     lcd.SelectUserFont(BPG_Arial31x32);
00055     lcd.puts("B32\r\n");
00056     lcd.SelectUserFont(BPG_Arial63x63);
00057     lcd.puts("B63");
00058     lcd.SetTextFontSize(2);
00059     lcd.puts("x2");
00060     lcd.SetTextCursor(300, 10);
00061     lcd.SetTextFontSize(3);
00062     lcd.SelectUserFont(FixedWidth_54x96);
00063     lcd.puts("A");
00064     pc.printf("Time trial completed in %d uSec\r\n", measurement.read_us());
00065 
00066     //pc.printf("PrintScreen activated ...\r\n");
00067     //RetCode_t r = lcd.PrintScreen(0,0,480,272,"/local/file.bmp");
00068     //pc.printf("  PrintScreen returned %d\r\n", r);
00069     
00070     while(1) {
00071         ;       // end
00072     }
00073 }