NuMaker emWin HMI

Files at this revision

API Documentation at this revision

Comitter:
csyang2
Date:
Wed Feb 27 14:27:09 2019 +0800
Child:
1:c0f972361605
Commit message:
Initial commit

Changed in this revision

README.md 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
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README.md	Wed Feb 27 14:27:09 2019 +0800
@@ -0,0 +1,74 @@
+# Getting started sample with emWin simple demo on Mbed OS
+
+This is an example to utilize emWin library to demonstrate interactive feature.
+
+### CLI
+Target board "NUMAKER_PFM_M487" with GCC_ARM toolchain.
+1. mbed target "NUMAKER_PFM_M487"
+2. mbed toolchain "GCC_ARM"
+3. mbed config -G GCC_ARM_PATH "C:\Program Files (x86)\GNU Tools ARM Embedded\5.4 2016q2\bin"
+4. mbed compile
+
+Target board "NUMAKER_PFM_M487" with ARM toolchain.
+1. mbed target "NUMAKER_PFM_M487"
+2. mbed toolchain "ARM"
+3. mbed config -G ARM_PATH "C:\Keil_v5\ARM\ARMCC"
+4. mbed compile
+
+Please note that the toolchain path in step 3 may different from your environment.
+
+### Burn Code & Execute
+1. Connect the board NuMaker-PFM-XXX with your PC by USB cable, then there will be one "MBED" disk.
+2. Copy the built binary file into "MBED" disk on you PC.
+3. Press reset button to execute, user could test Audio Codec.
+
+### Demo condition, document and link
+ILI9341 MPU-type RGB56 QVGA LCD with resistive touch panel.
+
+Please reference the emWin related documents for further details, the path is in "\NuMaker-mbed-emWin-example\emWin\Doc"
+
+Quick start guide:  M480 emWin Quick Start Guide.pdf
+Official user manual: UM03001_emWin5.pdf
+
+SEGGER emWin official forum link:
+https://forum.segger.com/index.php/Board/12-emWin-related/
+
+Nuvoton HMI/GUI official forum link:
+http://forum.nuvoton.com/viewforum.php?f=31&sid=94265886594b34c7cd812d3f74c44fec
+http://nuvoton-mcu.com/forum.php?mod=forumdisplay&fid=86
+
+### PIN
+M487 TFT pin:
+-------------
+LCD_RS   PH_3
+LCD_REST PB_6
+LCD_BL   PB_7
+
+M487 TOUCH pin:
+---------------
+LCD_XR PB_9
+LCD_YU PB_8
+LCD_XL PH_4
+LCD_YD PH_5
+
+M487 EBI pin:
+-------------
+EBI_nRD  PE_5
+EBI_nWR  PE_4
+EBI_nCS0 PD_14
+EBI_AD15 PH_11
+EBI_AD14 PH_10
+EBI_AD13 PH_9
+EBI_AD12 PH_8
+EBI_AD11 PE_0
+EBI_AD10 PE_1
+EBI_AD9  PE_15
+EBI_AD8  PE_14
+EBI_AD7  PD_9
+EBI_AD6  PD_8
+EBI_AD5  PG_14
+EBI_AD4  PG_13
+EBI_AD3  PG_12
+EBI_AD2  PG_11
+EBI_AD1  PG_10
+EBI_AD0  PG_9
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Feb 27 14:27:09 2019 +0800
@@ -0,0 +1,91 @@
+#include "mbed.h"
+
+#include "GUI.h"
+#include "WM.h"
+#include "FRAMEWIN.h"
+
+#include "M48XTouchPanel.h"
+#include "tslib.h"
+//
+// Enable emWin touch feature after calibration
+//
+volatile int g_enable_Touch;
+//
+// For touch sampling timer
+//
+Ticker s_ticker_emWinloop;
+//
+// emWin timer count
+//
+extern GUI_TIMER_TIME OS_TimeMS;
+//
+// Tick loop for emWin and touch
+//
+void task_emWinloop(void)
+{
+    OS_TimeMS++;
+#if GUI_SUPPORT_TOUCH
+    if ( OS_TimeMS % 10 == 0 )
+    {
+        if ( g_enable_Touch == 1 )
+        {
+            GUI_TOUCH_Exec();
+        }
+    }
+#endif
+}
+//
+// Extern emWin GUI layout
+//
+extern WM_HWIN CreateFramewin(void);
+//
+// emWin MainTask to create a GUI layout
+//
+void MainTask(void)
+{
+    WM_HWIN hWin;
+    char     acVersion[40] = "Framewin: Version of emWin: ";
+
+    printf("Main Task -> \n");
+
+    strcat(acVersion, GUI_GetVersionString());
+    hWin = CreateFramewin();
+    FRAMEWIN_SetText(hWin, acVersion);
+    while (1)
+    {
+        GUI_Delay(500);
+    }
+}
+//
+// Main
+//
+int main(void)
+{
+    //
+    // Before touch calibration
+    //
+    g_enable_Touch = 0;
+    //
+    // Attach Mbed tick
+    //
+    s_ticker_emWinloop.attach(&task_emWinloop, 0.001);
+
+#if GUI_SUPPORT_TOUCH
+    //
+    // Init emWin and touch calibration
+    //
+    GUI_Init();
+    Init_TouchPanel();
+    ts_calibrate(__DEMO_TS_WIDTH__, __DEMO_TS_HEIGHT__);
+#endif
+    //
+    // After touch calibration
+    //
+    g_enable_Touch = 1;
+    //
+    // Create GUI layout
+    //
+    MainTask();
+
+    while(1);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Wed Feb 27 14:27:09 2019 +0800
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/mbed-os/#f9ee4e849f8cbd64f1ec5fdd4ad256585a208360