AresENSEA-CDF2020
/
AresCDFMainCode_capteur_US
Capteur_US
main.cpp@1:2fe8c402ee79, 2020-07-08 (annotated)
- Committer:
- Nanaud
- Date:
- Wed Jul 08 20:42:19 2020 +0000
- Revision:
- 1:2fe8c402ee79
- Parent:
- 0:dc036b67c87c
- Child:
- 2:094c09903a9c
Amelioration de la lisibilite du code
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Nanaud | 1:2fe8c402ee79 | 1 | // Nom du fichier : main.cpp |
Nanaud | 0:dc036b67c87c | 2 | #include "pins.h" |
Nanaud | 0:dc036b67c87c | 3 | |
Nanaud | 0:dc036b67c87c | 4 | int main() { |
Nanaud | 0:dc036b67c87c | 5 | pc.printf("\r\nAresCDFMainCode\r\n"); |
Nanaud | 1:2fe8c402ee79 | 6 | |
Nanaud | 1:2fe8c402ee79 | 7 | // debug |
Nanaud | 1:2fe8c402ee79 | 8 | pc.attach(&serialIT); // Interruption liaison série |
Nanaud | 1:2fe8c402ee79 | 9 | |
Nanaud | 1:2fe8c402ee79 | 10 | // Init capteurs à ultrasons |
Nanaud | 1:2fe8c402ee79 | 11 | captUS_init(); |
Nanaud | 0:dc036b67c87c | 12 | echo1.rise(&echoRise1); |
Nanaud | 0:dc036b67c87c | 13 | echo1.fall(&echoFall1); |
Nanaud | 0:dc036b67c87c | 14 | echo2.rise(&echoRise2); |
Nanaud | 0:dc036b67c87c | 15 | echo2.fall(&echoFall2); |
Nanaud | 0:dc036b67c87c | 16 | echo3.rise(&echoRise3); |
Nanaud | 0:dc036b67c87c | 17 | echo3.fall(&echoFall3); |
Nanaud | 0:dc036b67c87c | 18 | echo4.rise(&echoRise4); |
Nanaud | 0:dc036b67c87c | 19 | echo4.fall(&echoFall4); |
Nanaud | 0:dc036b67c87c | 20 | echo5.rise(&echoRise5); |
Nanaud | 0:dc036b67c87c | 21 | echo5.fall(&echoFall5); |
Nanaud | 0:dc036b67c87c | 22 | echo6.rise(&echoRise6); |
Nanaud | 0:dc036b67c87c | 23 | echo6.fall(&echoFall6); |
Nanaud | 0:dc036b67c87c | 24 | |
Nanaud | 1:2fe8c402ee79 | 25 | // Init DRV8825 |
Nanaud | 0:dc036b67c87c | 26 | drv_init(); |
Nanaud | 1:2fe8c402ee79 | 27 | |
Nanaud | 1:2fe8c402ee79 | 28 | // Init codeurs |
Nanaud | 0:dc036b67c87c | 29 | cdgA.rise(&cdgaRise); |
Nanaud | 0:dc036b67c87c | 30 | cdgB.rise(&cdgbRise); |
Nanaud | 0:dc036b67c87c | 31 | cdgA.mode(PullUp); |
Nanaud | 0:dc036b67c87c | 32 | cdgB.mode(PullUp); |
Nanaud | 0:dc036b67c87c | 33 | |
Nanaud | 1:2fe8c402ee79 | 34 | // Fonctions d'affichage pour les tests |
Nanaud | 1:2fe8c402ee79 | 35 | ticker_US.attach(&captUS_trig,0.2); // On apelle cette fonction toutes 0.2 secondes |
Nanaud | 1:2fe8c402ee79 | 36 | ticker_affUS.attach(&affUltrasons,1.0); |
Nanaud | 1:2fe8c402ee79 | 37 | ticker_affcd.attach(&affCodeurs,1.0); |
Nanaud | 0:dc036b67c87c | 38 | aff_cd[0]=!aff_cd[0]; |
Nanaud | 0:dc036b67c87c | 39 | aff_cd[1]=!aff_cd[1]; |
Nanaud | 0:dc036b67c87c | 40 | |
Nanaud | 1:2fe8c402ee79 | 41 | while(1) {} |
Nanaud | 0:dc036b67c87c | 42 | } |