Demo to control 4 LEDs
Dependencies: BSP_DISCO_F469NI mbed
main.cpp@1:a6d179a9ffbb, 2017-10-31 (annotated)
- Committer:
- Faberge
- Date:
- Tue Oct 31 14:39:54 2017 +0000
- Revision:
- 1:a6d179a9ffbb
- Parent:
- 0:e06404fdff2f
- Child:
- 2:e6fc24fbd86c
Update
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Faberge | 0:e06404fdff2f | 1 | /* |
Faberge | 0:e06404fdff2f | 2 | * main.cpp |
Faberge | 0:e06404fdff2f | 3 | * |
Faberge | 0:e06404fdff2f | 4 | * Copyright 2017 Faberge@TsarTeam |
Faberge | 0:e06404fdff2f | 5 | * |
Faberge | 0:e06404fdff2f | 6 | * This program is free software; you can redistribute it and/or modify |
Faberge | 0:e06404fdff2f | 7 | * it under the terms of the GNU General Public License as published by |
Faberge | 0:e06404fdff2f | 8 | * the Free Software Foundation; either version 2 of the License, or |
Faberge | 0:e06404fdff2f | 9 | * (at your option) any later version. |
Faberge | 0:e06404fdff2f | 10 | * |
Faberge | 0:e06404fdff2f | 11 | * This program is distributed in the hope that it will be useful, |
Faberge | 0:e06404fdff2f | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
Faberge | 0:e06404fdff2f | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
Faberge | 0:e06404fdff2f | 14 | * GNU General Public License for more details. |
Faberge | 0:e06404fdff2f | 15 | * |
Faberge | 0:e06404fdff2f | 16 | */ |
Faberge | 0:e06404fdff2f | 17 | |
Faberge | 1:a6d179a9ffbb | 18 | #include "app.h" |
Faberge | 0:e06404fdff2f | 19 | |
Faberge | 0:e06404fdff2f | 20 | int main() |
Faberge | 0:e06404fdff2f | 21 | { |
Faberge | 0:e06404fdff2f | 22 | /* Init LEDs */ |
Faberge | 1:a6d179a9ffbb | 23 | InitLEDs(); |
Faberge | 0:e06404fdff2f | 24 | |
Faberge | 0:e06404fdff2f | 25 | /* Dummy screen */ |
Faberge | 1:a6d179a9ffbb | 26 | Screen scr(LCD_COLOR_BLACK); |
Faberge | 1:a6d179a9ffbb | 27 | int state = NEW_TEXT_SCREEN; |
Faberge | 0:e06404fdff2f | 28 | |
Faberge | 0:e06404fdff2f | 29 | while(1) |
Faberge | 0:e06404fdff2f | 30 | { |
Faberge | 0:e06404fdff2f | 31 | /* Create screens */ |
Faberge | 0:e06404fdff2f | 32 | switch(state) |
Faberge | 0:e06404fdff2f | 33 | { |
Faberge | 1:a6d179a9ffbb | 34 | case NEW_SWITCH_SCREEN: |
Faberge | 0:e06404fdff2f | 35 | { |
Faberge | 1:a6d179a9ffbb | 36 | createSwitchScreen(&scr); |
Faberge | 1:a6d179a9ffbb | 37 | break; |
Faberge | 1:a6d179a9ffbb | 38 | } |
Faberge | 1:a6d179a9ffbb | 39 | case NEW_BUTTON_SCREEN: |
Faberge | 1:a6d179a9ffbb | 40 | { |
Faberge | 1:a6d179a9ffbb | 41 | createButtonScreen(&scr); |
Faberge | 0:e06404fdff2f | 42 | break; |
Faberge | 0:e06404fdff2f | 43 | } |
Faberge | 1:a6d179a9ffbb | 44 | case NEW_TEXT_SCREEN: |
Faberge | 0:e06404fdff2f | 45 | { |
Faberge | 1:a6d179a9ffbb | 46 | createTextScreen(&scr); |
Faberge | 0:e06404fdff2f | 47 | break; |
Faberge | 0:e06404fdff2f | 48 | } |
Faberge | 1:a6d179a9ffbb | 49 | default: break; |
Faberge | 0:e06404fdff2f | 50 | } |
Faberge | 0:e06404fdff2f | 51 | /* Check and upadte */ |
Faberge | 1:a6d179a9ffbb | 52 | state = scr.update(); |
Faberge | 0:e06404fdff2f | 53 | |
Faberge | 0:e06404fdff2f | 54 | /* Small delay for stability */ |
Faberge | 0:e06404fdff2f | 55 | HAL_Delay(10); |
Faberge | 0:e06404fdff2f | 56 | } |
Faberge | 0:e06404fdff2f | 57 | } |
Faberge | 0:e06404fdff2f | 58 |