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:
Fri Dec 19 16:44:03 2014 +0100
Parent:
5:0934947a8db8
Child:
7:c8bef6a4b019
Commit message:
Cleanup

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Dec 19 08:45:38 2014 +0000
+++ b/main.cpp	Fri Dec 19 16:44:03 2014 +0100
@@ -52,92 +52,6 @@
  * Local functions
  *****************************************************************************/
 
-static void verticalLine16(uint16_t* framebuffer, int w, int x, int y0, int y1, uint16_t color)
-{
-    if (x < w) {
-        int h = y1 - y0 + 1;
-        uint16_t* fb = framebuffer;
-        fb += x;
-        fb += y0 * w;
-        for (int i = 0; i < h; i++) {
-            *fb = color;
-            fb += w;
-        }
-    }
-}
-
-/**
- * Draw color bars to the display
- */
-static void drawBars565(uint16_t* framebuffer, int w, int h)
-{
-  uint16_t clr;
-  uint16_t xgs, ygs, curx, cury, curym, xidx;
-  int idx;
-
-  /* Compute vertical size for bars */
-  ygs = h / 3;
-
-  /* Draw Red bars */
-  cury = 0;
-  curx = 0;
-  curym = ygs - 1;
-  xgs = w / RED_COLORS;
-  clr = BLACK;
-  for (xidx = 0; xidx < RED_COLORS; xidx++)
-  {
-      //swim_set_pen_color(win1, clr);
-      for (idx = 0; idx <= xgs; idx++)
-      {
-          //swim_put_line(win1, curx, cury, curx, curym);
-        //g.put_line(curx, cury, curx, curym, clr);
-          verticalLine16(framebuffer, w, curx, cury, curym, clr);
-        curx++;
-      }
-      clr = clr + 0x0800;
-  }
-
-  /* Draw green bars */
-  cury = cury + ygs;
-  curx = 0;
-  curym = cury + (ygs - 1);
-  xgs = w / GREEN_COLORS;
-  clr = BLACK;
-  for (xidx = 0; xidx < GREEN_COLORS; xidx++)
-  {
-      //swim_set_pen_color(win1, clr);
-      for (idx = 0; idx <= xgs; idx++)
-      {
-          //swim_put_line(win1, curx, cury, curx, curym);
-        //g.put_line(curx, cury, curx, curym, clr);
-          verticalLine16(framebuffer, w, curx, cury, curym, clr);
-          curx++;
-      }
-      clr = clr + 0x0020;
-  }
-
-  /* Draw blue bars */
-  cury = cury + ygs;
-  curx = 0;
-  curym = h - 1;//cury + (ygs - 1);
-  xgs = w / BLUE_COLORS;
-  clr = BLACK;
-  for (xidx = 0; xidx < BLUE_COLORS; xidx++)
-  {
-      //swim_set_pen_color(win1, clr);
-      for (idx = 0; idx <= xgs; idx++)
-      {
-          //swim_put_line(win1, curx, cury, curx, curym);
-        //g.put_line(curx, cury, curx, curym, clr);
-          verticalLine16(framebuffer, w, curx, cury, curym, clr);
-          curx++;
-      }
-      clr = clr + 0x0001;
-  }
-}
-
-
-
 void aliveTask(void const* args)
 {
   DMBoard* board = &DMBoard::instance();
@@ -195,42 +109,6 @@
 
 
 #if defined(DM_BOARD_USE_DISPLAY)
-#define DISPLAY_TASK_PREFIX  "[LCD] "
-void displayTask(void const* args)
-{
-  // Start display in default mode (16-bit)
-  RtosLog* log = DMBoard::instance().logger();
-  Display* disp = DMBoard::instance().display();
-  Display::DisplayError disperr;
-  uint16_t* fb = (uint16_t*)disp->allocateFramebuffer();
-  if (fb == NULL) {
-    log->printf(DISPLAY_TASK_PREFIX"Failed to allocate memory for framebuffer\r\n");
-    mbed_die();
-  }
-  drawBars565(fb, disp->width(), disp->height());
-  disperr = disp->powerUp(fb);
-  if (disperr != Display::DisplayError_Ok) {
-    log->printf(DISPLAY_TASK_PREFIX"Failed to initialize the display, got error %d\r\n", disperr);
-    mbed_die();
-  }
-  
-  int h = disp->height();
-  int w = disp->width();
-  uint16_t COLORS[] = { 0xFFF0, 0xF800, 0x07E0, 0x001F, 0x07FF, 0xF81F };
-  int i = 0;
-  while(true) {
-    uint16_t color = COLORS[i++ % (sizeof(COLORS)/sizeof(COLORS[0]))];
-    for (int y = 0; y < h; y++) {
-      for (int x = 0; x < w; x++) {
-        fb[y*w+x] = color;
-      }
-      Thread::wait(30);
-    }
-    
-    // test to read the message file
-    //readMessageFile(DISPLAY_TASK_PREFIX);
-  }
-}
 
 #define SWIM_TASK_PREFIX  "[SWIM] "
 void swimTask(void const* args)
@@ -242,13 +120,13 @@
   AppLauncher launcher;
   if (launcher.setup()) {
       
-    // With icons as buttons we need the USB memory stick to with the image files
-    if (!haveUSBMSD) {
-      log->printf("Waiting for USB MSD to be connected!\n");
-      do {
-        Thread::wait(1000);
-      } while(!haveUSBMSD);
-    }
+    //// With icons as buttons we need the USB memory stick to with the image files
+    //if (!haveUSBMSD) {
+    //  log->printf("Waiting for USB MSD to be connected!\n");
+    //  do {
+    //    Thread::wait(1000);
+    //  } while(!haveUSBMSD);
+    //}
       
     log->printf(SWIM_TASK_PREFIX"Starting menu system\n");
     launcher.runToCompletion();
@@ -477,7 +355,6 @@
   
   Thread tAlive(aliveTask);
 #if defined(DM_BOARD_USE_DISPLAY)
-  //Thread tDisplay(displayTask, NULL, osPriorityNormal, 8192);
   Thread tSwim(swimTask, NULL, osPriorityNormal, 8192);
 #endif  
   Thread tMemstick(msdTask, NULL, osPriorityNormal, 8192);