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