Przemysław Kurzak / Mbed 2 deprecated DISCO-F429ZI_LCD_2d-2

Dependencies:   LCD_DISCO_F429ZI mbed TS_DISCO_F429ZI BSP_DISCO_F429ZI

Files at this revision

API Documentation at this revision

Comitter:
bridzysta
Date:
Mon May 25 12:36:53 2020 +0000
Parent:
0:00760a80f72b
Commit message:
New version

Changed in this revision

Keyboard_Ts.cpp Show annotated file Show diff for this revision Revisions of this file
Keyboard_Ts.h Show annotated file Show diff for this revision Revisions of this file
Keyboard_TsLcd.cpp Show annotated file Show diff for this revision Revisions of this file
Led_Lcd.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 00760a80f72b -r 6a6bc6bc51b0 Keyboard_Ts.cpp
--- a/Keyboard_Ts.cpp	Mon May 18 15:00:45 2020 +0000
+++ b/Keyboard_Ts.cpp	Mon May 25 12:36:53 2020 +0000
@@ -26,7 +26,7 @@
         }
     }
     else{
-        return BUTTON_4;
+        return RELEASED;
     }
 }
 
diff -r 00760a80f72b -r 6a6bc6bc51b0 Keyboard_Ts.h
--- a/Keyboard_Ts.h	Mon May 18 15:00:45 2020 +0000
+++ b/Keyboard_Ts.h	Mon May 25 12:36:53 2020 +0000
@@ -3,7 +3,7 @@
 
 #include "TS_DISCO_F429ZI.h"
 
-enum State {BUTTON_0, BUTTON_1, BUTTON_2, BUTTON_3, BUTTON_4};
+enum State {BUTTON_0, BUTTON_1, BUTTON_2, BUTTON_3, RELEASED};
 
 class KeyboardTs{
     public:
diff -r 00760a80f72b -r 6a6bc6bc51b0 Keyboard_TsLcd.cpp
--- a/Keyboard_TsLcd.cpp	Mon May 18 15:00:45 2020 +0000
+++ b/Keyboard_TsLcd.cpp	Mon May 25 12:36:53 2020 +0000
@@ -23,6 +23,6 @@
             return BUTTON_3;
         default:
             pLed -> On(4);
-            return BUTTON_4;
+            return RELEASED;
     }
 }
\ No newline at end of file
diff -r 00760a80f72b -r 6a6bc6bc51b0 Led_Lcd.cpp
--- 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