
a
Dependencies: LCD_DISCO_F429ZI mbed TS_DISCO_F429ZI BSP_DISCO_F429ZI
Diff: Led_Lcd.cpp
- Revision:
- 0:515a71b6fd11
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Led_Lcd.cpp Wed May 11 14:04:35 2022 +0000 @@ -0,0 +1,200 @@ +#include "Led_Lcd.h" + +LCD_DISCO_F429ZI lcd; + +LedLcd::LedLcd(unsigned char ucButtonPos): ucButtonDisplayMode(ucButtonPos){} + +void LedLcd::ButtonPlacement(unsigned int uiXpos, unsigned int uiYpos, unsigned int uiWidth,unsigned int uiHeight, uint8_t *pText,unsigned char ucPressed) +{ + if(ucPressed == 1) + { + lcd.SetTextColor(LCD_COLOR_YELLOW); + }else + { + lcd.SetTextColor(LCD_COLOR_BLUE); + } + lcd.FillRect(uiXpos, uiYpos, uiWidth, uiHeight); + lcd.SetTextColor(LCD_COLOR_GREEN); + lcd.DrawRect(uiXpos, uiYpos, uiWidth, uiHeight); + lcd.SetTextColor(LCD_COLOR_WHITE); + lcd.SetBackColor(LCD_COLOR_RED); + lcd.DisplayStringAt(uiXpos, uiYpos, pText , LEFT_MODE); +} + +void LedLcd::On(unsigned char ucLedNr) +{ + lcd.Clear(LCD_COLOR_BLACK); + lcd.SetBackColor(LCD_COLOR_BLACK); + switch(ucButtonDisplayMode) + { + case 0: + switch(ucLedNr) + { + case 0: + //Button 1 + ButtonPlacement(0,0,79,79,(uint8_t *)"1", 1); + //Button 2 + ButtonPlacement(0,80,79,79,(uint8_t *)"2", 0); + //button 3 + ButtonPlacement(0,160,79,79,(uint8_t *)"3", 0); + //button 4 + ButtonPlacement(0,240,79,79,(uint8_t *)"4", 0); + break; + case 1: + //Button 1 + ButtonPlacement(0,0,79,79,(uint8_t *)"1", 0); + //Button 2 + ButtonPlacement(0,80,79,79,(uint8_t *)"2", 1); + //button 3 + ButtonPlacement(0,160,79,79,(uint8_t *)"3", 0); + //button 4 + ButtonPlacement(0,240,79,79,(uint8_t *)"4", 0); + break; + case 2: + //Button 1 + ButtonPlacement(0,0,79,79,(uint8_t *)"1", 0); + //Button 2 + ButtonPlacement(0,80,79,79,(uint8_t *)"2", 0); + //button 3 + ButtonPlacement(0,160,79,79,(uint8_t *)"3", 1); + //button 4 + ButtonPlacement(0,240,79,79,(uint8_t *)"4", 0); + break; + case 3: + //Button 1 + ButtonPlacement(0,0,79,79,(uint8_t *)"1", 0); + //Button 2 + ButtonPlacement(0,80,79,79,(uint8_t *)"2", 0); + //button 3 + ButtonPlacement(0,160,79,79,(uint8_t *)"3", 0); + //button 4 + ButtonPlacement(0,240,79,79,(uint8_t *)"4", 1); + break; + default: + //Button 1 + ButtonPlacement(0,0,79,79,(uint8_t *)"1", 0); + //Button 2 + ButtonPlacement(0,80,79,79,(uint8_t *)"2", 0); + //button 3 + ButtonPlacement(0,160,79,79,(uint8_t *)"3", 0); + //button 4 + ButtonPlacement(0,240,79,79,(uint8_t *)"4", 0); + break; + } + break; + case 1: + switch(ucLedNr) + { + case 0: + //Button 1 + ButtonPlacement(80,0,79,79,(uint8_t *)"1", 1); + //Button 2 + ButtonPlacement(80,80,79,79,(uint8_t *)"2", 0); + //button 3 + ButtonPlacement(80,160,79,79,(uint8_t *)"3", 0); + //button 4 + ButtonPlacement(80,240,79,79,(uint8_t *)"4", 0); + break; + case 1: + //Button 1 + ButtonPlacement(80,0,79,79,(uint8_t *)"1", 0); + //Button 2 + ButtonPlacement(80,80,79,79,(uint8_t *)"2", 1); + //button 3 + ButtonPlacement(80,160,79,79,(uint8_t *)"3", 0); + //button 4 + ButtonPlacement(80,240,79,79,(uint8_t *)"4", 0); + break; + case 2: + //Button 1 + ButtonPlacement(80,0,79,79,(uint8_t *)"1", 0); + //Button 2 + ButtonPlacement(80,80,79,79,(uint8_t *)"2", 0); + //button 3 + ButtonPlacement(80,160,79,79,(uint8_t *)"3", 1); + //button 4 + ButtonPlacement(80,240,79,79,(uint8_t *)"4", 0); + break; + case 3: + //Button 1 + ButtonPlacement(80,0,79,79,(uint8_t *)"1", 0); + //Button 2 + ButtonPlacement(80,80,79,79,(uint8_t *)"2", 0); + //button 3 + ButtonPlacement(80,160,79,79,(uint8_t *)"3", 0); + //button 4 + ButtonPlacement(80,240,79,79,(uint8_t *)"4", 1); + break; + default: + //Button 0 + ButtonPlacement(80,0,79,79,(uint8_t *)"1", 0); + //Button 1 + ButtonPlacement(80,80,79,79,(uint8_t *)"2", 0); + //button 3 + ButtonPlacement(80,160,79,79,(uint8_t *)"3", 0); + //button 4 + ButtonPlacement(80,240,79,79,(uint8_t *)"4", 0); + break; + } + break; + default: + switch(ucLedNr) + { + case 0: + //Button 0 + ButtonPlacement(160,0,79,79,(uint8_t *)"1", 1); + //Button 1 + ButtonPlacement(160,80,79,79,(uint8_t *)"2", 0); + //button 3 + ButtonPlacement(160,160,79,79,(uint8_t *)"3", 0); + //button 4 + ButtonPlacement(160,240,79,79,(uint8_t *)"4", 0); + break; + case 1: + //Button 0 + ButtonPlacement(160,0,79,79,(uint8_t *)"1", 0); + //Button 1 + ButtonPlacement(160,80,79,79,(uint8_t *)"2", 1); + //button 3 + ButtonPlacement(160,160,79,79,(uint8_t *)"3", 0); + //button 4 + ButtonPlacement(160,240,79,79,(uint8_t *)"4", 0); + break; + case 2: + //Button 0 + ButtonPlacement(160,0,79,79,(uint8_t *)"1", 0); + //Button 1 + ButtonPlacement(160,80,79,79,(uint8_t *)"2", 0); + //button 3 + ButtonPlacement(160,160,79,79,(uint8_t *)"3", 1); + //button 4 + ButtonPlacement(160,240,79,79,(uint8_t *)"4", 0); + break; + case 3: + //Button 0 + ButtonPlacement(160,0,79,79,(uint8_t *)"1", 0); + //Button 1 + ButtonPlacement(160,80,79,79,(uint8_t *)"2", 0); + //button 3 + ButtonPlacement(160,160,79,79,(uint8_t *)"3", 0); + //button 4 + ButtonPlacement(160,240,79,79,(uint8_t *)"4", 1); + break; + default: + //Button 0 + ButtonPlacement(160,0,79,79,(uint8_t *)"1", 0); + //Button 1 + ButtonPlacement(160,80,79,79,(uint8_t *)"2", 0); + //button 3 + ButtonPlacement(160,160,79,79,(uint8_t *)"3", 0); + //button 4 + ButtonPlacement(160,240,79,79,(uint8_t *)"4", 0); + break; + } + break; + + } + + + +}