a

Dependencies:   LCD_DISCO_F429ZI mbed TS_DISCO_F429ZI BSP_DISCO_F429ZI

Committer:
wierzba100
Date:
Wed May 11 14:04:35 2022 +0000
Revision:
0:515a71b6fd11
a

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wierzba100 0:515a71b6fd11 1 #include "Led_Lcd.h"
wierzba100 0:515a71b6fd11 2
wierzba100 0:515a71b6fd11 3 LCD_DISCO_F429ZI lcd;
wierzba100 0:515a71b6fd11 4
wierzba100 0:515a71b6fd11 5 LedLcd::LedLcd(unsigned char ucButtonPos): ucButtonDisplayMode(ucButtonPos){}
wierzba100 0:515a71b6fd11 6
wierzba100 0:515a71b6fd11 7 void LedLcd::ButtonPlacement(unsigned int uiXpos, unsigned int uiYpos, unsigned int uiWidth,unsigned int uiHeight, uint8_t *pText,unsigned char ucPressed)
wierzba100 0:515a71b6fd11 8 {
wierzba100 0:515a71b6fd11 9 if(ucPressed == 1)
wierzba100 0:515a71b6fd11 10 {
wierzba100 0:515a71b6fd11 11 lcd.SetTextColor(LCD_COLOR_YELLOW);
wierzba100 0:515a71b6fd11 12 }else
wierzba100 0:515a71b6fd11 13 {
wierzba100 0:515a71b6fd11 14 lcd.SetTextColor(LCD_COLOR_BLUE);
wierzba100 0:515a71b6fd11 15 }
wierzba100 0:515a71b6fd11 16 lcd.FillRect(uiXpos, uiYpos, uiWidth, uiHeight);
wierzba100 0:515a71b6fd11 17 lcd.SetTextColor(LCD_COLOR_GREEN);
wierzba100 0:515a71b6fd11 18 lcd.DrawRect(uiXpos, uiYpos, uiWidth, uiHeight);
wierzba100 0:515a71b6fd11 19 lcd.SetTextColor(LCD_COLOR_WHITE);
wierzba100 0:515a71b6fd11 20 lcd.SetBackColor(LCD_COLOR_RED);
wierzba100 0:515a71b6fd11 21 lcd.DisplayStringAt(uiXpos, uiYpos, pText , LEFT_MODE);
wierzba100 0:515a71b6fd11 22 }
wierzba100 0:515a71b6fd11 23
wierzba100 0:515a71b6fd11 24 void LedLcd::On(unsigned char ucLedNr)
wierzba100 0:515a71b6fd11 25 {
wierzba100 0:515a71b6fd11 26 lcd.Clear(LCD_COLOR_BLACK);
wierzba100 0:515a71b6fd11 27 lcd.SetBackColor(LCD_COLOR_BLACK);
wierzba100 0:515a71b6fd11 28 switch(ucButtonDisplayMode)
wierzba100 0:515a71b6fd11 29 {
wierzba100 0:515a71b6fd11 30 case 0:
wierzba100 0:515a71b6fd11 31 switch(ucLedNr)
wierzba100 0:515a71b6fd11 32 {
wierzba100 0:515a71b6fd11 33 case 0:
wierzba100 0:515a71b6fd11 34 //Button 1
wierzba100 0:515a71b6fd11 35 ButtonPlacement(0,0,79,79,(uint8_t *)"1", 1);
wierzba100 0:515a71b6fd11 36 //Button 2
wierzba100 0:515a71b6fd11 37 ButtonPlacement(0,80,79,79,(uint8_t *)"2", 0);
wierzba100 0:515a71b6fd11 38 //button 3
wierzba100 0:515a71b6fd11 39 ButtonPlacement(0,160,79,79,(uint8_t *)"3", 0);
wierzba100 0:515a71b6fd11 40 //button 4
wierzba100 0:515a71b6fd11 41 ButtonPlacement(0,240,79,79,(uint8_t *)"4", 0);
wierzba100 0:515a71b6fd11 42 break;
wierzba100 0:515a71b6fd11 43 case 1:
wierzba100 0:515a71b6fd11 44 //Button 1
wierzba100 0:515a71b6fd11 45 ButtonPlacement(0,0,79,79,(uint8_t *)"1", 0);
wierzba100 0:515a71b6fd11 46 //Button 2
wierzba100 0:515a71b6fd11 47 ButtonPlacement(0,80,79,79,(uint8_t *)"2", 1);
wierzba100 0:515a71b6fd11 48 //button 3
wierzba100 0:515a71b6fd11 49 ButtonPlacement(0,160,79,79,(uint8_t *)"3", 0);
wierzba100 0:515a71b6fd11 50 //button 4
wierzba100 0:515a71b6fd11 51 ButtonPlacement(0,240,79,79,(uint8_t *)"4", 0);
wierzba100 0:515a71b6fd11 52 break;
wierzba100 0:515a71b6fd11 53 case 2:
wierzba100 0:515a71b6fd11 54 //Button 1
wierzba100 0:515a71b6fd11 55 ButtonPlacement(0,0,79,79,(uint8_t *)"1", 0);
wierzba100 0:515a71b6fd11 56 //Button 2
wierzba100 0:515a71b6fd11 57 ButtonPlacement(0,80,79,79,(uint8_t *)"2", 0);
wierzba100 0:515a71b6fd11 58 //button 3
wierzba100 0:515a71b6fd11 59 ButtonPlacement(0,160,79,79,(uint8_t *)"3", 1);
wierzba100 0:515a71b6fd11 60 //button 4
wierzba100 0:515a71b6fd11 61 ButtonPlacement(0,240,79,79,(uint8_t *)"4", 0);
wierzba100 0:515a71b6fd11 62 break;
wierzba100 0:515a71b6fd11 63 case 3:
wierzba100 0:515a71b6fd11 64 //Button 1
wierzba100 0:515a71b6fd11 65 ButtonPlacement(0,0,79,79,(uint8_t *)"1", 0);
wierzba100 0:515a71b6fd11 66 //Button 2
wierzba100 0:515a71b6fd11 67 ButtonPlacement(0,80,79,79,(uint8_t *)"2", 0);
wierzba100 0:515a71b6fd11 68 //button 3
wierzba100 0:515a71b6fd11 69 ButtonPlacement(0,160,79,79,(uint8_t *)"3", 0);
wierzba100 0:515a71b6fd11 70 //button 4
wierzba100 0:515a71b6fd11 71 ButtonPlacement(0,240,79,79,(uint8_t *)"4", 1);
wierzba100 0:515a71b6fd11 72 break;
wierzba100 0:515a71b6fd11 73 default:
wierzba100 0:515a71b6fd11 74 //Button 1
wierzba100 0:515a71b6fd11 75 ButtonPlacement(0,0,79,79,(uint8_t *)"1", 0);
wierzba100 0:515a71b6fd11 76 //Button 2
wierzba100 0:515a71b6fd11 77 ButtonPlacement(0,80,79,79,(uint8_t *)"2", 0);
wierzba100 0:515a71b6fd11 78 //button 3
wierzba100 0:515a71b6fd11 79 ButtonPlacement(0,160,79,79,(uint8_t *)"3", 0);
wierzba100 0:515a71b6fd11 80 //button 4
wierzba100 0:515a71b6fd11 81 ButtonPlacement(0,240,79,79,(uint8_t *)"4", 0);
wierzba100 0:515a71b6fd11 82 break;
wierzba100 0:515a71b6fd11 83 }
wierzba100 0:515a71b6fd11 84 break;
wierzba100 0:515a71b6fd11 85 case 1:
wierzba100 0:515a71b6fd11 86 switch(ucLedNr)
wierzba100 0:515a71b6fd11 87 {
wierzba100 0:515a71b6fd11 88 case 0:
wierzba100 0:515a71b6fd11 89 //Button 1
wierzba100 0:515a71b6fd11 90 ButtonPlacement(80,0,79,79,(uint8_t *)"1", 1);
wierzba100 0:515a71b6fd11 91 //Button 2
wierzba100 0:515a71b6fd11 92 ButtonPlacement(80,80,79,79,(uint8_t *)"2", 0);
wierzba100 0:515a71b6fd11 93 //button 3
wierzba100 0:515a71b6fd11 94 ButtonPlacement(80,160,79,79,(uint8_t *)"3", 0);
wierzba100 0:515a71b6fd11 95 //button 4
wierzba100 0:515a71b6fd11 96 ButtonPlacement(80,240,79,79,(uint8_t *)"4", 0);
wierzba100 0:515a71b6fd11 97 break;
wierzba100 0:515a71b6fd11 98 case 1:
wierzba100 0:515a71b6fd11 99 //Button 1
wierzba100 0:515a71b6fd11 100 ButtonPlacement(80,0,79,79,(uint8_t *)"1", 0);
wierzba100 0:515a71b6fd11 101 //Button 2
wierzba100 0:515a71b6fd11 102 ButtonPlacement(80,80,79,79,(uint8_t *)"2", 1);
wierzba100 0:515a71b6fd11 103 //button 3
wierzba100 0:515a71b6fd11 104 ButtonPlacement(80,160,79,79,(uint8_t *)"3", 0);
wierzba100 0:515a71b6fd11 105 //button 4
wierzba100 0:515a71b6fd11 106 ButtonPlacement(80,240,79,79,(uint8_t *)"4", 0);
wierzba100 0:515a71b6fd11 107 break;
wierzba100 0:515a71b6fd11 108 case 2:
wierzba100 0:515a71b6fd11 109 //Button 1
wierzba100 0:515a71b6fd11 110 ButtonPlacement(80,0,79,79,(uint8_t *)"1", 0);
wierzba100 0:515a71b6fd11 111 //Button 2
wierzba100 0:515a71b6fd11 112 ButtonPlacement(80,80,79,79,(uint8_t *)"2", 0);
wierzba100 0:515a71b6fd11 113 //button 3
wierzba100 0:515a71b6fd11 114 ButtonPlacement(80,160,79,79,(uint8_t *)"3", 1);
wierzba100 0:515a71b6fd11 115 //button 4
wierzba100 0:515a71b6fd11 116 ButtonPlacement(80,240,79,79,(uint8_t *)"4", 0);
wierzba100 0:515a71b6fd11 117 break;
wierzba100 0:515a71b6fd11 118 case 3:
wierzba100 0:515a71b6fd11 119 //Button 1
wierzba100 0:515a71b6fd11 120 ButtonPlacement(80,0,79,79,(uint8_t *)"1", 0);
wierzba100 0:515a71b6fd11 121 //Button 2
wierzba100 0:515a71b6fd11 122 ButtonPlacement(80,80,79,79,(uint8_t *)"2", 0);
wierzba100 0:515a71b6fd11 123 //button 3
wierzba100 0:515a71b6fd11 124 ButtonPlacement(80,160,79,79,(uint8_t *)"3", 0);
wierzba100 0:515a71b6fd11 125 //button 4
wierzba100 0:515a71b6fd11 126 ButtonPlacement(80,240,79,79,(uint8_t *)"4", 1);
wierzba100 0:515a71b6fd11 127 break;
wierzba100 0:515a71b6fd11 128 default:
wierzba100 0:515a71b6fd11 129 //Button 0
wierzba100 0:515a71b6fd11 130 ButtonPlacement(80,0,79,79,(uint8_t *)"1", 0);
wierzba100 0:515a71b6fd11 131 //Button 1
wierzba100 0:515a71b6fd11 132 ButtonPlacement(80,80,79,79,(uint8_t *)"2", 0);
wierzba100 0:515a71b6fd11 133 //button 3
wierzba100 0:515a71b6fd11 134 ButtonPlacement(80,160,79,79,(uint8_t *)"3", 0);
wierzba100 0:515a71b6fd11 135 //button 4
wierzba100 0:515a71b6fd11 136 ButtonPlacement(80,240,79,79,(uint8_t *)"4", 0);
wierzba100 0:515a71b6fd11 137 break;
wierzba100 0:515a71b6fd11 138 }
wierzba100 0:515a71b6fd11 139 break;
wierzba100 0:515a71b6fd11 140 default:
wierzba100 0:515a71b6fd11 141 switch(ucLedNr)
wierzba100 0:515a71b6fd11 142 {
wierzba100 0:515a71b6fd11 143 case 0:
wierzba100 0:515a71b6fd11 144 //Button 0
wierzba100 0:515a71b6fd11 145 ButtonPlacement(160,0,79,79,(uint8_t *)"1", 1);
wierzba100 0:515a71b6fd11 146 //Button 1
wierzba100 0:515a71b6fd11 147 ButtonPlacement(160,80,79,79,(uint8_t *)"2", 0);
wierzba100 0:515a71b6fd11 148 //button 3
wierzba100 0:515a71b6fd11 149 ButtonPlacement(160,160,79,79,(uint8_t *)"3", 0);
wierzba100 0:515a71b6fd11 150 //button 4
wierzba100 0:515a71b6fd11 151 ButtonPlacement(160,240,79,79,(uint8_t *)"4", 0);
wierzba100 0:515a71b6fd11 152 break;
wierzba100 0:515a71b6fd11 153 case 1:
wierzba100 0:515a71b6fd11 154 //Button 0
wierzba100 0:515a71b6fd11 155 ButtonPlacement(160,0,79,79,(uint8_t *)"1", 0);
wierzba100 0:515a71b6fd11 156 //Button 1
wierzba100 0:515a71b6fd11 157 ButtonPlacement(160,80,79,79,(uint8_t *)"2", 1);
wierzba100 0:515a71b6fd11 158 //button 3
wierzba100 0:515a71b6fd11 159 ButtonPlacement(160,160,79,79,(uint8_t *)"3", 0);
wierzba100 0:515a71b6fd11 160 //button 4
wierzba100 0:515a71b6fd11 161 ButtonPlacement(160,240,79,79,(uint8_t *)"4", 0);
wierzba100 0:515a71b6fd11 162 break;
wierzba100 0:515a71b6fd11 163 case 2:
wierzba100 0:515a71b6fd11 164 //Button 0
wierzba100 0:515a71b6fd11 165 ButtonPlacement(160,0,79,79,(uint8_t *)"1", 0);
wierzba100 0:515a71b6fd11 166 //Button 1
wierzba100 0:515a71b6fd11 167 ButtonPlacement(160,80,79,79,(uint8_t *)"2", 0);
wierzba100 0:515a71b6fd11 168 //button 3
wierzba100 0:515a71b6fd11 169 ButtonPlacement(160,160,79,79,(uint8_t *)"3", 1);
wierzba100 0:515a71b6fd11 170 //button 4
wierzba100 0:515a71b6fd11 171 ButtonPlacement(160,240,79,79,(uint8_t *)"4", 0);
wierzba100 0:515a71b6fd11 172 break;
wierzba100 0:515a71b6fd11 173 case 3:
wierzba100 0:515a71b6fd11 174 //Button 0
wierzba100 0:515a71b6fd11 175 ButtonPlacement(160,0,79,79,(uint8_t *)"1", 0);
wierzba100 0:515a71b6fd11 176 //Button 1
wierzba100 0:515a71b6fd11 177 ButtonPlacement(160,80,79,79,(uint8_t *)"2", 0);
wierzba100 0:515a71b6fd11 178 //button 3
wierzba100 0:515a71b6fd11 179 ButtonPlacement(160,160,79,79,(uint8_t *)"3", 0);
wierzba100 0:515a71b6fd11 180 //button 4
wierzba100 0:515a71b6fd11 181 ButtonPlacement(160,240,79,79,(uint8_t *)"4", 1);
wierzba100 0:515a71b6fd11 182 break;
wierzba100 0:515a71b6fd11 183 default:
wierzba100 0:515a71b6fd11 184 //Button 0
wierzba100 0:515a71b6fd11 185 ButtonPlacement(160,0,79,79,(uint8_t *)"1", 0);
wierzba100 0:515a71b6fd11 186 //Button 1
wierzba100 0:515a71b6fd11 187 ButtonPlacement(160,80,79,79,(uint8_t *)"2", 0);
wierzba100 0:515a71b6fd11 188 //button 3
wierzba100 0:515a71b6fd11 189 ButtonPlacement(160,160,79,79,(uint8_t *)"3", 0);
wierzba100 0:515a71b6fd11 190 //button 4
wierzba100 0:515a71b6fd11 191 ButtonPlacement(160,240,79,79,(uint8_t *)"4", 0);
wierzba100 0:515a71b6fd11 192 break;
wierzba100 0:515a71b6fd11 193 }
wierzba100 0:515a71b6fd11 194 break;
wierzba100 0:515a71b6fd11 195
wierzba100 0:515a71b6fd11 196 }
wierzba100 0:515a71b6fd11 197
wierzba100 0:515a71b6fd11 198
wierzba100 0:515a71b6fd11 199
wierzba100 0:515a71b6fd11 200 }