test de premier push
Dependencies: WakeUp mbed EPD_GDE021A1
Sources/main.cpp@12:ec54a73ea7ec, 2016-11-09 (annotated)
- Committer:
- mathieusab
- Date:
- Wed Nov 09 16:31:57 2016 +0000
- Revision:
- 12:ec54a73ea7ec
- Parent:
- 8:d82493cd0916
- Child:
- 13:0afb541c480e
- Child:
- 20:5e0466126e9f
changement des printf en pc.printf
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mathieusab | 1:b1380b9f18c2 | 1 | /* |
mathieusab | 1:b1380b9f18c2 | 2 | main.cpp comportant la machine d'état. |
mathieusab | 1:b1380b9f18c2 | 3 | Les fonctions appelées par ce main doivent être déclarées dans des headers. |
mathieusab | 1:b1380b9f18c2 | 4 | */ |
mathieusab | 1:b1380b9f18c2 | 5 | |
mathieusab | 1:b1380b9f18c2 | 6 | #include <stdio.h> |
mathieusab | 1:b1380b9f18c2 | 7 | #include "mbed.h" |
nba | 7:42302df77ca5 | 8 | #include "WakeUp.h" |
mathieusab | 1:b1380b9f18c2 | 9 | #include "../Headers/period.h" |
mathieusab | 1:b1380b9f18c2 | 10 | #include "../Headers/states.h" |
mathieusab | 1:b1380b9f18c2 | 11 | #include "../Headers/constants.h" |
mathieusab | 1:b1380b9f18c2 | 12 | |
mathieusab | 1:b1380b9f18c2 | 13 | Serial pc(USBTX, USBRX); // serie USB (ne pas oublier de souder sur la carte) |
mathieusab | 1:b1380b9f18c2 | 14 | |
mathieusab | 1:b1380b9f18c2 | 15 | State state = Start; // état de base : start |
mathieusab | 1:b1380b9f18c2 | 16 | |
mathieusab | 1:b1380b9f18c2 | 17 | int main () |
mathieusab | 1:b1380b9f18c2 | 18 | { |
mathieusab | 1:b1380b9f18c2 | 19 | while(true) |
mathieusab | 1:b1380b9f18c2 | 20 | { |
mathieusab | 1:b1380b9f18c2 | 21 | switch(state) |
mathieusab | 1:b1380b9f18c2 | 22 | { |
mathieusab | 1:b1380b9f18c2 | 23 | case Start: |
mathieusab | 12:ec54a73ea7ec | 24 | pc.printf("State Start\n"); |
mathieusab | 1:b1380b9f18c2 | 25 | //TODO Test jour ou nuit |
mathieusab | 1:b1380b9f18c2 | 26 | |
mathieusab | 1:b1380b9f18c2 | 27 | //TODO SI jour, Etat suivant = DeepSleepShort |
mathieusab | 1:b1380b9f18c2 | 28 | //TODO SI nuit, Etat suivant = DeepSleepLong |
mathieusab | 1:b1380b9f18c2 | 29 | break; |
mathieusab | 1:b1380b9f18c2 | 30 | case DeepSleepShort: |
mathieusab | 12:ec54a73ea7ec | 31 | pc.printf("State DeepSleepShort\n"); |
mathieusab | 1:b1380b9f18c2 | 32 | //TODO Ajouter appel à standby(...) |
mathieusab | 1:b1380b9f18c2 | 33 | |
mathieusab | 1:b1380b9f18c2 | 34 | //TODO Etat suivant = Start |
mathieusab | 1:b1380b9f18c2 | 35 | break; |
mathieusab | 1:b1380b9f18c2 | 36 | case DeepSleepLong: |
mathieusab | 12:ec54a73ea7ec | 37 | pc.printf("State DeepSleepLong\n"); |
mathieusab | 1:b1380b9f18c2 | 38 | //TODO Ajouter appel à standby(...) |
mathieusab | 1:b1380b9f18c2 | 39 | |
mathieusab | 1:b1380b9f18c2 | 40 | //TODO Etat suivant = Start |
mathieusab | 1:b1380b9f18c2 | 41 | break; |
mathieusab | 1:b1380b9f18c2 | 42 | case MesPHT: |
mathieusab | 12:ec54a73ea7ec | 43 | pc.printf("State MesPHT\n"); |
mathieusab | 1:b1380b9f18c2 | 44 | //TODO Ajouter appel à mesPHT(...) |
mathieusab | 1:b1380b9f18c2 | 45 | |
mathieusab | 1:b1380b9f18c2 | 46 | //TODO Test poids |
mathieusab | 1:b1380b9f18c2 | 47 | |
mathieusab | 1:b1380b9f18c2 | 48 | //TODO SI poids < 5 Kg, Etat suivant = MesGPS |
mathieusab | 1:b1380b9f18c2 | 49 | //TODO SINON Etat suivant = Send |
mathieusab | 1:b1380b9f18c2 | 50 | break; |
mathieusab | 1:b1380b9f18c2 | 51 | case MesGPS: |
mathieusab | 12:ec54a73ea7ec | 52 | pc.printf("State MesGPS\n"); |
mathieusab | 1:b1380b9f18c2 | 53 | //TODO Ajouter appel à mesGPS(...) |
mathieusab | 1:b1380b9f18c2 | 54 | break; |
mathieusab | 1:b1380b9f18c2 | 55 | case Send: |
mathieusab | 12:ec54a73ea7ec | 56 | pc.printf("State Send\n"); |
mathieusab | 1:b1380b9f18c2 | 57 | //TODO Ajouter appel à send(...) |
mathieusab | 1:b1380b9f18c2 | 58 | |
mathieusab | 1:b1380b9f18c2 | 59 | //TODO Test jour ou nuit |
mathieusab | 1:b1380b9f18c2 | 60 | |
mathieusab | 1:b1380b9f18c2 | 61 | //TODO SI jour, Etat suivant = DeepSleepShort |
mathieusab | 1:b1380b9f18c2 | 62 | //TODO SI nuit, Etat suivant = DeepSleepLong |
mathieusab | 1:b1380b9f18c2 | 63 | break; |
mathieusab | 1:b1380b9f18c2 | 64 | default: |
mathieusab | 12:ec54a73ea7ec | 65 | pc.printf("State Error\n"); |
mathieusab | 1:b1380b9f18c2 | 66 | //TODO Etat suivant = Start |
mathieusab | 1:b1380b9f18c2 | 67 | }//end switch |
mathieusab | 1:b1380b9f18c2 | 68 | }//end while |
mathieusab | 1:b1380b9f18c2 | 69 | }//end main |