MTM PPO mbed cz3
Dependencies: LCD_DISCO_F429ZI mbed TS_DISCO_F429ZI BSP_DISCO_F429ZI
Diff: Led.cpp
- Revision:
- 2:ce9137eb0655
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Led.cpp Mon Jun 22 14:15:01 2020 +0000 @@ -0,0 +1,30 @@ +#include "Led.h" + +extern LCD_DISCO_F429ZI lcd; + +Led::Led(unsigned char ucColumn, unsigned char ucRow){ + this->ucColumn = ucColumn; + this->ucRow = ucRow; + Off(); +} + +void Led::On(void){ + Redraw(LCD_COLOR_YELLOW); +} + +void Led::Off(void){ + Redraw(LCD_COLOR_BLUE); +} + + +void Led::Redraw(uint32_t Color){ + char pcLedNumber[1]; + lcd.SetTextColor(LCD_COLOR_GREEN); + lcd.DrawRect(ucColumn * 80, ucRow * 80, 80, 80); + lcd.SetTextColor(Color); + lcd.FillRect(1 + ucColumn * 80, 1 + ucRow * 80, 78, 78); + lcd.SetTextColor(LCD_COLOR_WHITE); + lcd.SetBackColor(LCD_COLOR_RED); + sprintf((char*)pcLedNumber, "%d", ucRow); + lcd.DisplayStringAt(ucColumn * 80, ucRow * 80, (uint8_t *)pcLedNumber, LEFT_MODE); +} \ No newline at end of file