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

Files at this revision

API Documentation at this revision

Comitter:
embeddedartists
Date:
Mon Jan 12 10:36:07 2015 +0100
Parent:
13:57e65aba9802
Child:
15:1d19ca3f2b79
Commit message:
- Added test of the new Registry class

Changed in this revision

AppNetworkSettings.cpp Show annotated file Show diff for this revision Revisions of this file
dm_board_config.h 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
--- a/AppNetworkSettings.cpp	Thu Jan 08 19:31:23 2015 +0100
+++ b/AppNetworkSettings.cpp	Mon Jan 12 10:36:07 2015 +0100
@@ -281,7 +281,21 @@
     }
 
     if (!abort) {
-      //TODO: Apply settings
+#if defined(DM_BOARD_USE_REGISTRY)
+      Registry* reg = DMBoard::instance().registry();
+      RtosLog* log = DMBoard::instance().logger();
+      char buf[16] = {0};
+      sprintf(buf, "%d.%d.%d.%d", _values[0], _values[1], _values[2], _values[3]);
+      reg->setValue("IP Address", buf);
+      log->printf("New STATIC IP Address: %s\n", buf);
+      sprintf(buf, "%d.%d.%d.%d", _values[4], _values[5], _values[6], _values[7]);
+      reg->setValue("Net Mask", buf);
+      log->printf("New STATIC Net Mask:   %s\n", buf);
+      sprintf(buf, "%d.%d.%d.%d", _values[8], _values[9], _values[10], _values[11]);
+      reg->setValue("Gateway", buf);
+      log->printf("New STATIC Gateway:    %s\n", buf);
+      reg->store();
+#endif
     }
     
     // User has clicked the button, restore the original FB
--- a/dm_board_config.h	Thu Jan 08 19:31:23 2015 +0100
+++ b/dm_board_config.h	Mon Jan 12 10:36:07 2015 +0100
@@ -32,5 +32,6 @@
 // #define DM_BOARD_DISABLE_STANDARD_PRINTF
 // #define DM_BOARD_ENABLE_MEASSURING_PINS
 // #define DM_BOARD_BIOS_DEVELOPMENT
+#define DM_BOARD_USE_REGISTRY
 
 #endif
--- a/main.cpp	Thu Jan 08 19:31:23 2015 +0100
+++ b/main.cpp	Mon Jan 12 10:36:07 2015 +0100
@@ -506,6 +506,91 @@
     }
 }
 
+#define REGTEST "[REG] "
+static void testRegistry()
+{
+  Registry* reg = DMBoard::instance().registry();
+  RtosLog* log = DMBoard::instance().logger();
+  char* key;
+  char* val;
+  Registry::RegistryError err;
+    
+  log->printf(REGTEST"Before:\n");
+  for (int i = 0; i < reg->numEntries(); i++) {
+    err = reg->entryAt(i, &key, &val);
+    if (err == Registry::Ok) {
+      log->printf(REGTEST"   [%2d] '%s' = '%s'\n", i, key, val);
+      free(key);
+      free(val);
+    } else {
+      log->printf(REGTEST"   [%2d] got error %d\n", i, err);
+    }
+  }
+  
+  log->printf(REGTEST"Getting existing value:\n");
+  err = reg->getValue("IP Address", &val);
+  if (err == Registry::Ok) {
+    log->printf(REGTEST"   Existing 'IP Address' = '%s'\n", val);
+    free(val);
+  } else {
+    log->printf(REGTEST"   Existing 'IP Address' got error %d\n", err);
+  }
+  
+  log->printf(REGTEST"Getting missing value:\n");
+  err = reg->getValue("X78g4dfwx", &val);
+  if (err == Registry::Ok) {
+    log->printf(REGTEST"   Missing 'X78g4dfwx' = '%s'\n", val);
+    free(val);
+  } else if (err == Registry::NoSuchKeyError) {
+    log->printf(REGTEST"   Missing 'X78g4dfwx' was missing.\n", err);
+  } else {
+    log->printf(REGTEST"   Existing 'X78g4dfwx' got error %d\n", err);
+  }
+
+  log->printf(REGTEST"Updating value:\n");
+  err = reg->getValue("EATest", &val);
+  if (err == Registry::Ok) {
+    log->printf(REGTEST"   Old value for 'EATest' = '%s'\n", val);
+    char buf[32];
+    sprintf(buf, "%d", atoi(val)+1);
+    free(val);
+    err = reg->setValue("EATest", buf);
+    if (err == Registry::Ok) {
+      log->printf(REGTEST"   Updated 'EATest' to '%s'\n", buf);
+    } else {
+      log->printf(REGTEST"   Failed to update 'EATest', got error %d\n", err);
+    }
+  } else if (err == Registry::NoSuchKeyError) {
+    log->printf(REGTEST"   No value for 'EATest', adding one\n", err);
+    err = reg->setValue("EATest", "-3");
+    if (err == Registry::Ok) {
+      log->printf(REGTEST"   Set 'EATest' to '0'\n");
+    } else {
+      log->printf(REGTEST"   Failed to set 'EATest', got error %d\n", err);
+    }
+  } else {
+    log->printf(REGTEST"   Failed to read 'EATest' got error %d\n", err);
+  }
+  
+  log->printf(REGTEST"Storing values persistently\n");
+  err = reg->store();
+  if (err != Registry::Ok) {
+    log->printf(REGTEST"   Failed to store values, got error %d\n", err);
+  }
+
+  log->printf(REGTEST"After:\n");
+  for (int i = 0; i < reg->numEntries(); i++) {
+    err = reg->entryAt(i, &key, &val);
+    if (err == Registry::Ok) {
+      log->printf(REGTEST"   [%2d] '%s' = '%s'\n", i, key, val);
+      free(key);
+      free(val);
+    } else {
+      log->printf(REGTEST"   [%2d] got error %d\n", i, err);
+    }
+  }  
+}
+
 /******************************************************************************
  * Main function
  *****************************************************************************/
@@ -532,6 +617,9 @@
   //while(!board->buttonPressed());
   //while(board->buttonPressed());
   
+  testRegistry();
+  
+  
   Thread tAlive(aliveTask);
 #if defined(DM_BOARD_USE_DISPLAY)
   Thread tSwim(swimTask, NULL, osPriorityNormal, 8192);