Kacper Gaweda / Mbed 2 deprecated 2a

Dependencies:   LCD_DISCO_F429ZI mbed TS_DISCO_F429ZI BSP_DISCO_F429ZI

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers LedLcd.cpp Source File

LedLcd.cpp

00001 #include "LedLcd.h"
00002 #include "LCD_DISCO_F429ZI.h"
00003 
00004 LCD_DISCO_F429ZI lcd;
00005 
00006 
00007 LedLcd::LedLcd(uint8_t iColumnNumberConstructor){
00008     iColumnNumber = iColumnNumberConstructor;
00009     LcdInit();
00010 }
00011 
00012 
00013 void LedLcd::DrawKey(uint16_t iXPosKey, uint16_t iyPosKey, uint8_t iKeyNumber, uint32_t iColor){
00014     uint8_t iKeyNumberArray[1];
00015     lcd.SetFont(&Font24);
00016     lcd.SetTextColor(iColor);
00017     lcd.FillRect(iXPosKey, iyPosKey, 80, 80);
00018     lcd.SetTextColor(LCD_COLOR_GREEN);
00019     lcd.DrawRect(iXPosKey, iyPosKey, 80, 80);
00020     lcd.SetBackColor(LCD_COLOR_RED);
00021     lcd.SetTextColor(LCD_COLOR_WHITE);
00022     sprintf((char*)iKeyNumberArray, "%d", iKeyNumber);
00023     lcd.DisplayStringAt(iXPosKey, iyPosKey, (uint8_t *) &iKeyNumberArray , LEFT_MODE);
00024 
00025         
00026 }
00027     
00028 void LedLcd::On(uint8_t iKeyIndex){
00029     uint8_t iKeyCounter;
00030 
00031     for(iKeyCounter = 0; iKeyCounter <= 3; iKeyCounter++){
00032        if(iKeyIndex == iKeyCounter){
00033             DrawKey(iColumnNumber*80, iKeyCounter*80, iKeyCounter, LCD_COLOR_GREEN); 
00034        }
00035        else{
00036             DrawKey(iColumnNumber*80, iKeyCounter*80 , iKeyCounter, LCD_COLOR_BLUE);
00037        }
00038     }        
00039 }
00040 /*
00041 void LedLcd::TouchScreenInit(){
00042     uint8_t status;
00043     BSP_LCD_SetFont(&Font20);
00044     status = ts.Init(lcd.GetXSize(), lcd.GetYSize());
00045   
00046     if (status != TS_OK)
00047     {
00048       lcd.Clear(LCD_COLOR_RED);
00049       lcd.SetBackColor(LCD_COLOR_RED);
00050       lcd.SetTextColor(LCD_COLOR_WHITE);
00051       lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN", CENTER_MODE);
00052       lcd.DisplayStringAt(0, LINE(6), (uint8_t *)"INIT FAIL", CENTER_MODE);
00053     }
00054     else
00055     {
00056       lcd.Clear(LCD_COLOR_GREEN);
00057       lcd.SetBackColor(LCD_COLOR_GREEN);
00058       lcd.SetTextColor(LCD_COLOR_WHITE);
00059       lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN", CENTER_MODE);
00060       lcd.DisplayStringAt(0, LINE(6), (uint8_t *)"INIT OK", CENTER_MODE);
00061     }
00062 }
00063 */
00064 
00065 void LedLcd::LcdInit(void){
00066     lcd.Clear(LCD_COLOR_BLACK);
00067     lcd.SetBackColor(LCD_COLOR_BLACK);
00068 }
00069 
00070 
00071