Kerry Martin
/
Liz_Test_Code
KSM edits
Diff: main.cpp
- Revision:
- 5:bb970d40cd7d
- Parent:
- 3:ca6a1026c28e
- Child:
- 6:8e392d0ff74a
--- a/main.cpp Sun Dec 28 21:59:47 2014 +0000 +++ b/main.cpp Thu Dec 17 12:17:00 2015 +0000 @@ -1,69 +1,51 @@ #include "mbed.h" #include "RA8875.h" - +#include "MyFont18x32.h" +#include "BPG_Arial08x08.h" +#include "BPG_Arial10x10.h" +#include "BPG_Arial20x20.h" +#include "BPG_Arial31x32.h" +#include "BPG_Arial63x63.h" -Serial pc(USBTX, USBRX); +LocalFileSystem local("local"); // Because I want <PrintScreen> +Serial pc(USBTX, USBRX); // And a little feedback int main() { - int i; - Timer t; - float f = 10000000; + RA8875 lcd(p5, p6, p7, p12, NC, "tft"); // MOSI, MISO, SCK, /ChipSelect, /reset, name - pc.baud(460800); // I like a snappy terminal, so crank it up! - pc.printf("\r\nRA8875 Test - Build " __DATE__ " " __TIME__ "\r\n"); - - pc.printf("Turning on display\r\n"); - RA8875 lcd(p5, p6, p7, p12, NC, "tft"); // MOSI, MISO, SCK, /ChipSelect, /reset, name + pc.baud(460800); // I like a snappy terminal, so crank it up! + pc.printf("\r\nRA8875 Soft Fonts - Build " __DATE__ " " __TIME__ "\r\n"); - t.start(); lcd.init(); - lcd.frequency(f); - lcd.cls(); - wait_ms(250); - uint32_t tStart = t.read_us(); - lcd.puts(0,0, - "RA8875 lcd(p5, p6, p7, p12, NC, \"tft\");\r\n" - "lcd.init(true, 480,272,16);\r\n" - "lcd.circle( 400,25, 25, BrightRed);\r\n" - "lcd.fillcircle( 400,25, 15, RGB(128,255,128));\r\n" - "lcd.ellipse( 440,75, 35,20, BrightBlue);\r\n" - "lcd.fillellipse( 440,75, 25,10, Blue);\r\n" - "lcd.triangle( 440,100, 475,110, 450,125, Magenta);\r\n" - "lcd.filltriangle( 445,105, 467,111, 452,120, Cyan);\r\n" - "lcd.rect( 400,130, 475,155, Brown);\r\n" - "lcd.fillrect( 405,135, 470,150, Pink);\r\n" - "lcd.roundrect( 410,160, 475,190, 10,8, Yellow);\r\n" - "lcd.fillroundrect(415,165, 470,185, 5,3, Orange);\r\n" - "lcd.line( 430,200, 460,230, RGB(0,255,0));\r\n" - "for (i=0; i<=30; i+=5)\r\n" - " lcd.pixel(435+i,200+i, White);"); + RunTestSet(lcd, pc); + lcd.foreground(BrightBlue); + lcd.puts(0,0, "RA8875 Soft Fonts - Build " __DATE__ " " __TIME__ "\r\n"); - lcd.circle( 400,25, 25, BrightRed); - lcd.fillcircle( 400,25, 15, RGB(128,255,128)); - lcd.ellipse( 440,75, 35,20, BrightBlue); - lcd.fillellipse( 440,75, 25,10, Blue); - lcd.triangle( 440,100, 475,110, 450,125, Magenta); - lcd.filltriangle( 445,105, 467,111, 452,120, Cyan); - lcd.rect( 400,130, 475,155, Brown); - lcd.fillrect( 405,135, 470,150, Pink); - lcd.roundrect( 410,160, 475,190, 10,8, Yellow); - lcd.fillroundrect(415,165, 470,185, 5,3, Orange); - lcd.line( 430,200, 460,230, RGB(0,255,0)); - for (i=0; i<=30; i+=5) - lcd.pixel(435+i,200+i, White); - uint32_t tEnd = t.read_us(); - pc.printf("@ %4.2f MHz, elapsed time is %u usec.\r\n", (float)f/1000000, tEnd-tStart); + 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 ABCD\r\n"); + lcd.SelectUserFont(BPG_Arial31x32); + lcd.puts("BPG_Arial31x32 ABCD\r\n"); + lcd.SelectUserFont(BPG_Arial63x63); + lcd.puts("BPG_Arial63x63 ABCD\r\n"); + + RetCode_t r = lcd.PrintScreen(0,0,480,272,"/local/file.bmp"); + pc.printf(" PrintScreen returned %d\r\n", r); - lcd.KeypadInit(); while(1) { - while(!lcd.readable()) - ; - if (lcd.readable()) { - int k = lcd.getc(); - pc.printf("key: %02X \r\n", k); - } - wait_ms(50); + ; // end } }