a

Dependencies:   BSP_DISCO_F429ZI LCD_DISCO_F429ZI TS_DISCO_F429ZI mbed

Fork of Mbed1d-2 by Przemyslaw Drwal

Revision:
0:9b028a92ac8a
diff -r 000000000000 -r 9b028a92ac8a Led_Lcd.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Led_Lcd.cpp	Mon Apr 24 15:26:38 2017 +0000
@@ -0,0 +1,72 @@
+#include "mbed.h"
+#include "Led_Lcd.h"
+
+LCD_DISCO_F429ZI lcd;
+
+void LedLcd::ButtonNoPushed(uint16_t x_pos,uint16_t y_pos, uint16_t width, uint16_t height){
+    lcd.SetTextColor(LCD_COLOR_GREEN);
+    lcd.DrawRect(x_pos,y_pos,width,height);
+    lcd.SetTextColor(LCD_COLOR_BLUE);
+    lcd.FillRect(x_pos+1,y_pos+1,width-1,height-1);
+    }
+void LedLcd::ButtonPushed(uint16_t x_pos,uint16_t y_pos, uint16_t width, uint16_t height) {
+    lcd.SetTextColor(LCD_COLOR_GREEN);
+    lcd.DrawRect(x_pos,y_pos,width,height);
+    lcd.SetTextColor(LCD_COLOR_GREEN);
+    lcd.FillRect(x_pos+1,y_pos+1,width-1,height-1);
+    }
+    
+void LedLcd::SetString(uint8_t x_pos,uint8_t y_pos,uint8_t *pText, Text_AlignModeTypdef mode) {
+    lcd.SetFont(&Font24);
+    lcd.SetTextColor(LCD_COLOR_WHITE);
+    lcd.SetBackColor(LCD_COLOR_RED);
+    lcd.DisplayStringAt(x_pos, y_pos,pText, mode);
+    }
+    
+LedLcd::LedLcd(uint8_t num) {
+    lcd.Clear(LCD_COLOR_BLACK);
+    if(num>=1 && num<=3) 
+        column=num;
+    else
+        column=1;
+    
+    }
+
+    
+ void LedLcd::On(uint8_t ButtonNum) {
+    
+    uint8_t x_pos;
+    
+    switch(column) {
+        case 1: x_pos=0; break;
+        case 2: x_pos=79; break;
+        case 3: x_pos=159; break;
+        }
+    
+    
+        ButtonNoPushed(x_pos,0,80,80);
+        ButtonNoPushed(x_pos,79,80,80);
+        ButtonNoPushed(x_pos,159,80,80);
+        ButtonNoPushed(x_pos,239,80,80); 
+        
+        if(ButtonNum==0) {
+           ButtonPushed(x_pos,0,80,80); 
+            } 
+        else if(ButtonNum==1)  {
+            ButtonPushed(x_pos,79,80,80);
+         }
+         else if(ButtonNum==2) {
+            ButtonPushed(x_pos,159,80,80);
+             }    
+        else if(ButtonNum==3) {
+            ButtonPushed(x_pos,239,80,80);
+            }
+            else if(ButtonNum==4) {
+                }
+        
+        SetString(x_pos,0,(uint8_t *)"0",LEFT_MODE);
+        SetString(x_pos,79,(uint8_t *)"1",LEFT_MODE);
+        SetString(x_pos,159,(uint8_t *)"2",LEFT_MODE);  
+        SetString(x_pos,239,(uint8_t *)"3",LEFT_MODE); 
+    }   
+    
\ No newline at end of file