Basic example showing how to drive the LCD.
Dependencies: BSP_DISCO_F429ZI LCD_DISCO_F429ZI mbed
main.cpp@3:e4d4cf43a2ca, 2017-07-04 (annotated)
- Committer:
- jeromecoutant
- Date:
- Tue Jul 04 15:45:36 2017 +0000
- Revision:
- 3:e4d4cf43a2ca
- Parent:
- 0:d4dacd8a359b
Update with MBED rev145
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bcostm | 0:d4dacd8a359b | 1 | #include "mbed.h" |
bcostm | 0:d4dacd8a359b | 2 | #include "LCD_DISCO_F429ZI.h" |
bcostm | 0:d4dacd8a359b | 3 | |
bcostm | 0:d4dacd8a359b | 4 | LCD_DISCO_F429ZI lcd; |
bcostm | 0:d4dacd8a359b | 5 | |
bcostm | 0:d4dacd8a359b | 6 | DigitalOut led1(LED1); |
bcostm | 0:d4dacd8a359b | 7 | |
bcostm | 0:d4dacd8a359b | 8 | int main() |
bcostm | 0:d4dacd8a359b | 9 | { |
bcostm | 0:d4dacd8a359b | 10 | led1 = 1; |
bcostm | 0:d4dacd8a359b | 11 | |
bcostm | 0:d4dacd8a359b | 12 | BSP_LCD_SetFont(&Font20); |
bcostm | 0:d4dacd8a359b | 13 | lcd.DisplayStringAt(0, LINE(1), (uint8_t *)"MBED EXAMPLE", CENTER_MODE); |
bcostm | 0:d4dacd8a359b | 14 | wait(1); |
bcostm | 0:d4dacd8a359b | 15 | |
bcostm | 0:d4dacd8a359b | 16 | while(1) |
bcostm | 0:d4dacd8a359b | 17 | { |
bcostm | 0:d4dacd8a359b | 18 | lcd.Clear(LCD_COLOR_BLUE); |
bcostm | 0:d4dacd8a359b | 19 | lcd.SetBackColor(LCD_COLOR_BLUE); |
bcostm | 0:d4dacd8a359b | 20 | lcd.SetTextColor(LCD_COLOR_WHITE); |
bcostm | 0:d4dacd8a359b | 21 | wait(0.3); |
bcostm | 0:d4dacd8a359b | 22 | lcd.DisplayStringAt(0, LINE(4), (uint8_t *)"DISCOVERY", CENTER_MODE); |
bcostm | 0:d4dacd8a359b | 23 | lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"STM32F429ZI", CENTER_MODE); |
bcostm | 0:d4dacd8a359b | 24 | wait(1); |
bcostm | 0:d4dacd8a359b | 25 | |
bcostm | 0:d4dacd8a359b | 26 | lcd.Clear(LCD_COLOR_GREEN); |
bcostm | 0:d4dacd8a359b | 27 | |
bcostm | 0:d4dacd8a359b | 28 | lcd.SetTextColor(LCD_COLOR_BLUE); |
bcostm | 0:d4dacd8a359b | 29 | lcd.FillRect(10, 20, 50, 50); |
bcostm | 0:d4dacd8a359b | 30 | wait(0.1); |
bcostm | 0:d4dacd8a359b | 31 | lcd.SetTextColor(LCD_COLOR_BROWN); |
bcostm | 0:d4dacd8a359b | 32 | lcd.FillCircle(80, 80, 50); |
bcostm | 0:d4dacd8a359b | 33 | wait(0.1); |
bcostm | 0:d4dacd8a359b | 34 | lcd.SetTextColor(LCD_COLOR_YELLOW); |
bcostm | 0:d4dacd8a359b | 35 | lcd.FillEllipse(150, 150, 50, 100); |
bcostm | 0:d4dacd8a359b | 36 | wait(0.1); |
bcostm | 0:d4dacd8a359b | 37 | lcd.SetTextColor(LCD_COLOR_RED); |
bcostm | 0:d4dacd8a359b | 38 | lcd.FillCircle(200, 200, 40); |
bcostm | 0:d4dacd8a359b | 39 | wait(1); |
bcostm | 0:d4dacd8a359b | 40 | |
bcostm | 0:d4dacd8a359b | 41 | lcd.SetBackColor(LCD_COLOR_ORANGE); |
bcostm | 0:d4dacd8a359b | 42 | lcd.SetTextColor(LCD_COLOR_CYAN); |
bcostm | 0:d4dacd8a359b | 43 | BSP_LCD_SetFont(&Font24); |
bcostm | 0:d4dacd8a359b | 44 | lcd.DisplayStringAt(0, LINE(7), (uint8_t *)"HAVE FUN !!!", CENTER_MODE); |
bcostm | 0:d4dacd8a359b | 45 | wait(1); |
bcostm | 0:d4dacd8a359b | 46 | |
bcostm | 0:d4dacd8a359b | 47 | led1 = !led1; |
bcostm | 0:d4dacd8a359b | 48 | wait(0.5); |
bcostm | 0:d4dacd8a359b | 49 | } |
bcostm | 0:d4dacd8a359b | 50 | } |
bcostm | 0:d4dacd8a359b | 51 |