Embedded Artists / lpc4088_displaymodule_everything

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:
14:73f6c425b2b5
Parent:
13:57e65aba9802
Child:
16:77f4f42eb6a7
--- 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);