The out-of-the-box demo application flashed on all display modules before they are shipped.

Dependencies:   DMBasicGUI DMSupport

This is the software that is flashed on the LPC4088 Display Modules before they are shipped from Embedded Artists.

Information

This project works on both the 4.3" and 5" display modules but requires different file systems to handle the different display resolutions.

For the 4.3" displays first drag-n-drop the media/fs_480_raw.fs5 (if you are using the new DAPLINK firmware use fs_480_raw.hex) file to the MBED drive and then drag-n-drop the demo itself. This way both the file system and software are up to date.

For the 5" displays first drag-n-drop the media/fs_800_raw.fsF (if you are using the new DAPLINK firmware use fs_800_raw.hex) file to the MBED drive and then drag-n-drop the demo itself. This way both the file system and software are up to date.

There is a prebuilt version of the demo binary here.

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

/media/uploads/embeddedartists/demo480_cap_000.png /media/uploads/embeddedartists/demo480_cap_001.png /media/uploads/embeddedartists/demo480_cap_002.png /media/uploads/embeddedartists/demo480_cap_004.png /media/uploads/embeddedartists/demo480_cap_006.png /media/uploads/embeddedartists/demo480_cap_007.png /media/uploads/embeddedartists/demo480_cap_008.png
The first slide from the Slideshow:
/media/uploads/embeddedartists/demo480_cap_003.png
A couple of images from the Image Viewer
/media/uploads/embeddedartists/demo480_cap_009.png /media/uploads/embeddedartists/demo480_cap_010.png

Files at this revision

API Documentation at this revision

Comitter:
embeddedartists
Date:
Tue Nov 05 09:11:36 2019 +0000
Parent:
4:a7cbb22e4348
Commit message:
Updates related to mbed OS 5

Changed in this revision

AppDraw.cpp Show annotated file Show diff for this revision Revisions of this file
AppImageViewer.cpp Show annotated file Show diff for this revision Revisions of this file
AppLauncherSpecial.cpp Show annotated file Show diff for this revision Revisions of this file
AppNetworkSettings.cpp Show annotated file Show diff for this revision Revisions of this file
AppRTCSettings.cpp Show annotated file Show diff for this revision Revisions of this file
AppStatus.cpp Show annotated file Show diff for this revision Revisions of this file
AppUSBStatus.cpp Show annotated file Show diff for this revision Revisions of this file
DMBasicGUI.lib Show annotated file Show diff for this revision Revisions of this file
DMSupport.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
diff -r a7cbb22e4348 -r 6ca8470ba8f8 AppDraw.cpp
--- a/AppDraw.cpp	Tue Apr 28 12:21:14 2015 +0000
+++ b/AppDraw.cpp	Tue Nov 05 09:11:36 2019 +0000
@@ -107,7 +107,7 @@
     while(!done) {
       // wait for a new touch signal (signal is sent from AppLauncher,
       // which listens for touch events)
-      Thread::signal_wait(0x1);
+      ThisThread::flags_wait_all(0x1);
       if (touch->read(_coords, fingers) == TouchPanel::TouchError_Ok) {
         for (int i = 0; i < fingers; i++) {
           if (_coords[i].z > 0) {
diff -r a7cbb22e4348 -r 6ca8470ba8f8 AppImageViewer.cpp
--- a/AppImageViewer.cpp	Tue Apr 28 12:21:14 2015 +0000
+++ b/AppImageViewer.cpp	Tue Nov 05 09:11:36 2019 +0000
@@ -176,7 +176,8 @@
 
     _active = 1;
     
-    Thread* tLoader = new Thread(loaderTask, this, osPriorityNormal, 8192);
+    Thread* tLoader = new Thread(osPriorityNormal, 8192);
+    tLoader->start(callback(loaderTask, this));
     
     bool first = true;
     Timer t;
@@ -205,7 +206,7 @@
           t.start();
         } else {
           while (t.read_ms() < 2000) {
-            Thread::wait(100);
+            ThisThread::sleep_for(100);
           }
         }
         _disp->setFramebuffer(fb);
@@ -230,7 +231,7 @@
     TouchPanel* touch = DMBoard::instance().touchPanel();
     touch_coordinate_t coord;
     while(!done) {
-      Thread::signal_wait(0x1);
+      ThisThread::flags_wait_all(0x1);
       if (touch->read(coord) == TouchPanel::TouchError_Ok) {
         if (_btn->handle(coord.x, coord.y, coord.z > 0)) {
             _btn->draw();
diff -r a7cbb22e4348 -r 6ca8470ba8f8 AppLauncherSpecial.cpp
--- a/AppLauncherSpecial.cpp	Tue Apr 28 12:21:14 2015 +0000
+++ b/AppLauncherSpecial.cpp	Tue Nov 05 09:11:36 2019 +0000
@@ -163,8 +163,8 @@
     
     // Render the current time in the upper right corner once every second
     bool updateClock = false;
-    RtosTimer updateClockTimer(onTimeoutEvent, osTimerPeriodic, &updateClock);
-    updateClockTimer.start(1000);
+    EventQueue updateClockTimer(4*EVENTS_EVENT_SIZE);
+    int updateClockTimerId = updateClockTimer.call_in(1000, onTimeoutEvent, &updateClock);    
     int clockXOff, clockYOff;
     swim_get_string_bounds(_win, "Fri Mar 20 10:32:58 2015", &clockXOff, &clockYOff);
     clockXOff = _win->xpvmax - clockXOff - 20;
@@ -174,9 +174,11 @@
     bool buttonPressed = false;
     bool buttonTimeout = false;
     InterruptIn button(P2_10);
-    button.rise(this, &AppLauncherSpecial::onButtonEvent);
-    button.fall(this, &AppLauncherSpecial::onButtonEvent);
-    RtosTimer  buttonTimer(onTimeoutEvent, osTimerOnce, &buttonTimeout);
+    button.rise(callback(this, &AppLauncherSpecial::onButtonEvent));
+    button.fall(callback(this, &AppLauncherSpecial::onButtonEvent));
+    
+    EventQueue buttonTimer(4*EVENTS_EVENT_SIZE);
+    int buttonTimerId = buttonTimer.call_in(2000, onTimeoutEvent, &buttonTimeout);
     
     // To prevent the "exit" click of a launched application to launch
     // a new application. This could happen on a multitouch display if
@@ -187,15 +189,15 @@
     
     // Wait for touches
     TouchPanel* touch = board->touchPanel();
-    touch->setListener(new FunctionPointer(this, &AppLauncherSpecial::onTouchEvent));
+    touch->setListener(callback(this, &AppLauncherSpecial::onTouchEvent));
     touch_coordinate_t coord;
     while (true) {
-        Thread::signal_wait(APP_SIGID_TOUCH);
+        ThisThread::flags_wait_all(APP_SIGID_TOUCH);
         if (_newTouchEvent) {
           if (buttonPressed) {
             // cancel
             buttonPressed = false;
-            buttonTimer.stop();
+            buttonTimer.cancel(buttonTimerId);
           }
           _newTouchEvent = false;
           if (touch->read(coord) != TouchPanel::TouchError_Ok) {
@@ -220,10 +222,10 @@
           _newButtonEvent = false;
           if (board->buttonPressed()) {
             buttonPressed = true;
-            buttonTimer.start(2000);
+            buttonTimer.dispatch(0);
           } else {
             buttonPressed = false;
-            buttonTimer.stop();
+            buttonTimer.cancel(buttonTimerId);
           }
           continue;
         } else if (updateClock) {
diff -r a7cbb22e4348 -r 6ca8470ba8f8 AppNetworkSettings.cpp
--- a/AppNetworkSettings.cpp	Tue Apr 28 12:21:14 2015 +0000
+++ b/AppNetworkSettings.cpp	Tue Nov 05 09:11:36 2019 +0000
@@ -274,7 +274,7 @@
 
     uint32_t maxDelay = osWaitForever; 
     while(!done && !abort) {
-      Thread::signal_wait(0x1, maxDelay);
+      ThisThread::flags_wait_all_for(0x1, maxDelay);
       if (touch->read(coord) == TouchPanel::TouchError_Ok) {
         for (int i = 0; i < NumButtons; i++) {
           if (_buttons[i]->handle(coord.x, coord.y, coord.z > 0)) {
@@ -303,13 +303,13 @@
       Registry* reg = DMBoard::instance().registry();
       RtosLog* log = DMBoard::instance().logger();
       char buf[16] = {0};
-      sprintf(buf, "%lu.%lu.%lu.%lu", _values[0], _values[1], _values[2], _values[3]);
+      sprintf(buf, "%u.%u.%u.%u", _values[0], _values[1], _values[2], _values[3]);
       reg->setValue("IP Address", buf);
       log->printf("New STATIC IP Address: %s\n", buf);
-      sprintf(buf, "%lu.%lu.%lu.%lu", _values[4], _values[5], _values[6], _values[7]);
+      sprintf(buf, "%u.%u.%u.%u", _values[4], _values[5], _values[6], _values[7]);
       reg->setValue("Net Mask", buf);
       log->printf("New STATIC Net Mask:   %s\n", buf);
-      sprintf(buf, "%lu.%lu.%lu.%lu", _values[8], _values[9], _values[10], _values[11]);
+      sprintf(buf, "%u.%u.%u.%u", _values[8], _values[9], _values[10], _values[11]);
       reg->setValue("Gateway", buf);
       log->printf("New STATIC Gateway:    %s\n", buf);
       reg->store();
diff -r a7cbb22e4348 -r 6ca8470ba8f8 AppRTCSettings.cpp
--- a/AppRTCSettings.cpp	Tue Apr 28 12:21:14 2015 +0000
+++ b/AppRTCSettings.cpp	Tue Nov 05 09:11:36 2019 +0000
@@ -307,7 +307,7 @@
 
     uint32_t maxDelay = osWaitForever; 
     while(!done && !abort) {
-      Thread::signal_wait(0x1, maxDelay);
+      ThisThread::flags_wait_all_for(0x1, maxDelay);
       if (touch->read(coord) == TouchPanel::TouchError_Ok) {
         for (int i = 0; i < NumButtons; i++) {
           if (_buttons[i]->handle(coord.x, coord.y, coord.z > 0)) {
diff -r a7cbb22e4348 -r 6ca8470ba8f8 AppStatus.cpp
--- a/AppStatus.cpp	Tue Apr 28 12:21:14 2015 +0000
+++ b/AppStatus.cpp	Tue Nov 05 09:11:36 2019 +0000
@@ -120,9 +120,9 @@
 
     swim_put_text_xy(_win, ethUsingDHCP?"DHCP":"Static IP", ITEM_VALUE_X_OFF-20, HEADER_Y_SPACING + ITEM_CAPTION_Y_SPACING * 5);
     if (ethInitialized) {
-        swim_put_text_xy(_win, eth.getIPAddress(), ITEM_VALUE_X_OFF-20, HEADER_Y_SPACING + ITEM_CAPTION_Y_SPACING * 6);
-        swim_put_text_xy(_win, eth.getNetworkMask(), ITEM_VALUE_X_OFF-20, HEADER_Y_SPACING + ITEM_CAPTION_Y_SPACING * 7);
-        swim_put_text_xy(_win, eth.getGateway(), ITEM_VALUE_X_OFF-20, HEADER_Y_SPACING + ITEM_CAPTION_Y_SPACING * 8);
+        swim_put_text_xy(_win, eth.get_ip_address(), ITEM_VALUE_X_OFF-20, HEADER_Y_SPACING + ITEM_CAPTION_Y_SPACING * 6);
+        swim_put_text_xy(_win, eth.get_netmask(), ITEM_VALUE_X_OFF-20, HEADER_Y_SPACING + ITEM_CAPTION_Y_SPACING * 7);
+        swim_put_text_xy(_win, eth.get_gateway(), ITEM_VALUE_X_OFF-20, HEADER_Y_SPACING + ITEM_CAPTION_Y_SPACING * 8);
         //swim_put_text_xy(_win, eth.getMACAddress(), ITEM_VALUE_X_OFF, HEADER_Y_SPACING + ITEM_CAPTION_Y_SPACING * 4);
     } else {
         swim_put_text_xy(_win, "Not Initialized", ITEM_VALUE_X_OFF-20, HEADER_Y_SPACING + ITEM_CAPTION_Y_SPACING * 6);
@@ -186,9 +186,9 @@
 
     swim_put_text_xy(_win, ethUsingDHCP?"DHCP":"Static IP", BIG_ITEM_VALUE_X_OFF-20, BIG_HEADER_Y_SPACING + BIG_ITEM_CAPTION_Y_SPACING * 5);
     if (ethInitialized) {
-        swim_put_text_xy(_win, eth.getIPAddress(), BIG_ITEM_VALUE_X_OFF-20, BIG_HEADER_Y_SPACING + BIG_ITEM_CAPTION_Y_SPACING * 6);
-        swim_put_text_xy(_win, eth.getNetworkMask(), BIG_ITEM_VALUE_X_OFF-20, BIG_HEADER_Y_SPACING + BIG_ITEM_CAPTION_Y_SPACING * 7);
-        swim_put_text_xy(_win, eth.getGateway(), BIG_ITEM_VALUE_X_OFF-20, BIG_HEADER_Y_SPACING + BIG_ITEM_CAPTION_Y_SPACING * 8);
+        swim_put_text_xy(_win, eth.get_ip_address(), BIG_ITEM_VALUE_X_OFF-20, BIG_HEADER_Y_SPACING + BIG_ITEM_CAPTION_Y_SPACING * 6);
+        swim_put_text_xy(_win, eth.get_netmask(), BIG_ITEM_VALUE_X_OFF-20, BIG_HEADER_Y_SPACING + BIG_ITEM_CAPTION_Y_SPACING * 7);
+        swim_put_text_xy(_win, eth.get_gateway(), BIG_ITEM_VALUE_X_OFF-20, BIG_HEADER_Y_SPACING + BIG_ITEM_CAPTION_Y_SPACING * 8);
     } else {
         swim_put_text_xy(_win, "Not Initialized", BIG_ITEM_VALUE_X_OFF-20, BIG_HEADER_Y_SPACING + BIG_ITEM_CAPTION_Y_SPACING * 6);
         swim_put_text_xy(_win, "Not Initialized", BIG_ITEM_VALUE_X_OFF-20, BIG_HEADER_Y_SPACING + BIG_ITEM_CAPTION_Y_SPACING * 7);
@@ -283,7 +283,7 @@
     TouchPanel* touch = DMBoard::instance().touchPanel();
     touch_coordinate_t coord;
     while(!done) {
-      Thread::signal_wait(0x1);
+      ThisThread::flags_wait_all(0x1);
       if (touch->read(coord) == TouchPanel::TouchError_Ok) {
         if (_btn->handle(coord.x, coord.y, coord.z > 0)) {
             _btn->draw();
diff -r a7cbb22e4348 -r 6ca8470ba8f8 AppUSBStatus.cpp
--- a/AppUSBStatus.cpp	Tue Apr 28 12:21:14 2015 +0000
+++ b/AppUSBStatus.cpp	Tue Nov 05 09:11:36 2019 +0000
@@ -189,7 +189,7 @@
     bool lastMouse = false;
     bool lastKeyboard = false;
     while(!done) {
-      Thread::signal_wait(0x1, 500);
+      ThisThread::flags_wait_all_for(0x1, 500);
       if (touch->read(coord) == TouchPanel::TouchError_Ok) {
         if (_btn->handle(coord.x, coord.y, coord.z > 0)) {
             _btn->draw();
diff -r a7cbb22e4348 -r 6ca8470ba8f8 DMBasicGUI.lib
--- a/DMBasicGUI.lib	Tue Apr 28 12:21:14 2015 +0000
+++ b/DMBasicGUI.lib	Tue Nov 05 09:11:36 2019 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/teams/Embedded-Artists/code/DMBasicGUI/#1a7c743600e6
+http://developer.mbed.org/teams/Embedded-Artists/code/DMBasicGUI/#f0d00f29bfeb
diff -r a7cbb22e4348 -r 6ca8470ba8f8 DMSupport.lib
--- a/DMSupport.lib	Tue Apr 28 12:21:14 2015 +0000
+++ b/DMSupport.lib	Tue Nov 05 09:11:36 2019 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/teams/Embedded-Artists/code/DMSupport/#e1cb4dd9bfeb
+http://developer.mbed.org/teams/Embedded-Artists/code/DMSupport/#bbfe299d4a0c
diff -r a7cbb22e4348 -r 6ca8470ba8f8 main.cpp
--- a/main.cpp	Tue Apr 28 12:21:14 2015 +0000
+++ b/main.cpp	Tue Nov 05 09:11:36 2019 +0000
@@ -7,7 +7,6 @@
 #include "rtos.h"
 #include "EthernetInterface.h"
 #include "HTTPServer.h"
-#include "mbed_rpc.h"
 #include "USBHostMSD.h"
 #include "USBHostMouse.h"
 #include "USBHostKeyboard.h"
@@ -132,7 +131,7 @@
   }
 }
 
-void aliveTask(void const* args)
+void aliveTask(void)
 {
   DMBoard* board = &DMBoard::instance();
     
@@ -140,16 +139,16 @@
   {
     board->setLED(DMBoard::Led4, false);
     board->setLED(DMBoard::Led1, true);
-    Thread::wait(300);
+    ThisThread::sleep_for(300);
     board->setLED(DMBoard::Led1, false);
     board->setLED(DMBoard::Led2, true);
-    Thread::wait(300);
+    ThisThread::sleep_for(300);
     board->setLED(DMBoard::Led2, false);
     board->setLED(DMBoard::Led3, true);
-    Thread::wait(300);
+    ThisThread::sleep_for(300);
     board->setLED(DMBoard::Led3, false);
     board->setLED(DMBoard::Led4, true);
-    Thread::wait(300);
+    ThisThread::sleep_for(300);
   }
 }
 
@@ -239,7 +238,7 @@
 }
 
 #define SWIM_TASK_PREFIX  "[SWIM] "
-void swimTask(void const* args)
+void swimTask(void)
 {
   RtosLog* log = DMBoard::instance().logger();
   Display* disp = DMBoard::instance().display();
@@ -277,34 +276,30 @@
 
 #define NET_TASK_PREFIX  "[NET] "
 
-void netTask(void const* args)
+void netTask(void)
 {
   RtosLog* log = DMBoard::instance().logger();
   log->printf(NET_TASK_PREFIX"EthernetInterface Setting up...\r\n");
-  if(eth.init()!=0) {                             //for DHCP Server
-     //if(eth.init(IPAddress,NetMasks,Gateway)!=0) { //for Static IP Address
-     log->printf(NET_TASK_PREFIX"EthernetInterface Initialize Error \r\n");
-     mbed_die();
+  nsapi_error_t net_err = eth.connect();
+
+  if (net_err != NSAPI_ERROR_OK) {
+    log->printf(NET_TASK_PREFIX"EthernetInterface connect Error %d\r\n", net_err);
   }
-  while (eth.connect() != 0) {
-     Thread::wait(1000);
-  }
-  
-  ethInitialized = true;
-  ethUsingDHCP = true;
+  else {  
+    ethInitialized = true;
+    ethUsingDHCP = true;
   
-  log->printf(NET_TASK_PREFIX"IP Address is %s\r\n", eth.getIPAddress());
-  log->printf(NET_TASK_PREFIX"NetMask is %s\r\n", eth.getNetworkMask());
-  log->printf(NET_TASK_PREFIX"Gateway Address is %s\r\n", eth.getGateway());
-  log->printf(NET_TASK_PREFIX"Ethernet Setup OK\r\n");
+    log->printf(NET_TASK_PREFIX"IP Address is %s\r\n", eth.get_ip_address());
+    log->printf(NET_TASK_PREFIX"NetMask is %s\r\n", eth.get_netmask());
+    log->printf(NET_TASK_PREFIX"Gateway Address is %s\r\n", eth.get_gateway());
+    log->printf(NET_TASK_PREFIX"Ethernet Setup OK\r\n");
 
-  HTTPServerAddHandler<SimpleHandler>("/hello"); //Default handler
-  FSHandler::mount("/usb", "/");
-  HTTPServerAddHandler<FSHandler>("/");
-  //HTTPServerAddHandler<RPCHandler>("/rpc");
-  //lcd.locate(0,0);
-  //lcd.printf("%s",eth.getIPAddress());
-  HTTPServerStart(80);
+    HTTPServerAddHandler<SimpleHandler>("/hello"); //Default handler
+    FSHandler::mount("/mci", "/");
+    HTTPServerAddHandler<FSHandler>("/");
+
+    HTTPServerStart(80);
+  }
 }
 
 static volatile int8_t mouse_button, mouse_x, mouse_y, mouse_z;
@@ -460,13 +455,14 @@
 
 #define USB_TASK_PREFIX  "[USB] "
 #define USB_CONNECTION_EVENT   (1<<4)
-void usbTask(void const* args)
+void usbTask(void)
 {
   USBHostMSD* msd = new USBHostMSD("usb");
   USBHostKeyboard* keyboard = new USBHostKeyboard();
   USBHostMouse* mouse = new USBHostMouse();
   USBHost* host = USBHost::getHostInst();
-  host->signalOnConnections(Thread::gettid(), USB_CONNECTION_EVENT);
+  EventFlags connectionEvent;
+  host->signalOnConnections(&connectionEvent, USB_CONNECTION_EVENT);
 
   RtosLog* log = DMBoard::instance().logger();
     
@@ -476,7 +472,7 @@
 
   while (true) {
     // wait for connect/disconnect message from USBHost
-    Thread::signal_wait(USB_CONNECTION_EVENT);
+    connectionEvent.wait_any(USB_CONNECTION_EVENT);
     log->printf(USB_TASK_PREFIX"got USB event\n");
       
     if (msd->connected()) {
@@ -554,7 +550,7 @@
   if (err != DMBoard::Ok) {
     log->printf("Failed to initialize the board, got error %d\r\n", err);
     log->printf("\nTERMINATING\n");
-    wait_ms(2000); // allow RtosLog to flush messages
+    ThisThread::sleep_for(2000); // allow RtosLog to flush messages
     mbed_die();
   }
   
@@ -562,24 +558,28 @@
   prepareResources();
   
   board->buzzer(440,50);
-  wait_ms(30);
+  ThisThread::sleep_for(30);
   board->buzzer(660,50);
-  wait_ms(30);
+  ThisThread::sleep_for(30);
   board->buzzer(440,50);
   
   log->printf("\n\n---\nDemo flashed on new Display Modules.\nBuilt: " __DATE__ " at " __TIME__ "\n\n");
   
  
-  Thread tAlive(aliveTask);
+  Thread tAlive;
+  tAlive.start(aliveTask);
 #if defined(DM_BOARD_USE_DISPLAY)
-  Thread tSwim(swimTask, NULL, osPriorityNormal, 8192);
+  Thread tSwim(osPriorityNormal, 8192);
+  tSwim.start(swimTask);
 #endif  
-  Thread tNetwork(netTask, NULL, osPriorityNormal, 8192);
-  Thread tUSBHandler(usbTask, NULL, osPriorityNormal, 8192);
+  Thread tNetwork(osPriorityNormal, 8192);
+  tNetwork.start(netTask);
+  Thread tUSBHandler(osPriorityNormal, 8192);
+  tUSBHandler.start(usbTask);
   
   while(1) { 
     // Wait forever (in 1h increments) to prevent the tAlive, tSwim,
     // tNetwork and tUSBHandler thread from being garbage collected.
-    Thread::wait(3600*1000);
+    ThisThread::sleep_for(3600*1000);
   }
 }