AGH UST mbed part 3

Dependencies:   LCD_DISCO_F429ZI mbed TS_DISCO_F429ZI BSP_DISCO_F429ZI

Led.cpp

Committer:
matis755
Date:
2020-06-16
Revision:
4:459a0389bb9f
Parent:
2:db40a2b0b177

File content as of revision 4:459a0389bb9f:

#include "Led.h"
#include "LCD_DISCO_F429ZI.h"

extern LCD_DISCO_F429ZI Lcd;

Led::Led(unsigned char ucColIdx, unsigned char ucRowIdx) {
    ucColumn = ucColIdx;
    ucRow = ucRowIdx;
    Lcd.SetTextColor(LCD_COLOR_GREEN);
    Lcd.DrawRect(80*ucColumn, 80*ucRow, 80, 80);
}

void Led::On(void) {
    Redraw(LCD_COLOR_YELLOW);
}

void Led::Off(void) {
    Redraw(LCD_COLOR_BLUE);
}

void Led::Redraw(uint32_t Color) {
    Lcd.SetBackColor(LCD_COLOR_RED);
    Lcd.SetTextColor(Color);
    Lcd.FillRect(1+ (ucColumn * 80), (ucRow*80 + 1), 79, 79);
    Lcd.SetTextColor(LCD_COLOR_WHITE);
    unsigned char ucAscii[2] = {48 + ucRow, 0};
    Lcd.DisplayStringAt((ucColumn * 80), (ucRow * 80), (uint8_t *)ucAscii, LEFT_MODE);       
}