schneider françois
/
Test_gps_sample
OK
main.cpp@1:828c32336aa2, 2016-05-02 (annotated)
- Committer:
- schnf30
- Date:
- Mon May 02 19:54:59 2016 +0000
- Revision:
- 1:828c32336aa2
- Parent:
- 0:5cddc7863ae6
- Child:
- 3:9f6d26f044c7
Mise a jour
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
schnf30 | 0:5cddc7863ae6 | 1 | #include "mbed.h" |
schnf30 | 0:5cddc7863ae6 | 2 | #include "Sf_gps.h" |
schnf30 | 0:5cddc7863ae6 | 3 | |
schnf30 | 1:828c32336aa2 | 4 | Gps gps(p9,p10); |
schnf30 | 1:828c32336aa2 | 5 | Serial pc(USBTX, USBRX); |
schnf30 | 1:828c32336aa2 | 6 | DigitalOut myled(LED1); |
schnf30 | 0:5cddc7863ae6 | 7 | #define gps_event // pour utiliser en mode event. |
schnf30 | 0:5cddc7863ae6 | 8 | |
schnf30 | 0:5cddc7863ae6 | 9 | #ifdef gps_event |
schnf30 | 1:828c32336aa2 | 10 | void Gps_attache() |
schnf30 | 1:828c32336aa2 | 11 | { |
schnf30 | 1:828c32336aa2 | 12 | gps.receive(); |
schnf30 | 1:828c32336aa2 | 13 | } |
schnf30 | 0:5cddc7863ae6 | 14 | #endif |
schnf30 | 1:828c32336aa2 | 15 | |
schnf30 | 1:828c32336aa2 | 16 | int main() |
schnf30 | 1:828c32336aa2 | 17 | { |
schnf30 | 1:828c32336aa2 | 18 | pc.baud(9600); |
schnf30 | 1:828c32336aa2 | 19 | pc.printf("Hello, I'm Ok\r\n"); |
schnf30 | 1:828c32336aa2 | 20 | #ifdef gps_event |
schnf30 | 1:828c32336aa2 | 21 | gps.attach(&Gps_attache, Serial::RxIrq); |
schnf30 | 1:828c32336aa2 | 22 | #endif |
schnf30 | 0:5cddc7863ae6 | 23 | while(1) { |
schnf30 | 1:828c32336aa2 | 24 | #ifndef gps_event |
schnf30 | 0:5cddc7863ae6 | 25 | gps.receive(); |
schnf30 | 1:828c32336aa2 | 26 | #endif |
schnf30 | 1:828c32336aa2 | 27 | if (gps.gps_data_ok()) pc.printf("Receive %f, %f, %c ,%f ,%c ,%d, %d\r\n",gps.time(),gps.latitude(),gps.ns(),gps.longitude(),gps.ew(),gps.lock(),gps.nbsattelite()); |
schnf30 | 0:5cddc7863ae6 | 28 | } |
schnf30 | 1:828c32336aa2 | 29 | } |