Aa

Dependents:   EMBEED_III_zad_4 mbed3 mbed_3 MBED3_zad4

LED/Led.cpp

Committer:
krzysiek99
Date:
2020-06-13
Revision:
1:036ba0fc54a5

File content as of revision 1:036ba0fc54a5:

#include "Led.h"

extern LCD_DISCO_F429ZI lcd;

Led::Led(unsigned char ucColumn, unsigned char ucRow)
{
    this->ucColumn = ucColumn;
    this->ucRow = ucRow;
}
void Led::Redraw(uint32_t Color)
{
    char cLedNumber[2] = {'0' + ucRow};
    char *pLedNumber = cLedNumber;  
    lcd.SetTextColor(Color);
    lcd.FillRect(80*ucColumn+1, 80*ucRow+1, 78, 78);   
    lcd.SetTextColor(LCD_COLOR_GREEN);
    lcd.DrawRect(80*ucColumn, 80*ucRow, 80, 80); 
    lcd.SetTextColor(LCD_COLOR_WHITE);
    lcd.DisplayStringAt(80*ucColumn+1, 80*ucRow, (uint8_t *)pLedNumber, LEFT_MODE);     
}

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

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