
MTM PPO mbed2d-2 program
Dependencies: LCD_DISCO_F429ZI mbed TS_DISCO_F429ZI BSP_DISCO_F429ZI
Led.cpp@2:ce9137eb0655, 2020-06-22 (annotated)
- Committer:
- paweler
- Date:
- Mon Jun 22 14:15:01 2020 +0000
- Revision:
- 2:ce9137eb0655
ppo mbed
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
paweler | 2:ce9137eb0655 | 1 | #include "Led.h" |
paweler | 2:ce9137eb0655 | 2 | |
paweler | 2:ce9137eb0655 | 3 | extern LCD_DISCO_F429ZI lcd; |
paweler | 2:ce9137eb0655 | 4 | |
paweler | 2:ce9137eb0655 | 5 | Led::Led(unsigned char ucColumn, unsigned char ucRow){ |
paweler | 2:ce9137eb0655 | 6 | this->ucColumn = ucColumn; |
paweler | 2:ce9137eb0655 | 7 | this->ucRow = ucRow; |
paweler | 2:ce9137eb0655 | 8 | Off(); |
paweler | 2:ce9137eb0655 | 9 | } |
paweler | 2:ce9137eb0655 | 10 | |
paweler | 2:ce9137eb0655 | 11 | void Led::On(void){ |
paweler | 2:ce9137eb0655 | 12 | Redraw(LCD_COLOR_YELLOW); |
paweler | 2:ce9137eb0655 | 13 | } |
paweler | 2:ce9137eb0655 | 14 | |
paweler | 2:ce9137eb0655 | 15 | void Led::Off(void){ |
paweler | 2:ce9137eb0655 | 16 | Redraw(LCD_COLOR_BLUE); |
paweler | 2:ce9137eb0655 | 17 | } |
paweler | 2:ce9137eb0655 | 18 | |
paweler | 2:ce9137eb0655 | 19 | |
paweler | 2:ce9137eb0655 | 20 | void Led::Redraw(uint32_t Color){ |
paweler | 2:ce9137eb0655 | 21 | char pcLedNumber[1]; |
paweler | 2:ce9137eb0655 | 22 | lcd.SetTextColor(LCD_COLOR_GREEN); |
paweler | 2:ce9137eb0655 | 23 | lcd.DrawRect(ucColumn * 80, ucRow * 80, 80, 80); |
paweler | 2:ce9137eb0655 | 24 | lcd.SetTextColor(Color); |
paweler | 2:ce9137eb0655 | 25 | lcd.FillRect(1 + ucColumn * 80, 1 + ucRow * 80, 78, 78); |
paweler | 2:ce9137eb0655 | 26 | lcd.SetTextColor(LCD_COLOR_WHITE); |
paweler | 2:ce9137eb0655 | 27 | lcd.SetBackColor(LCD_COLOR_RED); |
paweler | 2:ce9137eb0655 | 28 | sprintf((char*)pcLedNumber, "%d", ucRow); |
paweler | 2:ce9137eb0655 | 29 | lcd.DisplayStringAt(ucColumn * 80, ucRow * 80, (uint8_t *)pcLedNumber, LEFT_MODE); |
paweler | 2:ce9137eb0655 | 30 | } |