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:
13:57e65aba9802
Parent:
11:4830c7689843
Child:
14:73f6c425b2b5
--- a/main.cpp	Wed Jan 07 13:17:42 2015 +0000
+++ b/main.cpp	Thu Jan 08 19:31:23 2015 +0100
@@ -17,7 +17,8 @@
 #include "AppLauncher.h"
 #include "meas.h"
 
-#include "AppSettings.h"
+#include "AppNetworkSettings.h"
+#include "AppStatus.h"
 #include "AppTouchCalibration.h"
 #include "AppColorPicker.h"
 #include "AppImageViewer.h"
@@ -122,6 +123,7 @@
     ImageViewerApp,
     SlideshowApp,
     SettingsApp, 
+    StatusApp, 
     TouchTestApp,
     CalibrationApp =  AppLauncher::CalibrationApp,
     Placeholder,
@@ -135,7 +137,7 @@
           a = new AppTouchCalibration();
           break;
       case SettingsApp:
-          a = new AppSettings();
+          a = new AppNetworkSettings();
           break;
       case ColorPickerApp:
           a = new AppColorPicker();
@@ -146,6 +148,9 @@
       case SlideshowApp:
           a = new AppSlideShow();
           break;
+      case StatusApp:
+          a = new AppStatus();
+          break;
       default:
           break;
   }
@@ -170,7 +175,7 @@
     //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(Placeholder,  img_help_info, img_size_help_info);
+    launcher.addImageButton(StatusApp,  img_help_info, img_size_help_info);
     launcher.addImageButton(Placeholder,  img_unetbootin, img_size_unetbootin);
       
     launcher.setAppCreatorFunc(launchApp);
@@ -269,13 +274,133 @@
   HTTPServerStart(80);
 }
 
-static uint8_t mouse_button, mouse_x, mouse_y, mouse_z;
+static int8_t mouse_button, mouse_x, mouse_y, mouse_z;
+static uint16_t cursor_x=0, cursor_y=0;
 void mouseEvent(uint8_t buttons, int8_t x, int8_t y, int8_t z)
 {
     mouse_button = buttons;
     mouse_x = x;
     mouse_y = y;
     mouse_z = z;
+    
+    if (x < 0) {
+        if (cursor_x > -x) {
+            cursor_x += x;
+        } else {
+            cursor_x = 0;
+        }
+    } else {
+        if ((cursor_x + x) >= 480) {
+            cursor_x = 479;
+        } else {
+            cursor_x += x;
+        }
+    }
+    y = y/8;
+    if (y < 0) {
+        if (cursor_y > -y) {
+            cursor_y += y;
+        } else {
+            cursor_y = 0;
+        }
+    } else {
+        if ((cursor_y + y) >= 272) {
+            cursor_y = 271;
+        } else {
+            cursor_y += y;
+        }
+    }
+    
+    //Chip_LCD_Cursor_SetPos(LPC_LCD, cursor_x, cursor_y);
+    LPC_LCD->CRSR_XY = (cursor_x & 0x3FF) | ((cursor_y & 0x3FF) << 16);
+}
+
+#define LCD_CURSOR_32x32 0
+#define LCD_CURSOR_64x64 1
+#define CURSOR_SIZE  LCD_CURSOR_32x32
+#define CURSOR_H_SIZE 32
+#define CURSOR_V_SIZE 32
+#define CURSOR_NUM   0    
+#define CURSOR_H_OFS (10)
+#define CURSOR_V_OFS (6)
+
+const unsigned char __attribute__ ((aligned(4))) Cursor[(CURSOR_H_SIZE / 4) * CURSOR_V_SIZE] =
+{
+	0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
+	0xAA, 0xAA, 0x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AA, 0xAA,
+	0xAA, 0xAA, 0xAB, 0xFF, 0xFF, 0xFE, 0xAA, 0xAA,
+	0xAA, 0xAA, 0xAB, 0xFF, 0xFF, 0xFE, 0xAA, 0xAA,
+	0xAA, 0xAA, 0xAA, 0xFF, 0xFF, 0xFA, 0xAA, 0xAA,
+	0xAA, 0xAA, 0xAA, 0xFF, 0xFF, 0xFA, 0xAA, 0xAA,
+	0xAA, 0xAA, 0xAA, 0xFF, 0xFF, 0xFA, 0xAA, 0xAA,
+	0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
+	0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
+	0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
+	0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
+	0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA
+};
+
+void prepareCursor(bool enable) {
+	//Chip_LCD_Cursor_Disable(LPC_LCD, 0);
+    LPC_LCD->CRSR_CTRL = (CURSOR_NUM << 4);
+    
+    if (enable) {
+        //Chip_LCD_Cursor_Config(LPC_LCD, LCD_CURSOR_32x32, true);
+        LPC_LCD->CRSR_CFG = ((true ? 1 : 0) << 1) | CURSOR_SIZE;
+        
+        //Chip_LCD_Cursor_WriteImage(LPC_LCD, 0, (void *) Cursor);
+        {
+            int i, j;
+            uint32_t *fifoptr, *crsr_ptr = (uint32_t *) Cursor;
+
+            /* Check if Cursor Size was configured as 32x32 or 64x64*/
+            if (CURSOR_SIZE == LCD_CURSOR_32x32) {
+                i = CURSOR_NUM * 64;
+                j = i + 64;
+            }
+            else {
+                i = 0;
+                j = 256;
+            }
+            fifoptr = (uint32_t *) &(LPC_LCD->CRSR_IMG[0]);
+
+            /* Copy Cursor Image content to FIFO */
+            for (; i < j; i++) {
+
+                *fifoptr = *crsr_ptr;
+                crsr_ptr++;
+                fifoptr++;
+            }
+        }
+        
+        //Chip_LCD_Cursor_SetClip(LPC_LCD, CURSOR_H_OFS, CURSOR_V_OFS);
+        LPC_LCD->CRSR_CLIP = (CURSOR_H_OFS & 0x3F) | ((CURSOR_V_OFS & 0x3F) << 8);
+        
+        //Chip_LCD_Cursor_SetPos(LPC_LCD, cursor_x, cursor_y);
+        
+        //Chip_LCD_Cursor_Enable(LPC_LCD, 0);
+        LPC_LCD->CRSR_CTRL = (CURSOR_NUM << 4) | 1;
+    }
 }
 
 #define MOUSE_TASK_PREFIX  "[MOUSE] "
@@ -286,11 +411,12 @@
     USBHostMouse* mouse = new USBHostMouse();
     usbInitGuard.unlock();
     RtosLog* log = DMBoard::instance().logger();
-    
+        
     log->printf(MOUSE_TASK_PREFIX"mouseTask started\n");
   
     while(1) {
         
+        prepareCursor(false);
         log->printf(MOUSE_TASK_PREFIX"Attempting to connect...\n");
       
         // try to connect a mouse
@@ -307,6 +433,7 @@
         
         log->printf(MOUSE_TASK_PREFIX"Connected!\n");
         mouse->attachEvent(mouseEvent);
+        prepareCursor(true);
 
         while(mouse->connected()) {
             log->printf(MOUSE_TASK_PREFIX"Buttons: 0x%02x, X %3d, Y %3d, Z %3d\n", mouse_button, mouse_x, mouse_y, mouse_z);