Demonstration of Soft Fonts
Fork of RA8875_Demo by
Demo of Software based fonts mixed with RA8875 hosted fonts.
main.cpp@16:c64e1fe2392f, 2019-07-28 (annotated)
- Committer:
- WiredHome
- Date:
- Sun Jul 28 03:23:53 2019 +0000
- Revision:
- 16:c64e1fe2392f
- Parent:
- 15:b4e3349cd319
Update RA lib
Who changed what in which revision?
User | Revision | Line number | New 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 | 16:c64e1fe2392f | 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 | 5:bb970d40cd7d | 28 | pc.baud(460800); // I like a snappy terminal, so crank it up! |
WiredHome | 5:bb970d40cd7d | 29 | pc.printf("\r\nRA8875 Soft Fonts - Build " __DATE__ " " __TIME__ "\r\n"); |
WiredHome | 2:2076d9cc6db9 | 30 | |
WiredHome | 13:43cc0a997c53 | 31 | measurement.start(); |
WiredHome | 16:c64e1fe2392f | 32 | lcd.init(800,480,8, 30); |
WiredHome | 6:8e392d0ff74a | 33 | |
WiredHome | 6:8e392d0ff74a | 34 | // ************************** |
WiredHome | 10:02c622fa4969 | 35 | //RunTestSet(lcd, pc); // If the library was compiled for test mode... |
WiredHome | 6:8e392d0ff74a | 36 | |
WiredHome | 10:02c622fa4969 | 37 | lcd.foreground(RGB(255,255,0)); |
WiredHome | 5:bb970d40cd7d | 38 | lcd.puts(0,0, "RA8875 Soft Fonts - Build " __DATE__ " " __TIME__ "\r\n"); |
WiredHome | 0:037b95a5cc85 | 39 | |
WiredHome | 5:bb970d40cd7d | 40 | lcd.SelectUserFont(Dave_Smart18x32); |
WiredHome | 5:bb970d40cd7d | 41 | lcd.puts("**** ! Soft Fonts ! **** 0123456789\r\n"); |
WiredHome | 5:bb970d40cd7d | 42 | lcd.puts("ABCDEFGHIJKLMNOPQRSTUVWXYZ\r\n"); |
WiredHome | 10:02c622fa4969 | 43 | //lcd.puts("abcdefghijklmnopqrstuvwxyz\r\n"); |
WiredHome | 5:bb970d40cd7d | 44 | lcd.SelectUserFont(); |
WiredHome | 5:bb970d40cd7d | 45 | lcd.puts("Back to normal\r\n"); |
WiredHome | 5:bb970d40cd7d | 46 | lcd.SelectUserFont(BPG_Arial08x08); |
WiredHome | 5:bb970d40cd7d | 47 | lcd.puts("BPG_Arial08x08 ABCDEFGHIJKLMNOPQRSTUVWXYZ\r\n"); |
WiredHome | 10:02c622fa4969 | 48 | //lcd.puts("BPG_Arial08x08 abcdefghijklmnopqrstuvwxyz\r\n"); |
WiredHome | 5:bb970d40cd7d | 49 | lcd.SelectUserFont(BPG_Arial10x10); |
WiredHome | 5:bb970d40cd7d | 50 | lcd.puts("BPG_Arial10x10 ABCDEFGHIJKLMNOPQRSTUVWXYZ\r\n"); |
WiredHome | 10:02c622fa4969 | 51 | //lcd.puts("BPG_Arial10x10 abcdefghijklmnopqrstuvwxyz\r\n"); |
WiredHome | 5:bb970d40cd7d | 52 | lcd.SelectUserFont(BPG_Arial20x20); |
WiredHome | 10:02c622fa4969 | 53 | lcd.puts("BPG_Arial20x20 "); |
WiredHome | 5:bb970d40cd7d | 54 | lcd.SelectUserFont(BPG_Arial31x32); |
WiredHome | 15:b4e3349cd319 | 55 | lcd.puts("B32\r\n"); |
WiredHome | 5:bb970d40cd7d | 56 | lcd.SelectUserFont(BPG_Arial63x63); |
WiredHome | 15:b4e3349cd319 | 57 | lcd.puts("B63"); |
WiredHome | 15:b4e3349cd319 | 58 | lcd.SetTextFontSize(2); |
WiredHome | 15:b4e3349cd319 | 59 | lcd.puts("x2"); |
WiredHome | 15:b4e3349cd319 | 60 | lcd.SetTextCursor(300, 10); |
WiredHome | 15:b4e3349cd319 | 61 | lcd.SetTextFontSize(3); |
WiredHome | 15:b4e3349cd319 | 62 | lcd.SelectUserFont(FixedWidth_54x96); |
WiredHome | 15:b4e3349cd319 | 63 | lcd.puts("A"); |
WiredHome | 13:43cc0a997c53 | 64 | pc.printf("Time trial completed in %d uSec\r\n", measurement.read_us()); |
WiredHome | 5:bb970d40cd7d | 65 | |
WiredHome | 15:b4e3349cd319 | 66 | //pc.printf("PrintScreen activated ...\r\n"); |
WiredHome | 15:b4e3349cd319 | 67 | //RetCode_t r = lcd.PrintScreen(0,0,480,272,"/local/file.bmp"); |
WiredHome | 15:b4e3349cd319 | 68 | //pc.printf(" PrintScreen returned %d\r\n", r); |
WiredHome | 3:ca6a1026c28e | 69 | |
WiredHome | 3:ca6a1026c28e | 70 | while(1) { |
WiredHome | 5:bb970d40cd7d | 71 | ; // end |
WiredHome | 3:ca6a1026c28e | 72 | } |
WiredHome | 0:037b95a5cc85 | 73 | } |