Kerry Martin
/
Liz_Test_Code
KSM edits
main.cpp@17:c8ef96a6e43b, 2017-08-06 (annotated)
- Committer:
- WiredHome
- Date:
- Sun Aug 06 15:06:08 2017 +0000
- Revision:
- 17:c8ef96a6e43b
- Parent:
- 16:231837aa2c37
- Child:
- 18:307303d9c8f6
Update libs. RA8875 v148, mbed v137.; Any newer mbed lib works ok for graphics, fails for file write to local file system for printscreen.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
WiredHome | 16:231837aa2c37 | 1 | // |
WiredHome | 16:231837aa2c37 | 2 | // Demo Program |
WiredHome | 17:c8ef96a6e43b | 3 | // mbed version Graphics Working PrintScreen Working? "/local/file.bmp" |
WiredHome | 17:c8ef96a6e43b | 4 | // v148 Yes No, FILE *Image = fopen(Name_BMP, "wb"); fails |
WiredHome | 17:c8ef96a6e43b | 5 | // v142 Yes No, FILE *Image = fopen(Name_BMP, "wb"); fails |
WiredHome | 17:c8ef96a6e43b | 6 | // v140 Yes No, FILE *Image = fopen(Name_BMP, "wb"); fails |
WiredHome | 17:c8ef96a6e43b | 7 | // v138 Yes No, FILE *Image = fopen(Name_BMP, "wb"); fails |
WiredHome | 17:c8ef96a6e43b | 8 | // v137 Yes Yes |
WiredHome | 17:c8ef96a6e43b | 9 | // v136 Yes Yes |
WiredHome | 17:c8ef96a6e43b | 10 | // v128 Yes Yes |
WiredHome | 17:c8ef96a6e43b | 11 | // |
WiredHome | 17:c8ef96a6e43b | 12 | #include "mbed.h" // testing: v147 - working: v146, v145, v142, v136, v128, fails: v148 |
WiredHome | 17:c8ef96a6e43b | 13 | #include "RA8875.h" // v138 - tested working |
WiredHome | 5:bb970d40cd7d | 14 | #include "MyFont18x32.h" |
WiredHome | 5:bb970d40cd7d | 15 | #include "BPG_Arial08x08.h" |
WiredHome | 5:bb970d40cd7d | 16 | #include "BPG_Arial10x10.h" |
WiredHome | 5:bb970d40cd7d | 17 | #include "BPG_Arial20x20.h" |
WiredHome | 5:bb970d40cd7d | 18 | #include "BPG_Arial31x32.h" |
WiredHome | 5:bb970d40cd7d | 19 | #include "BPG_Arial63x63.h" |
WiredHome | 0:037b95a5cc85 | 20 | |
WiredHome | 15:ab07c064c952 | 21 | // These two defines can be enabled, or commented out |
WiredHome | 16:231837aa2c37 | 22 | #define BIG_SCREEN |
WiredHome | 16:231837aa2c37 | 23 | #define CAP_TOUCH |
WiredHome | 15:ab07c064c952 | 24 | #define LCD_C 16 // color - bits per pixel |
WiredHome | 15:ab07c064c952 | 25 | |
WiredHome | 15:ab07c064c952 | 26 | #ifdef CAP_TOUCH |
WiredHome | 15:ab07c064c952 | 27 | RA8875 lcd(p5, p6, p7, p12, NC, p9,p10,p13, "tft"); // MOSI,MISO,SCK,/ChipSelect,/reset, SDA,SCL,/IRQ, name |
WiredHome | 15:ab07c064c952 | 28 | #else |
WiredHome | 15:ab07c064c952 | 29 | RA8875 lcd(p5, p6, p7, p12, NC, "tft"); //MOSI, MISO, SCK, /ChipSelect, /reset, name |
WiredHome | 16:231837aa2c37 | 30 | #endif |
WiredHome | 17:c8ef96a6e43b | 31 | LocalFileSystem local("local"); // access to calibration file for resistive touch and printscreen |
WiredHome | 15:ab07c064c952 | 32 | |
WiredHome | 15:ab07c064c952 | 33 | #ifdef BIG_SCREEN |
WiredHome | 15:ab07c064c952 | 34 | #define LCD_W 800 |
WiredHome | 15:ab07c064c952 | 35 | #define LCD_H 480 |
WiredHome | 15:ab07c064c952 | 36 | #else |
WiredHome | 15:ab07c064c952 | 37 | #define LCD_W 480 |
WiredHome | 15:ab07c064c952 | 38 | #define LCD_H 272 |
WiredHome | 15:ab07c064c952 | 39 | #endif |
WiredHome | 15:ab07c064c952 | 40 | |
WiredHome | 5:bb970d40cd7d | 41 | Serial pc(USBTX, USBRX); // And a little feedback |
WiredHome | 13:43cc0a997c53 | 42 | Timer measurement; |
WiredHome | 0:037b95a5cc85 | 43 | |
WiredHome | 0:037b95a5cc85 | 44 | int main() |
WiredHome | 0:037b95a5cc85 | 45 | { |
WiredHome | 5:bb970d40cd7d | 46 | pc.baud(460800); // I like a snappy terminal, so crank it up! |
WiredHome | 5:bb970d40cd7d | 47 | pc.printf("\r\nRA8875 Soft Fonts - Build " __DATE__ " " __TIME__ "\r\n"); |
WiredHome | 2:2076d9cc6db9 | 48 | |
WiredHome | 13:43cc0a997c53 | 49 | measurement.start(); |
WiredHome | 15:ab07c064c952 | 50 | lcd.init(LCD_W, LCD_H, LCD_C); |
WiredHome | 15:ab07c064c952 | 51 | lcd.Backlight(0.5f); |
WiredHome | 15:ab07c064c952 | 52 | |
WiredHome | 6:8e392d0ff74a | 53 | // ************************** |
WiredHome | 9:02c622fa4969 | 54 | //RunTestSet(lcd, pc); // If the library was compiled for test mode... |
WiredHome | 6:8e392d0ff74a | 55 | |
WiredHome | 9:02c622fa4969 | 56 | lcd.foreground(RGB(255,255,0)); |
WiredHome | 5:bb970d40cd7d | 57 | lcd.puts(0,0, "RA8875 Soft Fonts - Build " __DATE__ " " __TIME__ "\r\n"); |
WiredHome | 0:037b95a5cc85 | 58 | |
WiredHome | 5:bb970d40cd7d | 59 | lcd.SelectUserFont(Dave_Smart18x32); |
WiredHome | 5:bb970d40cd7d | 60 | lcd.puts("**** ! Soft Fonts ! **** 0123456789\r\n"); |
WiredHome | 5:bb970d40cd7d | 61 | lcd.puts("ABCDEFGHIJKLMNOPQRSTUVWXYZ\r\n"); |
WiredHome | 9:02c622fa4969 | 62 | //lcd.puts("abcdefghijklmnopqrstuvwxyz\r\n"); |
WiredHome | 5:bb970d40cd7d | 63 | lcd.SelectUserFont(); |
WiredHome | 5:bb970d40cd7d | 64 | lcd.puts("Back to normal\r\n"); |
WiredHome | 5:bb970d40cd7d | 65 | lcd.SelectUserFont(BPG_Arial08x08); |
WiredHome | 5:bb970d40cd7d | 66 | lcd.puts("BPG_Arial08x08 ABCDEFGHIJKLMNOPQRSTUVWXYZ\r\n"); |
WiredHome | 9:02c622fa4969 | 67 | //lcd.puts("BPG_Arial08x08 abcdefghijklmnopqrstuvwxyz\r\n"); |
WiredHome | 5:bb970d40cd7d | 68 | lcd.SelectUserFont(BPG_Arial10x10); |
WiredHome | 5:bb970d40cd7d | 69 | lcd.puts("BPG_Arial10x10 ABCDEFGHIJKLMNOPQRSTUVWXYZ\r\n"); |
WiredHome | 9:02c622fa4969 | 70 | //lcd.puts("BPG_Arial10x10 abcdefghijklmnopqrstuvwxyz\r\n"); |
WiredHome | 5:bb970d40cd7d | 71 | lcd.SelectUserFont(BPG_Arial20x20); |
WiredHome | 9:02c622fa4969 | 72 | lcd.puts("BPG_Arial20x20 "); |
WiredHome | 5:bb970d40cd7d | 73 | lcd.SelectUserFont(BPG_Arial31x32); |
WiredHome | 9:02c622fa4969 | 74 | lcd.puts("BPG_Arial31x32\r\n"); |
WiredHome | 5:bb970d40cd7d | 75 | lcd.SelectUserFont(BPG_Arial63x63); |
WiredHome | 9:02c622fa4969 | 76 | lcd.puts("BPG_Arial63x63"); |
WiredHome | 13:43cc0a997c53 | 77 | pc.printf("Time trial completed in %d uSec\r\n", measurement.read_us()); |
WiredHome | 5:bb970d40cd7d | 78 | |
WiredHome | 9:02c622fa4969 | 79 | pc.printf("PrintScreen activated ...\r\n"); |
WiredHome | 16:231837aa2c37 | 80 | RetCode_t r = lcd.PrintScreen(0,0,LCD_W,LCD_H,"/local/file.bmp"); |
WiredHome | 5:bb970d40cd7d | 81 | pc.printf(" PrintScreen returned %d\r\n", r); |
WiredHome | 3:ca6a1026c28e | 82 | |
WiredHome | 3:ca6a1026c28e | 83 | while(1) { |
WiredHome | 5:bb970d40cd7d | 84 | ; // end |
WiredHome | 3:ca6a1026c28e | 85 | } |
WiredHome | 0:037b95a5cc85 | 86 | } |