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
Sources/main.cpp
- Committer:
- nba
- Date:
- 2016-11-09
- Revision:
- 14:65e134c75d8c
- Parent:
- 13:0afb541c480e
- Child:
- 15:5bb6f11fc300
File content as of revision 14:65e134c75d8c:
/*
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 "WakeUp.h"
#include "EPD_GDE021A1.h"
#include "../Headers/period.h"
#include "../Headers/states.h"
#include "../Headers/constants.h"
//#include "../Headers/ecran.h"
//#include "../Headers/poids.h"
//EPD_GDE021A1 epd(EPD_CS, EPD_DC, EPD_RESET, EPD_BUSY, EPD_POWER, EPD_SPI_MOSI, EPD_SPI_MISO, EPD_SPI_SCK);//Parametre l'ecrant E-Ink
Serial pc(USBTX, USBRX); // serie USB (ne pas oublier de souder sur la carte)
InterruptIn bouton(PA_0); // bouton bleu en interuption
State state = Start; // état de base : start
int main ()
{
//bouton.rise(&Ecran.print());
while(true)
{
switch(state)
{
case Start:
pc.printf("State Start\n");
//TODO Test jour ou nuit
//TODO SI jour, Etat suivant = DeepSleepShort
//TODO SI nuit, Etat suivant = DeepSleepLong
break;
case DeepSleepShort:
pc.printf("State DeepSleepShort\n");
//TODO Ajouter appel à standby(...)
//TODO Etat suivant = Start
break;
case DeepSleepLong:
pc.printf("State DeepSleepLong\n");
//TODO Ajouter appel à standby(...)
//TODO Etat suivant = Start
break;
case MesPHT:
pc.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:
pc.printf("State MesGPS\n");
//TODO Ajouter appel à mesGPS(...)
break;
case Send:
pc.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:
pc.printf("State Error\n");
//TODO Etat suivant = Start
}//end switch
}//end while
}//end main