AGH MTM PPO MBED
Dependencies: LCD_DISCO_F429ZI mbed TS_DISCO_F429ZI BSP_DISCO_F429ZI
Led_Lcd.cpp@1:36b3fd4a01fd, 2020-05-09 (annotated)
- Committer:
- matis755
- Date:
- Sat May 09 08:31:59 2020 +0000
- Revision:
- 1:36b3fd4a01fd
- Parent:
- 0:f4a48c08fea7
Add second column on display
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
matis755 | 0:f4a48c08fea7 | 1 | #include "Led_Lcd.h" |
matis755 | 0:f4a48c08fea7 | 2 | |
matis755 | 0:f4a48c08fea7 | 3 | LedLcd::LedLcd(unsigned char ucIdx) { |
matis755 | 0:f4a48c08fea7 | 4 | ucColIdx = ucIdx; |
matis755 | 0:f4a48c08fea7 | 5 | SetFont(&Font24); |
matis755 | 0:f4a48c08fea7 | 6 | Clear(LCD_COLOR_BLACK); |
matis755 | 0:f4a48c08fea7 | 7 | SetTextColor(LCD_COLOR_GREEN); |
matis755 | 0:f4a48c08fea7 | 8 | for(unsigned char I = 0; I < 4; I++) { |
matis755 | 0:f4a48c08fea7 | 9 | DrawRect(80*ucColIdx, 80*I, 80, 80); |
matis755 | 0:f4a48c08fea7 | 10 | } |
matis755 | 0:f4a48c08fea7 | 11 | } |
matis755 | 0:f4a48c08fea7 | 12 | |
matis755 | 0:f4a48c08fea7 | 13 | void LedLcd::On(unsigned char ucIdx) { |
matis755 | 0:f4a48c08fea7 | 14 | SetBackColor(LCD_COLOR_RED); |
matis755 | 0:f4a48c08fea7 | 15 | for(unsigned char I = 0; I < 4; I++) { |
matis755 | 0:f4a48c08fea7 | 16 | if(I == ucIdx) { |
matis755 | 0:f4a48c08fea7 | 17 | SetTextColor(LCD_COLOR_GREEN); |
matis755 | 0:f4a48c08fea7 | 18 | } |
matis755 | 0:f4a48c08fea7 | 19 | else { |
matis755 | 0:f4a48c08fea7 | 20 | SetTextColor(LCD_COLOR_BLUE); |
matis755 | 0:f4a48c08fea7 | 21 | } |
matis755 | 0:f4a48c08fea7 | 22 | FillRect(1+ (ucColIdx * 80), (I*80 + 1), 79, 79); |
matis755 | 0:f4a48c08fea7 | 23 | SetTextColor(LCD_COLOR_WHITE); |
matis755 | 0:f4a48c08fea7 | 24 | unsigned char ucAscii[2] = {48 + I, 0}; |
matis755 | 0:f4a48c08fea7 | 25 | DisplayStringAt((ucColIdx * 80), (I * 80), (uint8_t *)ucAscii, LEFT_MODE); |
matis755 | 0:f4a48c08fea7 | 26 | } |
matis755 | 0:f4a48c08fea7 | 27 | } |