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