Enzo Grimeau
/
GPS_V2
Récupération de trame NMEA
main.cpp@9:a9dfb95b5d8a, 2020-11-22 (annotated)
- Committer:
- gr91
- Date:
- Sun Nov 22 15:15:15 2020 +0000
- Revision:
- 9:a9dfb95b5d8a
- Parent:
- 8:23fca4edc6b9
- Child:
- 10:8895b56c630c
Echo test isr 2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gr91 | 0:3aa4ba0ada56 | 1 | #include "mbed.h" |
gr91 | 8:23fca4edc6b9 | 2 | // Echo |
gr91 | 8:23fca4edc6b9 | 3 | // lien serie via USB avec Terarerm |
gr91 | 3:500dfd62fb76 | 4 | // GR 2020 |
gr91 | 6:a58f18b765cd | 5 | // Universite Paris-Saclay - IUT Cachan |
gr91 | 8:23fca4edc6b9 | 6 | RawSerial pc_raw(USBTX, USBRX); // ou SERIAL-TX, SERIAL_RX ou PA_2,PA_3 |
gr91 | 8:23fca4edc6b9 | 7 | DigitalOut ledB(D8); |
gr91 | 8:23fca4edc6b9 | 8 | void reception_symbole(void); |
gr91 | 0:3aa4ba0ada56 | 9 | int main() |
gr91 | 0:3aa4ba0ada56 | 10 | { |
gr91 | 8:23fca4edc6b9 | 11 | pc_raw.baud(115200); |
gr91 | 8:23fca4edc6b9 | 12 | pc_raw.attach(&reception_symbole); |
gr91 | 8:23fca4edc6b9 | 13 | pc_raw.printf("Echo test\r\n"); |
gr91 | 8:23fca4edc6b9 | 14 | ledB=0; |
gr91 | 0:3aa4ba0ada56 | 15 | while(1) { |
gr91 | 8:23fca4edc6b9 | 16 | } |
gr91 | 8:23fca4edc6b9 | 17 | } |
gr91 | 8:23fca4edc6b9 | 18 | void reception_symbole(void) |
gr91 | 8:23fca4edc6b9 | 19 | { |
gr91 | 8:23fca4edc6b9 | 20 | unsigned char c; |
gr91 | 8:23fca4edc6b9 | 21 | if(pc_raw.readable()) { |
gr91 | 8:23fca4edc6b9 | 22 | ledB=!ledB; |
gr91 | 8:23fca4edc6b9 | 23 | c=pc_raw.getc(); |
gr91 | 8:23fca4edc6b9 | 24 | pc_raw.putc(c); |
gr91 | 0:3aa4ba0ada56 | 25 | } |
gr91 | 0:3aa4ba0ada56 | 26 | } |
gr91 | 7:37ea12f2b18f | 27 | |
gr91 | 8:23fca4edc6b9 | 28 |