
Ćwiczenie zrealizowane na potrzeby przedmiotu PPO przez Krzysztofa Bolka
Dependencies: LCD_DISCO_F429ZI mbed TS_DISCO_F429ZI BSP_DISCO_F429ZI
Diff: Led_Lcd.cpp
- Revision:
- 1:d562d46c33b7
- Parent:
- 0:f4c2a4d3c318
--- a/Led_Lcd.cpp Tue May 12 15:42:00 2020 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -#include "Led_Lcd.h" -#include "mbed.h" -#include "LCD_DISCO_F429ZI.h" -#include <cstdlib> - -LCD_DISCO_F429ZI lcd; - -LedLcd::LedLcd(uint8_t WhichColumn){ - lcd.Clear(LCD_COLOR_BLACK); - ui8Column = ((WhichColumn > 1) && (WhichColumn <= 3)) ? WhichColumn: 1; - }; - -void LedLcd::Button(uint8_t ui8ButtonNumber, ButtonState eButtonState){ - char ui8Buffer[4]; - - lcd.SetTextColor(LCD_COLOR_GREEN); - lcd.DrawRect(((ui8Column-1)*80),80*ui8ButtonNumber,80,80); - - if(eButtonState == BUTTON_PRESSED) lcd.SetTextColor(LCD_COLOR_GREEN); - else if(eButtonState == BUTTON_RELEASED) lcd.SetTextColor(LCD_COLOR_BLUE); - lcd.FillRect(((ui8Column-1)*80)+2,80*ui8ButtonNumber+2,77,77); - - BSP_LCD_SetFont(&Font24); - lcd.SetBackColor(LCD_COLOR_RED); - sprintf(ui8Buffer,"%d",ui8ButtonNumber); - lcd.SetTextColor(LCD_COLOR_WHITE); - lcd.DisplayStringAt(((ui8Column-1)*80)+1,80*ui8ButtonNumber+1,(uint8_t *)&ui8Buffer,LEFT_MODE); - }; - -void LedLcd::On(uint8_t ui8ButtonNumber){ - for(uint8_t ui8Counter=0; ui8Counter<4; ui8Counter++){ - if(ui8Counter == ui8ButtonNumber) Button(ui8Counter,BUTTON_PRESSED); - else Button(ui8Counter,BUTTON_RELEASED); - } - }; \ No newline at end of file