Patrice HAESAERT
/
chrono_TIR_V2
chrono
main.cpp@1:79f936cc69dd, 2020-02-03 (annotated)
- Committer:
- pathae
- Date:
- Mon Feb 03 14:36:55 2020 +0000
- Revision:
- 1:79f936cc69dd
- Parent:
- 0:f38ea4ed5621
Chrono
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pathae | 0:f38ea4ed5621 | 1 | #include "mbed.h" |
pathae | 0:f38ea4ed5621 | 2 | #include "mbed_genie.h" |
pathae | 0:f38ea4ed5621 | 3 | |
pathae | 1:79f936cc69dd | 4 | //Prototype des routines d'interruption |
pathae | 1:79f936cc69dd | 5 | void compt_secondes(); |
pathae | 0:f38ea4ed5621 | 6 | |
pathae | 1:79f936cc69dd | 7 | int chrono; |
pathae | 1:79f936cc69dd | 8 | |
pathae | 1:79f936cc69dd | 9 | //Déclaration de l'interruptions Ticker |
pathae | 1:79f936cc69dd | 10 | Ticker seconde_ticker; |
pathae | 0:f38ea4ed5621 | 11 | |
pathae | 1:79f936cc69dd | 12 | /************************************************************************************************* |
pathae | 1:79f936cc69dd | 13 | Interruption générée automatiquement toutes les secondes pour décrémenter le compteur ** |
pathae | 1:79f936cc69dd | 14 | *************************************************************************************************/ |
pathae | 1:79f936cc69dd | 15 | void compt_secondes() |
pathae | 1:79f936cc69dd | 16 | { |
pathae | 1:79f936cc69dd | 17 | chrono=chrono-1; |
pathae | 1:79f936cc69dd | 18 | genieWriteObject(GENIE_OBJ_LED_DIGITS, 0x00, chrono); //write to Leddigits0 the value of voltLED |
pathae | 1:79f936cc69dd | 19 | return; |
pathae | 0:f38ea4ed5621 | 20 | } |
pathae | 1:79f936cc69dd | 21 | |
pathae | 1:79f936cc69dd | 22 | /************************ |
pathae | 1:79f936cc69dd | 23 | * Programme principal * |
pathae | 1:79f936cc69dd | 24 | *************************/ |
pathae | 0:f38ea4ed5621 | 25 | |
pathae | 0:f38ea4ed5621 | 26 | int main() |
pathae | 0:f38ea4ed5621 | 27 | { |
pathae | 0:f38ea4ed5621 | 28 | SetupGenie(); |
pathae | 0:f38ea4ed5621 | 29 | genieWriteContrast(10); //set screen contrast to full brightness |
pathae | 1:79f936cc69dd | 30 | //Initialisation de l'interruption "Ticker" toutes les secondes |
pathae | 1:79f936cc69dd | 31 | seconde_ticker.attach(&compt_secondes,1); //Appel de la fonction toutes les secondes. |
pathae | 0:f38ea4ed5621 | 32 | chrono=99; |
pathae | 0:f38ea4ed5621 | 33 | while(1) { |
pathae | 1:79f936cc69dd | 34 | if(chrono ==0) |
pathae | 1:79f936cc69dd | 35 | chrono=99; |
pathae | 0:f38ea4ed5621 | 36 | } |
pathae | 0:f38ea4ed5621 | 37 | } |