
Mbed1-StanislawMaciejewski
Dependencies: LCD_DISCO_F429ZI mbed TS_DISCO_F429ZI
Led_Lcd.cpp@0:6e3505b453da, 2020-05-18 (annotated)
- Committer:
- stanmac
- Date:
- Mon May 18 19:57:01 2020 +0000
- Revision:
- 0:6e3505b453da
Mbed1-StanislawMaciejewski
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
stanmac | 0:6e3505b453da | 1 | #include "Led_Lcd.h" |
stanmac | 0:6e3505b453da | 2 | |
stanmac | 0:6e3505b453da | 3 | #include "LCD_DISCO_F429ZI.h" |
stanmac | 0:6e3505b453da | 4 | LCD_DISCO_F429ZI lcd; |
stanmac | 0:6e3505b453da | 5 | |
stanmac | 0:6e3505b453da | 6 | LedLcd::LedLcd(unsigned char ucLedColumnIndex){ |
stanmac | 0:6e3505b453da | 7 | lcd.Clear(LCD_COLOR_BLACK); |
stanmac | 0:6e3505b453da | 8 | ucLedColumnPosition = ucLedColumnIndex*80; |
stanmac | 0:6e3505b453da | 9 | } |
stanmac | 0:6e3505b453da | 10 | |
stanmac | 0:6e3505b453da | 11 | void LedLcd::On(unsigned char ucLedIndex){ |
stanmac | 0:6e3505b453da | 12 | lcd.SetTextColor(LCD_COLOR_BLUE); |
stanmac | 0:6e3505b453da | 13 | lcd.FillRect(ucLedColumnPosition, 0, 80, 320); |
stanmac | 0:6e3505b453da | 14 | |
stanmac | 0:6e3505b453da | 15 | lcd.SetTextColor(LCD_COLOR_GREEN); |
stanmac | 0:6e3505b453da | 16 | |
stanmac | 0:6e3505b453da | 17 | switch(ucLedIndex){ |
stanmac | 0:6e3505b453da | 18 | case 0: |
stanmac | 0:6e3505b453da | 19 | lcd.FillRect(ucLedColumnPosition, 0, 80, 80); |
stanmac | 0:6e3505b453da | 20 | break; |
stanmac | 0:6e3505b453da | 21 | case 1: |
stanmac | 0:6e3505b453da | 22 | lcd.FillRect(ucLedColumnPosition, 80, 80, 80); |
stanmac | 0:6e3505b453da | 23 | break; |
stanmac | 0:6e3505b453da | 24 | case 2: |
stanmac | 0:6e3505b453da | 25 | lcd.FillRect(ucLedColumnPosition, 160, 80, 80); |
stanmac | 0:6e3505b453da | 26 | break; |
stanmac | 0:6e3505b453da | 27 | case 3: |
stanmac | 0:6e3505b453da | 28 | lcd.FillRect(ucLedColumnPosition, 240, 80, 80); |
stanmac | 0:6e3505b453da | 29 | break; |
stanmac | 0:6e3505b453da | 30 | default: |
stanmac | 0:6e3505b453da | 31 | break; |
stanmac | 0:6e3505b453da | 32 | } |
stanmac | 0:6e3505b453da | 33 | |
stanmac | 0:6e3505b453da | 34 | lcd.SetBackColor(LCD_COLOR_RED); |
stanmac | 0:6e3505b453da | 35 | lcd.SetTextColor(LCD_COLOR_WHITE); |
stanmac | 0:6e3505b453da | 36 | BSP_LCD_SetFont(&Font24); |
stanmac | 0:6e3505b453da | 37 | |
stanmac | 0:6e3505b453da | 38 | for(int i=0; i<4; i++){ |
stanmac | 0:6e3505b453da | 39 | char number_string [2] = {'0' + i, 0}; |
stanmac | 0:6e3505b453da | 40 | lcd.DisplayStringAt(ucLedColumnPosition, 80*i, (uint8_t *) number_string , LEFT_MODE); |
stanmac | 0:6e3505b453da | 41 | } |
stanmac | 0:6e3505b453da | 42 | |
stanmac | 0:6e3505b453da | 43 | lcd.SetTextColor(LCD_COLOR_GREEN); |
stanmac | 0:6e3505b453da | 44 | for(int green_frame_count=0; green_frame_count<4; green_frame_count++){ |
stanmac | 0:6e3505b453da | 45 | lcd.DrawRect(ucLedColumnPosition, green_frame_count*80, 80, 80); |
stanmac | 0:6e3505b453da | 46 | } |
stanmac | 0:6e3505b453da | 47 | } |