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:
18:715f542538b3
Parent:
16:77f4f42eb6a7
Child:
23:3f8bc89e0b23
--- a/main.cpp	Sat Jan 17 13:20:54 2015 +0000
+++ b/main.cpp	Tue Jan 20 09:15:05 2015 +0100
@@ -23,6 +23,7 @@
 #include "AppColorPicker.h"
 #include "AppImageViewer.h"
 #include "AppSlideShow.h"
+#include "AppRTCSettings.h"
 #include "image_data.h"
 
 
@@ -125,6 +126,7 @@
     SettingsApp, 
     StatusApp, 
     TouchTestApp,
+    RtcApp,
     CalibrationApp =  AppLauncher::CalibrationApp,
     Placeholder,
 } myapps_t;
@@ -151,6 +153,9 @@
       case StatusApp:
           a = new AppStatus();
           break;
+      case RtcApp:
+          a = new AppRTCSettings();
+          break;
       default:
           break;
   }
@@ -168,15 +173,16 @@
     
     
   if (launcher.setup()) {
-    launcher.addImageButton(SettingsApp,  img_preferences_desktop_applications, img_size_preferences_desktop_applications);
+    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(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_help_info, img_size_help_info);
+    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.setAppCreatorFunc(launchApp);
     log->printf(SWIM_TASK_PREFIX"Starting menu system\n");
@@ -506,6 +512,93 @@
     }
 }
 
+#define USB_TASK_PREFIX  "[USB] "
+#define USB_CONNECTION_EVENT   (1<<4)
+void usbTask(void const* args)
+{
+  bool msdConnected = false;
+  bool keyboardConnected = false;
+  bool mouseConnected = false;
+
+  USBHostMSD* msd = new USBHostMSD("usb");
+  USBHostKeyboard* keyboard = new USBHostKeyboard();
+  USBHostMouse* mouse = new USBHostMouse();
+  USBHost* host = USBHost::getHostInst();
+  host->signalOnConnections(Thread::gettid(), USB_CONNECTION_EVENT);
+
+  RtosLog* log = DMBoard::instance().logger();
+    
+  log->printf(USB_TASK_PREFIX"usbTask started\n");
+    
+  prepareCursor(false);
+
+  while (true) {
+    // wait for connect/disconnect message from USBHost
+    Thread::signal_wait(USB_CONNECTION_EVENT);
+    log->printf(USB_TASK_PREFIX"got USB event\n");
+      
+    if (msd->connected()) {
+      if (!msdConnected) {
+        msdConnected = true;
+        haveUSBMSD = true;
+        log->printf(USB_TASK_PREFIX"USB MassStorage Device - Connected\n");
+      }
+    } else {
+      if (msdConnected) {
+        msdConnected = false;
+        haveUSBMSD = false;
+        log->printf(USB_TASK_PREFIX"USB MassStorage Device - Ejected\n");
+      }
+      
+      if (msd->connect()) {
+        msdConnected = true;
+        haveUSBMSD = true;
+        log->printf(USB_TASK_PREFIX"USB MassStorage Device - Connected\n");
+      }      
+    }
+    
+    if (keyboard->connected()) {
+      if (!keyboardConnected) {
+        keyboardConnected = true;
+        log->printf(USB_TASK_PREFIX"USB Keyboard - Connected\n");
+        keyboard->attach(keyEvent);
+      }
+    } else {
+      if (keyboardConnected) {
+        keyboardConnected = false;
+        log->printf(USB_TASK_PREFIX"USB Keyboard - Ejected\n");
+      }
+      if (keyboard->connect()) {
+        keyboardConnected = true;
+        log->printf(USB_TASK_PREFIX"USB Keyboard - Connected\n");
+        keyboard->attach(keyEvent);
+      }
+    }
+    
+    if (mouse->connected()) {
+      if (!mouseConnected) {
+        mouseConnected = true;
+        log->printf(USB_TASK_PREFIX"USB Mouse - Connected\n");
+        mouse->attachEvent(mouseEvent);
+        prepareCursor(true);
+      }
+    } else {
+      if (mouseConnected) {
+        prepareCursor(false);
+        mouseConnected = false;
+        log->printf(USB_TASK_PREFIX"USB Mouse - Ejected\n");
+      }
+      if (mouse->connect()) {
+        mouseConnected = true;
+        log->printf(USB_TASK_PREFIX"USB Mouse - Connected\n");
+        mouse->attachEvent(mouseEvent);
+        prepareCursor(true);
+      }
+    }
+  }
+}
+
+
 #define REGTEST "[REG] "
 static void testRegistry()
 {
@@ -626,10 +719,16 @@
 #if defined(DM_BOARD_USE_DISPLAY)
   Thread tSwim(swimTask, NULL, osPriorityNormal, 8192);
 #endif  
-  Thread tMemstick(msdTask, NULL, osPriorityNormal, 8192);
+  //Thread tMemstick(msdTask, NULL, osPriorityNormal, 8192);
   Thread tNetwork(netTask, NULL, osPriorityNormal, 8192);
-  Thread tMouse(mouseTask);
-  Thread tKeyboard(keyTask);
+  //Thread tMouse(mouseTask);
+  //Thread tKeyboard(keyTask);
+  Thread tUSBHandler(usbTask, NULL, osPriorityNormal, 8192);
   
-  while(1) { wait(5); }
+  //while(1) { wait(5); }
+  while(1) { 
+    wait(5); 
+    time_t seconds = time(NULL);
+    log->printf("Time: %s\n", ctime(&seconds));
+  }
 }