Example using the support package for LPC4088 DisplayModule

Dependencies:   DMBasicGUI DMSupport

Example using a lot of the features in the software package for the LPC4088 Display Module.

This project can be selected as a template when creating a new project based on the LPC4088 Display Module.

Information

This project works on the 4.3" display modules.

Some of the apps works on the 5" display modules. The ImageViewer and Slideshow app will show the images distorted as it does not take the resolution into consideration.

Information

The USB Status app is disabled. The Image viewer looks for images in the root of SD cards, USB memory sticks or the file system on the QSPI flash. The Slideshow app expects to find a slideshow script in /mci/elec14/ea_logo.txt.

This is what it looks like on the 4.3" display:

/media/uploads/embeddedartists/everything_cap_000.png /media/uploads/embeddedartists/everything_cap_001.png /media/uploads/embeddedartists/everything_cap_003.png /media/uploads/embeddedartists/everything_cap_004.png /media/uploads/embeddedartists/everything_cap_006.png /media/uploads/embeddedartists/everything_cap_008.png

Revision:
24:768f5958c308
Parent:
23:3f8bc89e0b23
Child:
26:f07df116f3c9
--- a/main.cpp	Mon Jan 26 14:48:37 2015 +0000
+++ b/main.cpp	Tue Feb 17 10:46:06 2015 +0100
@@ -24,6 +24,8 @@
 #include "AppImageViewer.h"
 #include "AppSlideShow.h"
 #include "AppRTCSettings.h"
+//#include "AppUSBStatus.h"
+#include "AppDraw.h"
 #include "image_data.h"
 
 
@@ -82,41 +84,6 @@
   }
 }
 
-/*
- * Reads the /message.txt file from the file system and prints the content
- */
-void readMessageFile(const char* prefix)
-{
-  RtosLog* log = DMBoard::instance().logger();
-  log->printf("%sTesting to read from USB\n", prefix);
-    
-  FILE * fp = fopen("/usb/message.txt", "r");
-  
-  if (fp != NULL) {
-    uint8_t* buff = (uint8_t*)malloc(1024+1);
-    if (buff == NULL) {
-      log->printf("%sFailed to allocate memory for test\n", prefix);
-    } else {
-      int num = fread(buff, 1, 1024, fp);
-      if (num <= 0) {
-        log->printf("%sUnable to read file, got %d as result\n", prefix, num);
-      } else if (num < 1024) {
-        log->printf("%sHave read all %d bytes in the file:\n---\n", prefix, num);
-        buff[num] = '\0';
-        log->printf((const char*)buff);
-        log->printf("\n---\n");
-      } else {
-        log->printf("%sHave read %d bytes with more to read\n", prefix, num);
-      }
-      free(buff);
-    }
-    fclose(fp);
-  } else {
-    log->printf("%sFILE == NULL\r\n", prefix);
-  }
-}
-
-
 #if defined(DM_BOARD_USE_DISPLAY)
 
 typedef enum {
@@ -127,6 +94,8 @@
     StatusApp, 
     TouchTestApp,
     RtcApp,
+    USBStatusApp,
+    DrawingApp,
     CalibrationApp =  AppLauncher::CalibrationApp,
     Placeholder,
 } myapps_t;
@@ -148,7 +117,7 @@
           a = new AppImageViewer();
           break;
       case SlideshowApp:
-          a = new AppSlideShow();
+          a = new AppSlideShow("/mci/elec14/ea_logo.txt", "/mci/elec14", 0, 0);
           break;
       case StatusApp:
           a = new AppStatus();
@@ -156,6 +125,12 @@
       case RtcApp:
           a = new AppRTCSettings();
           break;
+      case USBStatusApp:
+          //a = new AppUSBStatus();
+          break;
+      case DrawingApp:
+          a = new AppDraw();
+          break;
       default:
           break;
   }
@@ -173,16 +148,16 @@
     
     
   if (launcher.setup()) {
-    launcher.addImageButton(SettingsApp,  img_preferences_system_network, img_size_preferences_system_network);
-    launcher.addImageButton(Placeholder, img_bijiben, img_size_bijiben);
-    launcher.addImageButton(SlideshowApp, img_multimedia_photo_manager, img_size_multimedia_photo_manager);
+    launcher.addImageButton(SettingsApp, "Network", WHITE,  img_preferences_system_network, img_size_preferences_system_network);
+    launcher.addImageButton(DrawingApp, "Drawing", WHITE, img_bijiben, img_size_bijiben);
+    launcher.addImageButton(SlideshowApp, "Slideshow", WHITE, img_multimedia_photo_manager, img_size_multimedia_photo_manager);
     //launcher.addImageButton(TouchGFXApp,  "TouchGFX");
     //launcher.addImageButton(EmWinApp,     "emWin");
-    launcher.addImageButton(ColorPickerApp,  img_preferences_color, img_size_preferences_color);
-    launcher.addImageButton(ImageViewerApp,  img_multimedia_photo_manager, img_size_multimedia_photo_manager);
-    launcher.addImageButton(StatusApp,  img_utilities_system_monitor, img_size_utilities_system_monitor);
-    launcher.addImageButton(Placeholder,  img_unetbootin, img_size_unetbootin);
-    launcher.addImageButton(RtcApp,  img_preferences_system_time, img_size_preferences_system_time);
+    launcher.addImageButton(ColorPickerApp, "Color Picker", WHITE,  img_preferences_color, img_size_preferences_color);
+    launcher.addImageButton(ImageViewerApp, "Image Viewer", WHITE,  img_multimedia_photo_manager, img_size_multimedia_photo_manager);
+    launcher.addImageButton(StatusApp, "About", WHITE,  img_utilities_system_monitor, img_size_utilities_system_monitor);
+    launcher.addImageButton(Placeholder, "USB Status", WHITE,  img_unetbootin, img_size_unetbootin);
+    launcher.addImageButton(RtcApp, "Clock", WHITE,  img_preferences_system_time, img_size_preferences_system_time);
       
     launcher.setAppCreatorFunc(launchApp);
     log->printf(SWIM_TASK_PREFIX"Starting menu system\n");
@@ -231,7 +206,7 @@
   HTTPServerStart(80);
 }
 
-static int8_t mouse_button, mouse_x, mouse_y, mouse_z;
+static volatile int8_t mouse_button, mouse_x, mouse_y, mouse_z;
 static uint16_t cursor_x=0, cursor_y=0;
 void mouseEvent(uint8_t buttons, int8_t x, int8_t y, int8_t z)
 {
@@ -362,8 +337,8 @@
 
 
 #define CIRCBUFF_SIZE 256
-static uint8_t circbuff[CIRCBUFF_SIZE];
-static uint32_t circbuff_read = 0;
+static volatile uint8_t circbuff[CIRCBUFF_SIZE];
+static volatile uint32_t circbuff_read = 0;
 static uint32_t circbuff_write = 0;
 void keyEvent(uint8_t key)
 {
@@ -579,7 +554,7 @@
   Thread tUSBHandler(usbTask, NULL, osPriorityNormal, 8192);
   
   while(1) { 
-    wait(5); 
+    Thread::wait(5000); 
     time_t seconds = time(NULL);
     log->printf("Time: %s\n", ctime(&seconds));
   }