test de premier push
Dependencies: WakeUp mbed EPD_GDE021A1
Sources/main.cpp@18:ec86c13524ad, 2016-11-11 (annotated)
- Committer:
- nba
- Date:
- Fri Nov 11 19:26:24 2016 +0000
- Revision:
- 18:ec86c13524ad
- Parent:
- 17:3f52db5f8b42
- Child:
- 24:b1c29d839d9b
Mise de poids en static
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" |
nba | 16:dc4a1be5abdb | 12 | #include "../Headers/ecran.h" |
nba | 16:dc4a1be5abdb | 13 | #include "../Headers/poids.h" |
nba | 17:3f52db5f8b42 | 14 | #include "../Headers/refreshScreen.h" |
nba | 13:0afb541c480e | 15 | |
mathieusab | 1:b1380b9f18c2 | 16 | |
mathieusab | 1:b1380b9f18c2 | 17 | Serial pc(USBTX, USBRX); // serie USB (ne pas oublier de souder sur la carte) |
nba | 13:0afb541c480e | 18 | InterruptIn bouton(PA_0); // bouton bleu en interuption |
mathieusab | 1:b1380b9f18c2 | 19 | |
mathieusab | 1:b1380b9f18c2 | 20 | State state = Start; // état de base : start |
nba | 18:ec86c13524ad | 21 | int poidsRuche; |
mathieusab | 1:b1380b9f18c2 | 22 | |
mathieusab | 1:b1380b9f18c2 | 23 | int main () |
mathieusab | 1:b1380b9f18c2 | 24 | { |
nba | 16:dc4a1be5abdb | 25 | //Ecran::print; |
nba | 17:3f52db5f8b42 | 26 | refreshScreen(); |
nba | 18:ec86c13524ad | 27 | poidsRuche = Poids::get(); |
mathieusab | 1:b1380b9f18c2 | 28 | while(true) |
mathieusab | 1:b1380b9f18c2 | 29 | { |
nba | 17:3f52db5f8b42 | 30 | bouton.rise(&refreshScreen); |
mathieusab | 1:b1380b9f18c2 | 31 | switch(state) |
mathieusab | 1:b1380b9f18c2 | 32 | { |
mathieusab | 1:b1380b9f18c2 | 33 | case Start: |
mathieusab | 12:ec54a73ea7ec | 34 | pc.printf("State Start\n"); |
mathieusab | 1:b1380b9f18c2 | 35 | //TODO Test jour ou nuit |
mathieusab | 1:b1380b9f18c2 | 36 | |
mathieusab | 1:b1380b9f18c2 | 37 | //TODO SI jour, Etat suivant = DeepSleepShort |
mathieusab | 1:b1380b9f18c2 | 38 | //TODO SI nuit, Etat suivant = DeepSleepLong |
mathieusab | 1:b1380b9f18c2 | 39 | break; |
mathieusab | 1:b1380b9f18c2 | 40 | case DeepSleepShort: |
mathieusab | 12:ec54a73ea7ec | 41 | pc.printf("State DeepSleepShort\n"); |
mathieusab | 1:b1380b9f18c2 | 42 | //TODO Ajouter appel à standby(...) |
mathieusab | 1:b1380b9f18c2 | 43 | |
mathieusab | 1:b1380b9f18c2 | 44 | //TODO Etat suivant = Start |
mathieusab | 1:b1380b9f18c2 | 45 | break; |
mathieusab | 1:b1380b9f18c2 | 46 | case DeepSleepLong: |
mathieusab | 12:ec54a73ea7ec | 47 | pc.printf("State DeepSleepLong\n"); |
mathieusab | 1:b1380b9f18c2 | 48 | //TODO Ajouter appel à standby(...) |
mathieusab | 1:b1380b9f18c2 | 49 | |
mathieusab | 1:b1380b9f18c2 | 50 | //TODO Etat suivant = Start |
mathieusab | 1:b1380b9f18c2 | 51 | break; |
mathieusab | 1:b1380b9f18c2 | 52 | case MesPHT: |
mathieusab | 12:ec54a73ea7ec | 53 | pc.printf("State MesPHT\n"); |
mathieusab | 1:b1380b9f18c2 | 54 | //TODO Ajouter appel à mesPHT(...) |
mathieusab | 1:b1380b9f18c2 | 55 | |
mathieusab | 1:b1380b9f18c2 | 56 | //TODO Test poids |
mathieusab | 1:b1380b9f18c2 | 57 | |
mathieusab | 1:b1380b9f18c2 | 58 | //TODO SI poids < 5 Kg, Etat suivant = MesGPS |
mathieusab | 1:b1380b9f18c2 | 59 | //TODO SINON Etat suivant = Send |
mathieusab | 1:b1380b9f18c2 | 60 | break; |
mathieusab | 1:b1380b9f18c2 | 61 | case MesGPS: |
mathieusab | 12:ec54a73ea7ec | 62 | pc.printf("State MesGPS\n"); |
mathieusab | 1:b1380b9f18c2 | 63 | //TODO Ajouter appel à mesGPS(...) |
mathieusab | 1:b1380b9f18c2 | 64 | break; |
mathieusab | 1:b1380b9f18c2 | 65 | case Send: |
mathieusab | 12:ec54a73ea7ec | 66 | pc.printf("State Send\n"); |
mathieusab | 1:b1380b9f18c2 | 67 | //TODO Ajouter appel à send(...) |
mathieusab | 1:b1380b9f18c2 | 68 | |
mathieusab | 1:b1380b9f18c2 | 69 | //TODO Test jour ou nuit |
mathieusab | 1:b1380b9f18c2 | 70 | |
mathieusab | 1:b1380b9f18c2 | 71 | //TODO SI jour, Etat suivant = DeepSleepShort |
mathieusab | 1:b1380b9f18c2 | 72 | //TODO SI nuit, Etat suivant = DeepSleepLong |
mathieusab | 1:b1380b9f18c2 | 73 | break; |
mathieusab | 1:b1380b9f18c2 | 74 | default: |
mathieusab | 12:ec54a73ea7ec | 75 | pc.printf("State Error\n"); |
mathieusab | 1:b1380b9f18c2 | 76 | //TODO Etat suivant = Start |
mathieusab | 1:b1380b9f18c2 | 77 | }//end switch |
mathieusab | 1:b1380b9f18c2 | 78 | }//end while |
mathieusab | 1:b1380b9f18c2 | 79 | }//end main |