programa para leer un GPS desde la FRDMKL25Z
Dependents: pruebagps rastreador_satelital_2 ELJPGTarea_6
Fork of GPS by
GPS.h@1:653fe36ca211, 2014-06-06 (annotated)
- Committer:
- tony63
- Date:
- Fri Jun 06 04:04:46 2014 +0000
- Revision:
- 1:653fe36ca211
- Parent:
- 0:15611c7938a3
programa para leer un GPD desde la FRDMKL25Z
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tony63 | 1:653fe36ca211 | 1 | |
simon | 0:15611c7938a3 | 2 | |
simon | 0:15611c7938a3 | 3 | #include "mbed.h" |
simon | 0:15611c7938a3 | 4 | |
simon | 0:15611c7938a3 | 5 | #ifndef MBED_GPS_H |
simon | 0:15611c7938a3 | 6 | #define MBED_GPS_H |
simon | 0:15611c7938a3 | 7 | |
simon | 0:15611c7938a3 | 8 | /** A GPS interface for reading from a Globalsat EM-406 GPS Module */ |
simon | 0:15611c7938a3 | 9 | class GPS { |
simon | 0:15611c7938a3 | 10 | public: |
simon | 0:15611c7938a3 | 11 | |
simon | 0:15611c7938a3 | 12 | /** Create the GPS interface, connected to the specified serial port |
simon | 0:15611c7938a3 | 13 | */ |
simon | 0:15611c7938a3 | 14 | GPS(PinName tx, PinName rx); |
simon | 0:15611c7938a3 | 15 | |
simon | 0:15611c7938a3 | 16 | /** Sample the incoming GPS data, returning whether there is a lock |
simon | 0:15611c7938a3 | 17 | * |
simon | 0:15611c7938a3 | 18 | * @return 1 if there was a lock when the sample was taken (and therefore .longitude and .latitude are valid), else 0 |
simon | 0:15611c7938a3 | 19 | */ |
simon | 0:15611c7938a3 | 20 | int sample(); |
simon | 0:15611c7938a3 | 21 | |
simon | 0:15611c7938a3 | 22 | /** The longitude (call sample() to set) */ |
simon | 0:15611c7938a3 | 23 | float longitude; |
tony63 | 1:653fe36ca211 | 24 | |
simon | 0:15611c7938a3 | 25 | /** The latitude (call sample() to set) */ |
simon | 0:15611c7938a3 | 26 | float latitude; |
simon | 0:15611c7938a3 | 27 | |
simon | 0:15611c7938a3 | 28 | private: |
simon | 0:15611c7938a3 | 29 | float trunc(float v); |
simon | 0:15611c7938a3 | 30 | void getline(); |
simon | 0:15611c7938a3 | 31 | |
simon | 0:15611c7938a3 | 32 | Serial _gps; |
simon | 0:15611c7938a3 | 33 | char msg[256]; |
tony63 | 1:653fe36ca211 | 34 | |
simon | 0:15611c7938a3 | 35 | }; |
simon | 0:15611c7938a3 | 36 | |
simon | 0:15611c7938a3 | 37 | #endif |