Demo to control 4 LEDs

Dependencies:   BSP_DISCO_F469NI mbed

Committer:
Faberge
Date:
Tue Oct 31 14:46:28 2017 +0000
Revision:
2:e6fc24fbd86c
Parent:
1:a6d179a9ffbb
Update

Who changed what in which revision?

UserRevisionLine numberNew 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 2:e6fc24fbd86c 27 /* Program state */
Faberge 1:a6d179a9ffbb 28 int state = NEW_TEXT_SCREEN;
Faberge 0:e06404fdff2f 29
Faberge 0:e06404fdff2f 30 while(1)
Faberge 0:e06404fdff2f 31 {
Faberge 0:e06404fdff2f 32 /* Create screens */
Faberge 0:e06404fdff2f 33 switch(state)
Faberge 0:e06404fdff2f 34 {
Faberge 1:a6d179a9ffbb 35 case NEW_SWITCH_SCREEN:
Faberge 0:e06404fdff2f 36 {
Faberge 1:a6d179a9ffbb 37 createSwitchScreen(&scr);
Faberge 1:a6d179a9ffbb 38 break;
Faberge 1:a6d179a9ffbb 39 }
Faberge 1:a6d179a9ffbb 40 case NEW_BUTTON_SCREEN:
Faberge 1:a6d179a9ffbb 41 {
Faberge 1:a6d179a9ffbb 42 createButtonScreen(&scr);
Faberge 0:e06404fdff2f 43 break;
Faberge 0:e06404fdff2f 44 }
Faberge 1:a6d179a9ffbb 45 case NEW_TEXT_SCREEN:
Faberge 0:e06404fdff2f 46 {
Faberge 1:a6d179a9ffbb 47 createTextScreen(&scr);
Faberge 0:e06404fdff2f 48 break;
Faberge 0:e06404fdff2f 49 }
Faberge 1:a6d179a9ffbb 50 default: break;
Faberge 0:e06404fdff2f 51 }
Faberge 0:e06404fdff2f 52 /* Check and upadte */
Faberge 1:a6d179a9ffbb 53 state = scr.update();
Faberge 0:e06404fdff2f 54
Faberge 0:e06404fdff2f 55 /* Small delay for stability */
Faberge 0:e06404fdff2f 56 HAL_Delay(10);
Faberge 0:e06404fdff2f 57 }
Faberge 0:e06404fdff2f 58 }
Faberge 0:e06404fdff2f 59