Initial version.

Dependencies:   LCD_DISCO_F429ZI mbed TS_DISCO_F429ZI BSP_DISCO_F429ZI

Revision:
1:6a6bc6bc51b0
Parent:
0:00760a80f72b
--- a/Led_Lcd.cpp	Mon May 18 15:00:45 2020 +0000
+++ b/Led_Lcd.cpp	Mon May 25 12:36:53 2020 +0000
@@ -1,4 +1,5 @@
 #include "Led_Lcd.h"
+#include <stdio.h>
 
 LCD_DISCO_F429ZI lcd;
 
@@ -6,40 +7,27 @@
 {
     ucColumnXIndex = (ucColumnXPosition * 80);
     lcd.Clear(LCD_COLOR_BLACK);
+    lcd.SetFont(&Font24);
 }
 
 void LedLcd::On(unsigned char ucButtonLight)
 {
     uint16_t Ypos = 0;
+    char text[2];
+    lcd.SetBackColor(LCD_COLOR_RED);
     for(unsigned char ucButtonNumber = 0; ucButtonNumber < 4; ucButtonNumber++){
         lcd.SetTextColor(LCD_COLOR_GREEN);
-        lcd.DrawRect(ucColumnXIndex,    0x0000+Ypos, 0x0050, 0x0050);  
-        lcd.SetTextColor(LCD_COLOR_BLUE);
-        lcd.FillRect(ucColumnXIndex+1,  0x0001+Ypos, 0x004F, 0x004F);
-        Ypos = Ypos + 0x0050;
-    }
-    lcd.SetBackColor(LCD_COLOR_RED);
-    lcd.SetTextColor(LCD_COLOR_WHITE);
-    lcd.SetFont(&Font24);
-    lcd.DisplayStringAt(ucColumnXIndex, 0x0001,               (uint8_t *)"0", LEFT_MODE);
-    lcd.DisplayStringAt(ucColumnXIndex, 0x0001+0x0050,        (uint8_t *)"1", LEFT_MODE);
-    lcd.DisplayStringAt(ucColumnXIndex, 0x0001+2*0x0050,      (uint8_t *)"2", LEFT_MODE);
-    lcd.DisplayStringAt(ucColumnXIndex, 0x0001+3*0x0050,      (uint8_t *)"3", LEFT_MODE);
-    lcd.SetTextColor(LCD_COLOR_GREEN);
-    switch(ucButtonLight){
-        case 0:
-            lcd.FillRect(ucColumnXIndex, 0x0001, 0x004F, 0x004F);
-            break;    
-        case 1:
-            lcd.FillRect(ucColumnXIndex, 0x0051, 0x004F, 0x004F);
-            break;    
-        case 2:
-            lcd.FillRect(ucColumnXIndex, 0x00A1, 0x004F, 0x004F);
-            break;    
-        case 3:
-            lcd.FillRect(ucColumnXIndex, 0x00F1, 0x004F, 0x004F);
-            break;    
-        default:
-            break;
+        lcd.DrawRect(ucColumnXIndex, 0+Ypos, 80, 80);  
+        if(ucButtonNumber == ucButtonLight){
+            lcd.SetTextColor(LCD_COLOR_GREEN);
+        }
+        else{
+            lcd.SetTextColor(LCD_COLOR_BLUE);
+        }
+        lcd.FillRect(ucColumnXIndex+1, 1+Ypos, 79, 79);
+        lcd.SetTextColor(LCD_COLOR_WHITE);
+        sprintf(text, "%d", ucButtonNumber);
+        lcd.DisplayStringAt(ucColumnXIndex, 1+Ypos, (uint8_t *)&text, LEFT_MODE);
+        Ypos = Ypos + 80;
     }
 }
\ No newline at end of file