Demonstration of Soft Fonts

Dependencies:   mbed RA8875

Fork of RA8875_Demo by David Smart

Demo of Software based fonts mixed with RA8875 hosted fonts.

/media/uploads/WiredHome/softfont2.png

Committer:
WiredHome
Date:
Mon Mar 04 12:14:35 2019 +0000
Revision:
15:b4e3349cd319
Parent:
14:07b3f223d9ba
Child:
16:c64e1fe2392f
Update RA8875 Lib to add GSL1680 support.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
WiredHome 15:b4e3349cd319 1 // mbed version Graphics Working PrintScreen Working? "/local/file.bmp"
WiredHome 15:b4e3349cd319 2 // v148 Yes No, FILE *Image = fopen(Name_BMP, "wb"); fails
WiredHome 15:b4e3349cd319 3 // v142 Yes No, FILE *Image = fopen(Name_BMP, "wb"); fails
WiredHome 15:b4e3349cd319 4 // v140 Yes No, FILE *Image = fopen(Name_BMP, "wb"); fails
WiredHome 15:b4e3349cd319 5 // v138 Yes No, FILE *Image = fopen(Name_BMP, "wb"); fails
WiredHome 15:b4e3349cd319 6 // v137 Yes Yes
WiredHome 15:b4e3349cd319 7 // v136 Yes Yes
WiredHome 15:b4e3349cd319 8 // v128 Yes Yes
WiredHome 0:037b95a5cc85 9
WiredHome 15:b4e3349cd319 10 #include "mbed.h" // v137
WiredHome 15:b4e3349cd319 11 #include "RA8875.h" // v148
WiredHome 5:bb970d40cd7d 12 #include "BPG_Arial08x08.h"
WiredHome 5:bb970d40cd7d 13 #include "BPG_Arial10x10.h"
WiredHome 5:bb970d40cd7d 14 #include "BPG_Arial20x20.h"
WiredHome 5:bb970d40cd7d 15 #include "BPG_Arial31x32.h"
WiredHome 5:bb970d40cd7d 16 #include "BPG_Arial63x63.h"
WiredHome 15:b4e3349cd319 17 #include "FixedFont54x96.h"
WiredHome 15:b4e3349cd319 18 #include "MyFont18x32.h"
WiredHome 0:037b95a5cc85 19
WiredHome 15:b4e3349cd319 20 RA8875 lcd(p5, p6, p7, p12, NC, "tft"); // MOSI, MISO, SCK, /ChipSelect, /reset, name
WiredHome 5:bb970d40cd7d 21 LocalFileSystem local("local"); // Because I want <PrintScreen>
WiredHome 5:bb970d40cd7d 22 Serial pc(USBTX, USBRX); // And a little feedback
WiredHome 13:43cc0a997c53 23 Timer measurement;
WiredHome 0:037b95a5cc85 24
WiredHome 15:b4e3349cd319 25
WiredHome 0:037b95a5cc85 26 int main()
WiredHome 0:037b95a5cc85 27 {
WiredHome 2:2076d9cc6db9 28
WiredHome 5:bb970d40cd7d 29 pc.baud(460800); // I like a snappy terminal, so crank it up!
WiredHome 5:bb970d40cd7d 30 pc.printf("\r\nRA8875 Soft Fonts - Build " __DATE__ " " __TIME__ "\r\n");
WiredHome 2:2076d9cc6db9 31
WiredHome 13:43cc0a997c53 32 measurement.start();
WiredHome 15:b4e3349cd319 33 lcd.init(480,272,8, 30);
WiredHome 6:8e392d0ff74a 34
WiredHome 6:8e392d0ff74a 35 // **************************
WiredHome 10:02c622fa4969 36 //RunTestSet(lcd, pc); // If the library was compiled for test mode...
WiredHome 6:8e392d0ff74a 37
WiredHome 10:02c622fa4969 38 lcd.foreground(RGB(255,255,0));
WiredHome 5:bb970d40cd7d 39 lcd.puts(0,0, "RA8875 Soft Fonts - Build " __DATE__ " " __TIME__ "\r\n");
WiredHome 0:037b95a5cc85 40
WiredHome 5:bb970d40cd7d 41 lcd.SelectUserFont(Dave_Smart18x32);
WiredHome 5:bb970d40cd7d 42 lcd.puts("**** ! Soft Fonts ! **** 0123456789\r\n");
WiredHome 5:bb970d40cd7d 43 lcd.puts("ABCDEFGHIJKLMNOPQRSTUVWXYZ\r\n");
WiredHome 10:02c622fa4969 44 //lcd.puts("abcdefghijklmnopqrstuvwxyz\r\n");
WiredHome 5:bb970d40cd7d 45 lcd.SelectUserFont();
WiredHome 5:bb970d40cd7d 46 lcd.puts("Back to normal\r\n");
WiredHome 5:bb970d40cd7d 47 lcd.SelectUserFont(BPG_Arial08x08);
WiredHome 5:bb970d40cd7d 48 lcd.puts("BPG_Arial08x08 ABCDEFGHIJKLMNOPQRSTUVWXYZ\r\n");
WiredHome 10:02c622fa4969 49 //lcd.puts("BPG_Arial08x08 abcdefghijklmnopqrstuvwxyz\r\n");
WiredHome 5:bb970d40cd7d 50 lcd.SelectUserFont(BPG_Arial10x10);
WiredHome 5:bb970d40cd7d 51 lcd.puts("BPG_Arial10x10 ABCDEFGHIJKLMNOPQRSTUVWXYZ\r\n");
WiredHome 10:02c622fa4969 52 //lcd.puts("BPG_Arial10x10 abcdefghijklmnopqrstuvwxyz\r\n");
WiredHome 5:bb970d40cd7d 53 lcd.SelectUserFont(BPG_Arial20x20);
WiredHome 10:02c622fa4969 54 lcd.puts("BPG_Arial20x20 ");
WiredHome 5:bb970d40cd7d 55 lcd.SelectUserFont(BPG_Arial31x32);
WiredHome 15:b4e3349cd319 56 lcd.puts("B32\r\n");
WiredHome 5:bb970d40cd7d 57 lcd.SelectUserFont(BPG_Arial63x63);
WiredHome 15:b4e3349cd319 58 lcd.puts("B63");
WiredHome 15:b4e3349cd319 59 lcd.SetTextFontSize(2);
WiredHome 15:b4e3349cd319 60 lcd.puts("x2");
WiredHome 15:b4e3349cd319 61 lcd.SetTextCursor(300, 10);
WiredHome 15:b4e3349cd319 62 lcd.SetTextFontSize(3);
WiredHome 15:b4e3349cd319 63 lcd.SelectUserFont(FixedWidth_54x96);
WiredHome 15:b4e3349cd319 64 lcd.puts("A");
WiredHome 13:43cc0a997c53 65 pc.printf("Time trial completed in %d uSec\r\n", measurement.read_us());
WiredHome 5:bb970d40cd7d 66
WiredHome 15:b4e3349cd319 67 //pc.printf("PrintScreen activated ...\r\n");
WiredHome 15:b4e3349cd319 68 //RetCode_t r = lcd.PrintScreen(0,0,480,272,"/local/file.bmp");
WiredHome 15:b4e3349cd319 69 //pc.printf(" PrintScreen returned %d\r\n", r);
WiredHome 3:ca6a1026c28e 70
WiredHome 3:ca6a1026c28e 71 while(1) {
WiredHome 5:bb970d40cd7d 72 ; // end
WiredHome 3:ca6a1026c28e 73 }
WiredHome 0:037b95a5cc85 74 }