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