Demo of RA8875 TFT touch display on Freescale FRDM-K64F Forked from David Smart https://developer.mbed.org/users/WiredHome/

Dependencies:   RA8875 menu SDFileSystem mbed

Fork of PUB_RA8875_mPaint by David Smart

Files at this revision

API Documentation at this revision

Comitter:
unix_guru
Date:
Fri Oct 02 19:47:06 2015 +0000
Parent:
4:fbd196119f8c
Commit message:
First functional commit

Changed in this revision

RA8875.lib Show annotated file Show diff for this revision Revisions of this file
SDFileSystem.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r fbd196119f8c -r 3afc5780b966 RA8875.lib
--- a/RA8875.lib	Sat Jan 03 17:25:42 2015 +0000
+++ b/RA8875.lib	Fri Oct 02 19:47:06 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/WiredHome/code/RA8875/#7bad0068cca0
+http://mbed.org/users/WiredHome/code/RA8875/#ef538bd687c0
diff -r fbd196119f8c -r 3afc5780b966 SDFileSystem.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SDFileSystem.lib	Fri Oct 02 19:47:06 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/mbed_official/code/SDFileSystem/#7b35d1709458
diff -r fbd196119f8c -r 3afc5780b966 main.cpp
--- a/main.cpp	Sat Jan 03 17:25:42 2015 +0000
+++ b/main.cpp	Fri Oct 02 19:47:06 2015 +0000
@@ -33,8 +33,11 @@
 #include "mbed.h"           // tested with v92
 #include "RA8875.h"         // tested with v80
 #include "menu.h"
+#include "SDFileSystem.h" 
+#include "FATFileSystem.h" 
 
-//#define DEBUG "mPaint"
+
+#define DEBUG "mPaint"
 // ...
 // INFO("Stuff to show %d", var); // new-line is automatically appended
 //
@@ -52,10 +55,14 @@
 // Local File System:
 // - Store the touch screen calibration
 // - Capture works of art in BMP format.
-LocalFileSystem local("local");
+//  LocalFileSystem local("local");
+SDFileSystem sd(PTE3, PTE1, PTE2, PTE4, "sd");
 
 // The display interface
-RA8875 lcd(p5, p6, p7, p12, NC, "tft");    // MOSI, MISO, SCK, /ChipSelect, /reset, name
+//RA8875 lcd(p5, p6, p7, p12, NC, "tft");    // MOSI, MISO, SCK, /ChipSelect, /reset, name
+RA8875 lcd(PTD2, PTD3, PTD1, PTD0, NC, "tft");    // FRDM-K64F   MOSI, MISO, SCK, /ChipSelect, /reset, name
+
+
 
 // A monitor port for the SW developer.
 Serial pc(USBTX, USBRX);
@@ -192,7 +199,7 @@
     (void)v;
     INFO("rebooting now...");
     wait_ms(1000);
-    mbed_reset();
+    NVIC_SystemReset();                 // Software reset.
     return Menu::no_action;
 }
 Menu::post_fnc_action_t Edit(uint32_t v)
@@ -260,7 +267,7 @@
     r = lcd.TouchPanelCalibrate("Calibrate the touch panel", &matrix);
     INFO("  ret: %d", r);
     if (r == noerror) {
-        fh = fopen("/local/tpcal.cfg", "wb");
+        fh = fopen("/sd/tpcal.cfg", "wb");
         if (fh) {
             fwrite(&matrix, sizeof(tpMatrix_t), 1, fh);
             fclose(fh);
@@ -279,7 +286,7 @@
     FILE * fh;
     tpMatrix_t matrix;
 
-    fh = fopen("/local/tpcal.cfg", "rb");
+    fh = fopen("/sd/tpcal.cfg", "rb");
     if (fh) {
         fread(&matrix, sizeof(tpMatrix_t), 1, fh);
         fclose(fh);
@@ -296,7 +303,8 @@
     lcd.SelectDrawingLayer(CANVAS);
     lcd.cls();
     lcd.foreground(Blue);
-    lcd.background(Black);
+    lcd.background(White);
+    lcd.Backlight_u8(255);    
 }
 
 int GetScreenCapture(void)
@@ -306,11 +314,11 @@
 
     INFO("Screen Capture... ");
     for (i=1; i< 100; i++) {
-        snprintf(fqfn, sizeof(fqfn), "/local/Screen%02d.bmp", i);
+        snprintf(fqfn, sizeof(fqfn), "/sd/Screen%02d.bmp", i);
         FILE * fh = fopen(fqfn, "rb");
         if (!fh) {
             lcd.PrintScreen(0,0,lcd.width(),lcd.height(),fqfn);
-            INFO(" as /local/Screen%02d.bmp", i);
+            INFO(" as /sd/Screen%02d.bmp", i);
             return i;
         } else {
             fclose(fh);     // close this and try the next
@@ -432,7 +440,7 @@
 
 int main()
 {
-    pc.baud(460800);    // I like a snappy terminal, so crank it up!
+    pc.baud(115200);    // I like a snappy terminal, so crank it up!
     pc.printf("\r\nRA8875 Menu - Build " __DATE__ " " __TIME__ "\r\n");
 
     INFO("Turning on display");
@@ -495,12 +503,15 @@
     wait_ms(500);
     NVIC_SystemReset();
 }
+/*
 extern "C" void NMI_Handler()
 {
     printf("\r\n\r\nNMI Fault!\r\n");
     wait_ms(500);
     NVIC_SystemReset();
 }
+*/
+
 extern "C" void MemManage_Handler()
 {
     printf("\r\n\r\nMemManage Fault!\r\n");
diff -r fbd196119f8c -r 3afc5780b966 mbed.bld
--- a/mbed.bld	Sat Jan 03 17:25:42 2015 +0000
+++ b/mbed.bld	Fri Oct 02 19:47:06 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/ba1f97679dad
\ No newline at end of file