Mbed touchscreed project. To be corrected

Dependencies:   LCD_DISCO_F429ZI mbed TS_DISCO_F429ZI BSP_DISCO_F429ZI

Revision:
4:35b2f0e76b02
Parent:
1:55e05d2aa9cd
Child:
5:f51c47a67607
--- a/Led_Lcd.cpp	Fri May 08 10:57:14 2020 +0000
+++ b/Led_Lcd.cpp	Mon May 11 09:49:05 2020 +0000
@@ -1,41 +1,24 @@
 #include "Led_Lcd.h"
 
-LCD_DISCO_F429ZI lcd;
-
-LedLcd::LedLcd(unsigned char columnNumber) {
+LedLcd::LedLcd(uint16_t columnNumber) {
     ColumnX = columnNumber*80;
-    uint16_t i;
-    const char* Text[] = {"0", "1", "2", "3"};
     
     BSP_LCD_SetFont(&Font24);
     lcd.Clear(LCD_COLOR_BLACK);
-    lcd.SetBackColor(LCD_COLOR_RED);   
-    
-    lcd.SetTextColor(LCD_COLOR_GREEN);
-    for(i=0; i<=240; i = i+80) lcd.DrawRect(ColumnX, i, 80, 80);  
-    
-    lcd.SetTextColor(LCD_COLOR_BLUE);
-    for(i=0; i<4; i ++) lcd.FillRect(ColumnX + 1, (80*i)+1 , 78, 78);
-    
-    lcd.SetTextColor(LCD_COLOR_WHITE);
-    for(i=0; i<4; i++) lcd.DisplayStringAt(ColumnX, i*80, (uint8_t *) Text[i], LEFT_MODE);
-
+    lcd.SetBackColor(LCD_COLOR_RED);
 }
 
-void LedLcd::On(uint16_t chosenSquare){
-    uint16_t i;
+void LedLcd::On(uint16_t chosenSquare) {
     const char* Text[] = {"0", "1", "2", "3"};
     
-    lcd.SetTextColor(LCD_COLOR_GREEN);
-    for(i=0; i<=240; i = i+80) lcd.DrawRect(ColumnX, i, 80, 80);  
-    
-    for(i=0; i<4; i ++) {
-        if( chosenSquare == i) lcd.SetTextColor(LCD_COLOR_GREEN);
-        else lcd.SetTextColor(LCD_COLOR_BLUE);
-        
+    for(uint16_t i=0; i<4; i++) {
+        lcd.SetTextColor(LCD_COLOR_GREEN);
+        lcd.DrawRect(ColumnX, i*80, 80, 80); 
+        //-----------------------------------------------------------------
+        if( chosenSquare != i) lcd.SetTextColor(LCD_COLOR_BLUE);
         lcd.FillRect(ColumnX+1, (80*i)+1 , 78, 78);
+        //-----------------------------------------------------------------
+        lcd.SetTextColor(LCD_COLOR_WHITE);
+        lcd.DisplayStringAt(ColumnX, i*80, (uint8_t *) Text[i], LEFT_MODE);
         }
-        
-    lcd.SetTextColor(LCD_COLOR_WHITE);
-    for(i=0; i<4; i++) lcd.DisplayStringAt(ColumnX, i*80, (uint8_t *) Text[i], LEFT_MODE);
 }