Wakeup Light with touch user interface, anti-aliased Font, SD card access and RTC usage on STM32F746NG-DISCO board

Dependencies:   BSP_DISCO_F746NG_patch_fixed LCD_DISCO_F746NG TS_DISCO_F746NG FATFileSystem TinyJpgDec_interwork mbed-src

Files at this revision

API Documentation at this revision

Comitter:
the_sz
Date:
Mon Nov 09 17:53:22 2015 +0000
Parent:
4:2fe89414d4df
Child:
6:aa51cc3b9f90
Commit message:
color button

Changed in this revision

BSP_DISCO_F746NG.lib Show annotated file Show diff for this revision Revisions of this file
LED.cpp Show annotated file Show diff for this revision Revisions of this file
LED.h Show annotated file Show diff for this revision Revisions of this file
UI.cpp Show annotated file Show diff for this revision Revisions of this file
UI.h Show annotated file Show diff for this revision Revisions of this file
UI_ColorTest.cpp Show annotated file Show diff for this revision Revisions of this file
UI_Main.cpp Show annotated file Show diff for this revision Revisions of this file
UI_Wakup.cpp 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
--- a/BSP_DISCO_F746NG.lib	Thu Oct 29 19:02:38 2015 +0000
+++ b/BSP_DISCO_F746NG.lib	Mon Nov 09 17:53:22 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/teams/ST/code/BSP_DISCO_F746NG/#c9112f0c67e3
+http://mbed.org/teams/ST/code/BSP_DISCO_F746NG/#9efcbb56ccee
--- a/LED.cpp	Thu Oct 29 19:02:38 2015 +0000
+++ b/LED.cpp	Mon Nov 09 17:53:22 2015 +0000
@@ -1,11 +1,5 @@
 #include "WakeupLight.h"
 
-#define COLOR_CREATE(_RED_,_GREEN_,_BLUE_,_WHITE_)          (_RED_ | (_GREEN_ << 8) | (_BLUE_ << 16) | (_WHITE_ <<24))
-#define COLOR_RED(_COLOR_)                                  (_COLOR_ & 0xFF)
-#define COLOR_GREEN(_COLOR_)                                ((_COLOR_ >> 8) & 0xFF)
-#define COLOR_BLUE(_COLOR_)                                 ((_COLOR_ >> 16) & 0xFF)
-#define COLOR_WHITE(_COLOR_)                                ((_COLOR_ >> 24) & 0xFF)
-
 #define LED_PERIOD                                          10
 
 PwmOut                                                      ledBlue(PB_15);
--- a/LED.h	Thu Oct 29 19:02:38 2015 +0000
+++ b/LED.h	Mon Nov 09 17:53:22 2015 +0000
@@ -1,6 +1,12 @@
 #ifndef __LED_h
 #define __LED_h
 
+#define COLOR_CREATE(_RED_,_GREEN_,_BLUE_,_WHITE_)          (_RED_ | (_GREEN_ << 8) | (_BLUE_ << 16) | (_WHITE_ <<24))
+#define COLOR_RED(_COLOR_)                                  (_COLOR_ & 0xFF)
+#define COLOR_GREEN(_COLOR_)                                ((_COLOR_ >> 8) & 0xFF)
+#define COLOR_BLUE(_COLOR_)                                 ((_COLOR_ >> 16) & 0xFF)
+#define COLOR_WHITE(_COLOR_)                                ((_COLOR_ >> 24) & 0xFF)
+
 typedef enum
 {
     LAE_NONE,
@@ -11,5 +17,6 @@
      
 void LED_Init(void);
 void LED_StartAnimation(LED_ANIMATION_ENUM animation);
+void LED_SetColor(int32_t color);
 
 #endif
--- a/UI.cpp	Thu Oct 29 19:02:38 2015 +0000
+++ b/UI.cpp	Mon Nov 09 17:53:22 2015 +0000
@@ -10,13 +10,22 @@
 #define CLOCK_COLOR_BG          ((uint32_t)0xFF000000)
 #define CLOCK_COLOR_FG          ((uint32_t)0xFF707070)
 
+#define BUTTON_WIDTH            100
+#define BUTTON_HEIGHT           60
+#define BUTTON_COLOR_BG         ((uint32_t)0x00000000)
+#define BUTTON_COLOR_FG         CLIENT_COLOR_FG
+#define BUTTON_COLOR_BG_START   0x0C2696
+#define BUTTON_COLOR_BG_END     0x07185E
+
 #define COLOR_BG                ((uint32_t)0xFF000000)
 
 #define MAX_BOXES_PER_LINE      3
 #define BOX_SPACING             10
 #define BOX_TEXT_SPACING        10
-#define BOX_COLOR_BG            ((uint32_t)0xFF808080)
+#define BOX_COLOR_BG            BUTTON_COLOR_BG
 #define BOX_COLOR_FG            CLIENT_COLOR_FG
+#define BOX_COLOR_BG_START      BUTTON_COLOR_BG_START
+#define BOX_COLOR_BG_END        BUTTON_COLOR_BG_END
 
 LCD_DISCO_F746NG                uiLcd;
 TS_DISCO_F746NG                 uiTs;
@@ -25,11 +34,12 @@
 UI_STRUCT                       *uiCurrent=NULL;
 UI_STRUCT                       uiClock;
 UI_STRUCT                       uiClockInWords;
+UI_STRUCT                       uiColorTest;
 UI_STRUCT                       uiWakeup;
 UI_STRUCT                       uiMain;
 UI_BOX_LIST_ITEM_STRUCT         uiMainItems[]=
 {
-    { "Clock" }, { "Clock\nWith Words" }, { "Adjust\nTimers" }, { "Lights On" }, { "Lights Off" }
+    { "Clock" }, { "Clock\nWith Words" }, { "Adjust\nTimers" }, { "Lights On" }, { "Lights Off" }, { "Color Test" }
 };
 
 //
@@ -38,7 +48,7 @@
 void UI_ShowClearClientRect(void)
 {
     uiLcd.SetTextColor(CLIENT_COLOR_BG);
-    uiLcd.FillRect(0,HEADER_HEIGHT,uiLcd.GetXSize()-1,uiLcd.GetYSize()-1);
+    uiLcd.FillRect(0,HEADER_HEIGHT,uiLcd.GetXSize(),uiLcd.GetYSize()-HEADER_HEIGHT);
 }
 
 void UI_ShowDisplayText(int16_t x,int16_t y,char *text)
@@ -67,7 +77,75 @@
         text++;
     }
 }
-    
+
+void UI_ShowDisplayTextCenter(int16_t x,int16_t y,int16_t width,int16_t height,char *text)
+{
+    int16_t             charWidth;
+    int16_t             charHeight;
+
+    charHeight=uiLcd.GetFont()->Height+3;
+    charWidth=uiLcd.GetFont()->Width;
+
+    x+=((width-(strlen(text)*charWidth))/2);
+    y+=((height-charHeight)/2);
+
+    while ((*text)!='\0')
+    {
+        uiLcd.DisplayChar(x,y,*text);
+        x+=charWidth;
+
+        text++;
+    }
+}
+
+void UI_ShowDrawGradientButton(uint16_t x,uint16_t y,uint16_t width,uint16_t height,uint32_t colorStart,uint32_t colorEnd)
+{
+    float       deltaRed;
+    float       deltaGreen;
+    float       deltaBlue;
+    float       red;
+    float       green;
+    float       blue;
+    uint16_t    offset;
+    uint32_t    color;
+
+    deltaRed=(float)((int32_t)(colorEnd & 0xFF) - (int32_t)(colorStart & 0xFF))/height;
+    deltaGreen=(float)((int32_t)((colorEnd >> 8) & 0xFF) - (int32_t)((colorStart >> 8)& 0xFF))/height;
+    deltaBlue=(float)((int32_t)((colorEnd >> 16) & 0xFF) - (int32_t)((colorStart >> 16)& 0xFF))/height;
+
+    red=colorStart & 0xFF;
+    green=((colorStart >> 8)& 0xFF);
+    blue=((colorStart >> 16)& 0xFF);
+
+    for (offset=0;offset<height;offset++)
+    {
+        color=(uint8_t)red | (((uint8_t)green)<<8) | (((uint8_t)blue)<<16) | (((uint32_t)0xFF)<<24);
+        uiLcd.SetTextColor(color);
+
+        if ((offset==0) || (offset==(height-1)))
+            uiLcd.DrawHLine(x+1,y+offset,width-2);
+        else
+            uiLcd.DrawHLine(x,y+offset,width);
+
+        red+=deltaRed;
+        green+=deltaGreen;
+        blue+=deltaBlue;
+    }
+}
+
+void UI_ShowDrawButton(uint16_t x,uint16_t y,char *text)
+{
+    // paint button background
+    UI_ShowDrawGradientButton(x,y,BUTTON_WIDTH,BUTTON_HEIGHT,BUTTON_COLOR_BG_START,BUTTON_COLOR_BG_END);
+
+    // paint button text
+    uiLcd.SetFont(&display_font_12x22);
+    uiLcd.SetBackColor(BUTTON_COLOR_BG);
+    uiLcd.SetTextColor(BUTTON_COLOR_FG);
+
+    UI_ShowDisplayTextCenter(x,y,BUTTON_WIDTH,BUTTON_HEIGHT,text);
+}
+
 //
 // box list
 //
@@ -103,16 +181,15 @@
             startY=HEADER_HEIGHT+BOX_SPACING+(height*(box/columns));
 
             // paint box background
-            uiLcd.SetTextColor(BOX_COLOR_BG);
-            uiLcd.FillRect(startX,startY,width-BOX_SPACING,height-BOX_SPACING);
-            
+            UI_ShowDrawGradientButton(startX,startY,width-BOX_SPACING,height-BOX_SPACING,BOX_COLOR_BG_START,BOX_COLOR_BG_END);
+
             // paint box text
             uiLcd.SetFont(&display_font_12x22);
             uiLcd.SetBackColor(BOX_COLOR_BG);
             uiLcd.SetTextColor(BOX_COLOR_FG);
             UI_ShowDisplayText(startX+BOX_TEXT_SPACING,startY+BOX_TEXT_SPACING,uiCurrent->data.boxList.items[box].name);
         }
-      }
+    }
 }
 
 void UI_ClickBoxList(uint16_t x,uint16_t y)
@@ -187,7 +264,7 @@
     {
         // fill background
         uiLcd.SetTextColor(CLOCK_COLOR_BG);
-        uiLcd.FillRect(0,0,uiLcd.GetXSize()-1,uiLcd.GetYSize()-1);
+        uiLcd.FillRect(0,0,uiLcd.GetXSize(),uiLcd.GetYSize());
     }
 
     // show clock
@@ -244,25 +321,85 @@
 }
 
 //
-// timer adjust
+// value adjust
 //
-void UI_ShowTimerAdjust(bool initial)
+void UI_ShowValueAdjust(bool initial)
 {
+    char                        buffer[20];
+
     if (initial==true)
     {
         // fill background
         UI_ShowClearClientRect();
+
+        if (uiCurrent->data.valueAdjust.count==4)
+        {
+            UI_ShowDrawButton(17+(0*(BUTTON_WIDTH+15)),40,"+");
+            UI_ShowDrawButton(17+(1*(BUTTON_WIDTH+15)),40,"+");
+            UI_ShowDrawButton(17+(2*(BUTTON_WIDTH+15)),40,"+");
+            UI_ShowDrawButton(17+(3*(BUTTON_WIDTH+15)),40,"+");
+
+            UI_ShowDrawButton(17+(0*(BUTTON_WIDTH+15)),205,"-");
+            UI_ShowDrawButton(17+(1*(BUTTON_WIDTH+15)),205,"-");
+            UI_ShowDrawButton(17+(2*(BUTTON_WIDTH+15)),205,"-");
+            UI_ShowDrawButton(17+(3*(BUTTON_WIDTH+15)),205,"-");
+        }
+    }
+
+    uiLcd.SetBackColor(CLIENT_COLOR_BG);
+    uiLcd.SetTextColor(CLIENT_COLOR_FG);
+
+    if (uiCurrent->data.valueAdjust.count==4)
+    {
+        snprintf(buffer,sizeof(buffer),"0x%02X",uiCurrent->data.valueAdjust.values[0]);
+        UI_ShowDisplayTextCenter(17+(0*(BUTTON_WIDTH+15)),125,BUTTON_WIDTH,BUTTON_HEIGHT,buffer);
+
+        snprintf(buffer,sizeof(buffer),"0x%02X",uiCurrent->data.valueAdjust.values[1]);
+        UI_ShowDisplayTextCenter(17+(1*(BUTTON_WIDTH+15)),125,BUTTON_WIDTH,BUTTON_HEIGHT,buffer);
+
+        snprintf(buffer,sizeof(buffer),"0x%02X",uiCurrent->data.valueAdjust.values[2]);
+        UI_ShowDisplayTextCenter(17+(2*(BUTTON_WIDTH+15)),125,BUTTON_WIDTH,BUTTON_HEIGHT,buffer);
+
+        snprintf(buffer,sizeof(buffer),"0x%02X",uiCurrent->data.valueAdjust.values[3]);
+        UI_ShowDisplayTextCenter(17+(3*(BUTTON_WIDTH+15)),125,BUTTON_WIDTH,BUTTON_HEIGHT,buffer);
     }
 }
 
-void UI_ClickTimerAdjust(uint16_t x,uint16_t y)
+void UI_ClickValueAdjust(uint16_t x,uint16_t y)
 {
-    uint32_t                    index;
+    int32_t                     index;
 
     // detect at which button was clicked
-    index=0;
+    index=-1;
 
-    uiCurrent->handler(UR_CLICK,index,uiCurrent);
+    if (uiCurrent->data.valueAdjust.count==4)
+    {
+        if ((y>=40) && (y<(40+BUTTON_HEIGHT)))
+        {
+            if ((x>=(17+(0*(BUTTON_WIDTH+15)))) && (x<(17+(0*(BUTTON_WIDTH+15))+BUTTON_WIDTH)))
+                index=0;
+            else if ((x>=(17+(1*(BUTTON_WIDTH+15)))) && (x<(17+(1*(BUTTON_WIDTH+15))+BUTTON_WIDTH)))
+                index=1;
+            else if ((x>=(17+(2*(BUTTON_WIDTH+15)))) && (x<(17+(2*(BUTTON_WIDTH+15))+BUTTON_WIDTH)))
+                index=2;
+            else if ((x>=(17+(3*(BUTTON_WIDTH+15)))) && (x<(17+(3*(BUTTON_WIDTH+15))+BUTTON_WIDTH)))
+                index=3;
+        }
+        else if ((y>=205) && (y<(205+BUTTON_HEIGHT)))
+        {
+            if ((x>=(17+(0*(BUTTON_WIDTH+15)))) && (x<(17+(0*(BUTTON_WIDTH+15))+BUTTON_WIDTH)))
+                index=4;
+            else if ((x>=(17+(1*(BUTTON_WIDTH+15)))) && (x<(17+(1*(BUTTON_WIDTH+15))+BUTTON_WIDTH)))
+                index=5;
+            else if ((x>=(17+(2*(BUTTON_WIDTH+15)))) && (x<(17+(2*(BUTTON_WIDTH+15))+BUTTON_WIDTH)))
+                index=6;
+            else if ((x>=(17+(3*(BUTTON_WIDTH+15)))) && (x<(17+(3*(BUTTON_WIDTH+15))+BUTTON_WIDTH)))
+                index=7;
+        }
+    }
+
+    if (index!=-1)
+        uiCurrent->handler(UR_CLICK,index,uiCurrent);
 }
 
 //
@@ -286,10 +423,21 @@
     // setup ui structs
     uiClock.flags=UI_FLAG_TYPE_CLOCK;
     uiClock.handler=NULL;
+
     uiClockInWords.flags=UI_FLAG_TYPE_CLOCK_IN_WORDS;
     uiClockInWords.handler=NULL;
+
     uiWakeup.flags=UI_FLAG_TYPE_BOX_LIST;
     uiWakeup.handler=UI_WakeupHandler;
+
+    uiColorTest.flags=UI_FLAG_TYPE_VALUE_ADJUST;
+    uiColorTest.handler=UI_ColorTestHandler;
+    uiColorTest.data.valueAdjust.count=4;
+    uiColorTest.data.valueAdjust.values[0]=0x80;
+    uiColorTest.data.valueAdjust.values[1]=0x80;
+    uiColorTest.data.valueAdjust.values[2]=0x80;
+    uiColorTest.data.valueAdjust.values[3]=0x80;
+
     uiMain.flags=UI_FLAG_TYPE_BOX_LIST;
     uiMain.handler=UI_MainHandler;
     uiMain.data.boxList.items=uiMainItems;
@@ -308,7 +456,13 @@
     {
         // fill background
         uiLcd.SetTextColor(HEADER_COLOR_BG);
-        uiLcd.FillRect(0,0,uiLcd.GetXSize()-1,HEADER_HEIGHT);
+        uiLcd.FillRect(0,0,uiLcd.GetXSize(),HEADER_HEIGHT);
+
+        uiLcd.SetFont(&display_font_12x22);
+        uiLcd.SetBackColor(HEADER_COLOR_BG);
+        uiLcd.SetTextColor(HEADER_COLOR_FG);
+        if ((uiCurrent->flags & UI_FLAG_HAS_BACK_BUTTON)!=0)
+            uiLcd.DisplayStringAt(5,2,(uint8_t *)"<-",LEFT_MODE);
     }
 
     // show clock
@@ -331,7 +485,7 @@
     if ((uiCurrent->flags & UI_FLAG_NEEDS_CHROME)!=0)
         UI_ShowChrome(initial);
 
-    typeFlag=uiCurrent->flags & ~UI_FLAG_NEEDS_CHROME;
+    typeFlag=uiCurrent->flags & ~(UI_FLAG_NEEDS_CHROME | UI_FLAG_HAS_BACK_BUTTON);
     if ((typeFlag & UI_FLAG_TYPE_BOX_LIST)!=0)
         UI_ShowBoxList(initial);
     else if ((typeFlag & UI_FLAG_TYPE_MESSAGE_BOX)!=0)
@@ -340,13 +494,13 @@
         UI_ShowClock(initial);
     else if ((typeFlag & UI_FLAG_TYPE_CLOCK_IN_WORDS)!=0)
         UI_ShowClockInWords(initial);
-    else if ((typeFlag & UI_FLAG_TYPE_TIMER_ADJUST)!=0)
-        UI_ShowTimerAdjust(initial);
+    else if ((typeFlag & UI_FLAG_TYPE_VALUE_ADJUST)!=0)
+        UI_ShowValueAdjust(initial);
 }
 
 void UI_Show(UI_STRUCT *ui)
 {
-    DPrintf("UI_Show: 0x%X.\r\n",ui->flags);
+    DPrintf_("UI_Show: 0x%X.\r\n",ui->flags);
 
     uiCurrent=ui;
 
@@ -360,7 +514,21 @@
 {
     uint8_t     typeFlag;
 
-    typeFlag=uiCurrent->flags & ~UI_FLAG_NEEDS_CHROME;
+    DPrintf_("UI_Click: %u x %u.\r\n",x,y);
+
+    if ((uiCurrent->flags & UI_FLAG_HAS_BACK_BUTTON)!=0)
+    {
+        if ((y<40) && (x<40))
+        {
+            if (uiCurrent->handler!=NULL)
+            {
+                uiCurrent->handler(UR_CLICK,-1,uiCurrent);
+                return;
+            }
+        }
+    }
+
+    typeFlag=uiCurrent->flags & ~(UI_FLAG_NEEDS_CHROME | UI_FLAG_HAS_BACK_BUTTON);
     if ((typeFlag & UI_FLAG_TYPE_BOX_LIST)!=0)
         UI_ClickBoxList(x,y);
     else if ((typeFlag & UI_FLAG_TYPE_MESSAGE_BOX)!=0)
@@ -369,8 +537,8 @@
         UI_ClickClock(x,y);
     else if ((typeFlag & UI_FLAG_TYPE_CLOCK_IN_WORDS)!=0)
         UI_ClickClockInWords(x,y);
-    else if ((typeFlag & UI_FLAG_TYPE_TIMER_ADJUST)!=0)
-        UI_ClickTimerAdjust(x,y);
+    else if ((typeFlag & UI_FLAG_TYPE_VALUE_ADJUST)!=0)
+        UI_ClickValueAdjust(x,y);
 }
 
 void UI_Poll(void)
@@ -385,7 +553,7 @@
                     (ABS(uiLastTouchY-tsState.touchY[0])>4)
            )
         {
-            DPrintf("UI_Poll: #%u - %ux%u.\r\n",tsState.touchDetected,tsState.touchX[0],tsState.touchY[0]);
+            DPrintf_("UI_Poll: #%u - %ux%u.\r\n",tsState.touchDetected,tsState.touchX[0],tsState.touchY[0]);
 
             uiLastTouchX=tsState.touchX[0];
             uiLastTouchY=tsState.touchY[0];
@@ -394,6 +562,11 @@
                 UI_Click(tsState.touchX[0],tsState.touchY[0]);
         }
     }
+    else
+    {
+        uiLastTouchX=0;
+        uiLastTouchY=0;
+    }
   
     if (uiCurrent!=NULL)
     {
--- a/UI.h	Thu Oct 29 19:02:38 2015 +0000
+++ b/UI.h	Mon Nov 09 17:53:22 2015 +0000
@@ -5,8 +5,9 @@
 #define UI_FLAG_TYPE_MESSAGE_BOX        (0x02 | UI_FLAG_NEEDS_CHROME)
 #define UI_FLAG_TYPE_CLOCK              0x04
 #define UI_FLAG_TYPE_CLOCK_IN_WORDS     (0x08 | UI_FLAG_NEEDS_CHROME)
-#define UI_FLAG_TYPE_TIMER_ADJUST       (0x10 | UI_FLAG_NEEDS_CHROME)
+#define UI_FLAG_TYPE_VALUE_ADJUST       (0x10 | UI_FLAG_NEEDS_CHROME | UI_FLAG_HAS_BACK_BUTTON)
 #define UI_FLAG_NEEDS_CHROME            0x20
+#define UI_FLAG_HAS_BACK_BUTTON         0x40
 
 typedef enum
 {
@@ -17,7 +18,7 @@
 } UI_REASON_ENUM;
 
 struct UI_STRUCT_;
-typedef void (*UI_HANDLER_CALLBACK)(UI_REASON_ENUM reason,uint32_t index,UI_STRUCT_ *ui);
+typedef void (*UI_HANDLER_CALLBACK)(UI_REASON_ENUM reason,int32_t index,UI_STRUCT_ *ui);
 
 typedef struct
 {
@@ -45,7 +46,10 @@
 
         struct
         {
-        } timerAdjust;
+            uint8_t                     count;
+            uint32_t                    values[4];
+
+        } valueAdjust;
 
     } data;
 
@@ -53,6 +57,7 @@
 
 extern UI_STRUCT                        uiClock;
 extern UI_STRUCT                        uiClockInWords;
+extern UI_STRUCT                        uiColorTest;
 extern UI_STRUCT                        uiWakeup;
 extern UI_STRUCT                        uiMain;
 
@@ -60,8 +65,9 @@
 void UI_Poll(void);
 void UI_Show(UI_STRUCT *ui);
 
-void UI_MainHandler(UI_REASON_ENUM reason,uint32_t index,UI_STRUCT *ui);
+void UI_MainHandler(UI_REASON_ENUM reason,int32_t index,UI_STRUCT *ui);
 
-void UI_WakeupHandler(UI_REASON_ENUM reason,uint32_t index,UI_STRUCT *ui);
+void UI_WakeupHandler(UI_REASON_ENUM reason,int32_t index,UI_STRUCT *ui);
+void UI_ColorTestHandler(UI_REASON_ENUM reason,int32_t index,UI_STRUCT *ui);
 
 #endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/UI_ColorTest.cpp	Mon Nov 09 17:53:22 2015 +0000
@@ -0,0 +1,43 @@
+#include "WakeupLight.h"
+
+int32_t                 color;
+
+void UI_ColorTestHandler(UI_REASON_ENUM reason,int32_t index,UI_STRUCT *ui)
+{
+    switch (reason)
+    {
+        case UR_CLICK:
+            DPrintf_("UI_ColorTestHandler: %u.\r\n",index);
+            if (index==-1)
+            {
+                UI_Show(&uiMain);
+                uiColorTest.data.valueAdjust.values[0]=0;
+                uiColorTest.data.valueAdjust.values[1]=0;
+                uiColorTest.data.valueAdjust.values[2]=0;
+                uiColorTest.data.valueAdjust.values[3]=0;
+            }
+            else if (index==0)
+                uiColorTest.data.valueAdjust.values[0]=(uiColorTest.data.valueAdjust.values[0]+0x10) & 0xFF;
+            else if (index==1)
+                uiColorTest.data.valueAdjust.values[1]=(uiColorTest.data.valueAdjust.values[1]+0x10) & 0xFF;
+            else if (index==2)
+                uiColorTest.data.valueAdjust.values[2]=(uiColorTest.data.valueAdjust.values[2]+0x10) & 0xFF;
+            else if (index==3)
+                uiColorTest.data.valueAdjust.values[3]=(uiColorTest.data.valueAdjust.values[3]+0x10) & 0xFF;
+            else if (index==4)
+                uiColorTest.data.valueAdjust.values[0]=(uiColorTest.data.valueAdjust.values[0]-0x10) & 0xFF;
+            else if (index==5)
+                uiColorTest.data.valueAdjust.values[1]=(uiColorTest.data.valueAdjust.values[1]-0x10) & 0xFF;
+            else if (index==6)
+                uiColorTest.data.valueAdjust.values[2]=(uiColorTest.data.valueAdjust.values[2]-0x10) & 0xFF;
+            else if (index==7)
+                uiColorTest.data.valueAdjust.values[3]=(uiColorTest.data.valueAdjust.values[3]-0x10) & 0xFF;
+            // fall through
+
+        case UR_SHOW:
+            color=COLOR_CREATE(uiColorTest.data.valueAdjust.values[0],uiColorTest.data.valueAdjust.values[1],uiColorTest.data.valueAdjust.values[2],uiColorTest.data.valueAdjust.values[3]);
+            DPrintf_("UI_ColorTestHandler: Color: 0x%08X.\r\n",color);
+            LED_SetColor(color);
+            break;
+    }
+}
--- a/UI_Main.cpp	Thu Oct 29 19:02:38 2015 +0000
+++ b/UI_Main.cpp	Mon Nov 09 17:53:22 2015 +0000
@@ -2,7 +2,7 @@
 
 int32_t                         timeOut;
 
-void UI_MainHandler(UI_REASON_ENUM reason,uint32_t index,UI_STRUCT *ui)
+void UI_MainHandler(UI_REASON_ENUM reason,int32_t index,UI_STRUCT *ui)
 {
     switch (reason)
     {
@@ -17,6 +17,8 @@
                 LED_StartAnimation(LAE_WAKEUP);
             else if (index==4)
                 LED_StartAnimation(LAE_OFF);
+            else if (index==5)
+                UI_Show(&uiColorTest);
             break;
 
         case UR_TIMER:
--- a/UI_Wakup.cpp	Thu Oct 29 19:02:38 2015 +0000
+++ b/UI_Wakup.cpp	Mon Nov 09 17:53:22 2015 +0000
@@ -1,6 +1,6 @@
 #include "WakeupLight.h"
 
-void UI_WakeupHandler(UI_REASON_ENUM reason,uint32_t index,UI_STRUCT *ui)
+void UI_WakeupHandler(UI_REASON_ENUM reason,int32_t index,UI_STRUCT *ui)
 {
     switch (reason)
     {
--- a/main.cpp	Thu Oct 29 19:02:38 2015 +0000
+++ b/main.cpp	Mon Nov 09 17:53:22 2015 +0000
@@ -1,11 +1,5 @@
 #include "WakeupLight.h"
-#include "SDFileSystem.h"
 
-//SDFileSystem sd(PD_2, PC_8, PC_12, PC_11, "sd"); // MOSI, MISO, SCLK, SSEL
-DigitalOut nla(PC_8);
-//DigitalOut nla2(PD_2);   // bad
-DigitalOut nla1(PC_12);
-DigitalOut nla3(PC_11);
 int main()
 {
     debug_Init();
@@ -18,16 +12,16 @@
 
     UI_Init();
 
+/*
+#include "SDFileSystem.h"
+SDFileSystem sd(PD_2, PC_8, PC_12, PC_11, "sd"); // MOSI, MISO, SCLK, SSEL
+DigitalOut sdsd(PC_9);
+mkdir("/sd/foo",0777);
+FILE *fp = fopen("/sd/mbed.txt", "w");
+fprintf(fp, "Hello World!\n");
+fclose(fp);
+*/
 
-///
-//mkdir("/sd/foo",0777);
-/*
-      FILE *fp = fopen("/sd/mbed.txt", "w");
-      fprintf(fp, "Hello World!\n");
-      fclose(fp);
- */
-
-////
     for (;;)
     {
         UI_Poll();