Mbed cz.1 cwiczenie ostatnie (2d2)
Dependencies: LCD_DISCO_F429ZI mbed TS_DISCO_F429ZI BSP_DISCO_F429ZI
Led_Lcd.cpp@0:036c13c6cbb6, 2020-05-18 (annotated)
- Committer:
- dzialowy04
- Date:
- Mon May 18 05:54:39 2020 +0000
- Revision:
- 0:036c13c6cbb6
mbed cz.1 cwiczenie ostatnie (2d2)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dzialowy04 | 0:036c13c6cbb6 | 1 | #include "Led_Lcd.h" |
dzialowy04 | 0:036c13c6cbb6 | 2 | |
dzialowy04 | 0:036c13c6cbb6 | 3 | LedLcd::LedLcd(unsigned char ucColumnIndex){ |
dzialowy04 | 0:036c13c6cbb6 | 4 | |
dzialowy04 | 0:036c13c6cbb6 | 5 | ucLedPos = ucColumnIndex*80; |
dzialowy04 | 0:036c13c6cbb6 | 6 | lcd.Clear(LCD_COLOR_BLACK); |
dzialowy04 | 0:036c13c6cbb6 | 7 | BSP_LCD_SetFont(&Font24); |
dzialowy04 | 0:036c13c6cbb6 | 8 | lcd.SetBackColor(LCD_COLOR_RED); |
dzialowy04 | 0:036c13c6cbb6 | 9 | //lcd.SetTextColor(LCD_COLOR_GREEN); |
dzialowy04 | 0:036c13c6cbb6 | 10 | |
dzialowy04 | 0:036c13c6cbb6 | 11 | //for(unsigned char ucRectNumber = 0; ucRectNumber < 4; ucRectNumber++){ |
dzialowy04 | 0:036c13c6cbb6 | 12 | // lcd.DrawRect(ucLedPos, ucRectNumber*80, 80, 80); |
dzialowy04 | 0:036c13c6cbb6 | 13 | //} |
dzialowy04 | 0:036c13c6cbb6 | 14 | } |
dzialowy04 | 0:036c13c6cbb6 | 15 | |
dzialowy04 | 0:036c13c6cbb6 | 16 | void LedLcd::On(unsigned char ucLedIndex){ |
dzialowy04 | 0:036c13c6cbb6 | 17 | |
dzialowy04 | 0:036c13c6cbb6 | 18 | unsigned char ucKeyNumber[2]; |
dzialowy04 | 0:036c13c6cbb6 | 19 | |
dzialowy04 | 0:036c13c6cbb6 | 20 | for(unsigned char ucKeyCounter = 0; ucKeyCounter < 4; ucKeyCounter++){ |
dzialowy04 | 0:036c13c6cbb6 | 21 | if(ucLedIndex == ucKeyCounter){ |
dzialowy04 | 0:036c13c6cbb6 | 22 | lcd.SetTextColor(LCD_COLOR_YELLOW); |
dzialowy04 | 0:036c13c6cbb6 | 23 | } |
dzialowy04 | 0:036c13c6cbb6 | 24 | else{ |
dzialowy04 | 0:036c13c6cbb6 | 25 | lcd.SetTextColor(LCD_COLOR_BLUE); |
dzialowy04 | 0:036c13c6cbb6 | 26 | } |
dzialowy04 | 0:036c13c6cbb6 | 27 | lcd.FillRect(ucLedPos+1, ucKeyCounter*80 + 1, 79, 79); |
dzialowy04 | 0:036c13c6cbb6 | 28 | lcd.SetTextColor(LCD_COLOR_WHITE); |
dzialowy04 | 0:036c13c6cbb6 | 29 | sprintf((char*)ucKeyNumber, "%d", ucKeyCounter); |
dzialowy04 | 0:036c13c6cbb6 | 30 | lcd.DisplayStringAt(ucLedPos, ucKeyCounter*80, (uint8_t *) &ucKeyNumber, LEFT_MODE); |
dzialowy04 | 0:036c13c6cbb6 | 31 | lcd.SetTextColor(LCD_COLOR_GREEN); |
dzialowy04 | 0:036c13c6cbb6 | 32 | lcd.DrawRect(ucLedPos, ucKeyCounter*80, 80, 80); |
dzialowy04 | 0:036c13c6cbb6 | 33 | } |
dzialowy04 | 0:036c13c6cbb6 | 34 | } |