Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: WakeUp mbed EPD_GDE021A1
main.cpp
- Committer:
- mathieusab
- Date:
- 2016-11-07
- Revision:
- 1:b1380b9f18c2
- Parent:
- 0:3f1b66e89cea
- Child:
- 7:42302df77ca5
File content as of revision 1:b1380b9f18c2:
/*
main.cpp comportant la machine d'état.
Les fonctions appelées par ce main doivent être déclarées dans des headers.
*/
#include <stdio.h>
#include "mbed.h"
#include "../Headers/period.h"
#include "../Headers/states.h"
#include "../Headers/constants.h"
Serial pc(USBTX, USBRX); // serie USB (ne pas oublier de souder sur la carte)
State state = Start; // état de base : start
int main ()
{
while(true)
{
switch(state)
{
case Start:
printf("State Start\n");
//TODO Test jour ou nuit
//TODO SI jour, Etat suivant = DeepSleepShort
//TODO SI nuit, Etat suivant = DeepSleepLong
break;
case DeepSleepShort:
printf("State DeepSleepShort\n");
//TODO Ajouter appel à standby(...)
//TODO Etat suivant = Start
break;
case DeepSleepLong:
printf("State DeepSleepLong\n");
//TODO Ajouter appel à standby(...)
//TODO Etat suivant = Start
break;
case MesPHT:
printf("State MesPHT\n");
//TODO Ajouter appel à mesPHT(...)
//TODO Test poids
//TODO SI poids < 5 Kg, Etat suivant = MesGPS
//TODO SINON Etat suivant = Send
break;
case MesGPS:
printf("State MesGPS\n");
//TODO Ajouter appel à mesGPS(...)
break;
case Send:
printf("State Send\n");
//TODO Ajouter appel à send(...)
//TODO Test jour ou nuit
//TODO SI jour, Etat suivant = DeepSleepShort
//TODO SI nuit, Etat suivant = DeepSleepLong
break;
default:
printf("State Error\n");
//TODO Etat suivant = Start
}//end switch
}//end while
}//end main