test de premier push

Dependencies:   WakeUp mbed EPD_GDE021A1

Sources/main.cpp

Committer:
mathieusab
Date:
2016-11-09
Revision:
12:ec54a73ea7ec
Parent:
8:d82493cd0916
Child:
13:0afb541c480e
Child:
20:5e0466126e9f

File content as of revision 12:ec54a73ea7ec:

/*
    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 "../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:
                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