tito tito
/
GPS_IUT_Nice
programme GPS pour ERS4
Fork of GPS by
GPS.h@0:2c0686a07ab8, 2012-11-23 (annotated)
- Committer:
- dreday20
- Date:
- Fri Nov 23 19:10:01 2012 +0000
- Revision:
- 0:2c0686a07ab8
1.0;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dreday20 | 0:2c0686a07ab8 | 1 | /* mbed EM-406 GPS Module Library |
dreday20 | 0:2c0686a07ab8 | 2 | * Copyright (c) 2008-2010, sford |
dreday20 | 0:2c0686a07ab8 | 3 | * |
dreday20 | 0:2c0686a07ab8 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
dreday20 | 0:2c0686a07ab8 | 5 | * of this software and associated documentation files (the "Software"), to deal |
dreday20 | 0:2c0686a07ab8 | 6 | * in the Software without restriction, including without limitation the rights |
dreday20 | 0:2c0686a07ab8 | 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
dreday20 | 0:2c0686a07ab8 | 8 | * copies of the Software, and to permit persons to whom the Software is |
dreday20 | 0:2c0686a07ab8 | 9 | * furnished to do so, subject to the following conditions: |
dreday20 | 0:2c0686a07ab8 | 10 | * |
dreday20 | 0:2c0686a07ab8 | 11 | * The above copyright notice and this permission notice shall be included in |
dreday20 | 0:2c0686a07ab8 | 12 | * all copies or substantial portions of the Software. |
dreday20 | 0:2c0686a07ab8 | 13 | * |
dreday20 | 0:2c0686a07ab8 | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
dreday20 | 0:2c0686a07ab8 | 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
dreday20 | 0:2c0686a07ab8 | 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
dreday20 | 0:2c0686a07ab8 | 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
dreday20 | 0:2c0686a07ab8 | 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
dreday20 | 0:2c0686a07ab8 | 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
dreday20 | 0:2c0686a07ab8 | 20 | * THE SOFTWARE. |
dreday20 | 0:2c0686a07ab8 | 21 | */ |
dreday20 | 0:2c0686a07ab8 | 22 | |
dreday20 | 0:2c0686a07ab8 | 23 | #include "mbed.h" |
dreday20 | 0:2c0686a07ab8 | 24 | |
dreday20 | 0:2c0686a07ab8 | 25 | #ifndef MBED_GPS_H |
dreday20 | 0:2c0686a07ab8 | 26 | #define MBED_GPS_H |
dreday20 | 0:2c0686a07ab8 | 27 | |
dreday20 | 0:2c0686a07ab8 | 28 | /** A GPS interface for reading from a Globalsat EM-406 GPS Module */ |
dreday20 | 0:2c0686a07ab8 | 29 | class GPS { |
dreday20 | 0:2c0686a07ab8 | 30 | public: |
dreday20 | 0:2c0686a07ab8 | 31 | |
dreday20 | 0:2c0686a07ab8 | 32 | /** Create the GPS interface, connected to the specified serial port |
dreday20 | 0:2c0686a07ab8 | 33 | */ |
dreday20 | 0:2c0686a07ab8 | 34 | GPS(PinName tx, PinName rx); |
dreday20 | 0:2c0686a07ab8 | 35 | |
dreday20 | 0:2c0686a07ab8 | 36 | /** Sample the incoming GPS data, returning whether there is a lock |
dreday20 | 0:2c0686a07ab8 | 37 | * |
dreday20 | 0:2c0686a07ab8 | 38 | * @return 1 if there was a lock when the sample was taken (and therefore .longitude and .latitude are valid), else 0 |
dreday20 | 0:2c0686a07ab8 | 39 | */ |
dreday20 | 0:2c0686a07ab8 | 40 | int sample(); |
dreday20 | 0:2c0686a07ab8 | 41 | |
dreday20 | 0:2c0686a07ab8 | 42 | /** The longitude (call sample() to set) */ |
dreday20 | 0:2c0686a07ab8 | 43 | float longitude; |
dreday20 | 0:2c0686a07ab8 | 44 | |
dreday20 | 0:2c0686a07ab8 | 45 | /** The latitude (call sample() to set) */ |
dreday20 | 0:2c0686a07ab8 | 46 | float latitude; |
dreday20 | 0:2c0686a07ab8 | 47 | |
dreday20 | 0:2c0686a07ab8 | 48 | private: |
dreday20 | 0:2c0686a07ab8 | 49 | float trunc(float v); |
dreday20 | 0:2c0686a07ab8 | 50 | void getline(); |
dreday20 | 0:2c0686a07ab8 | 51 | |
dreday20 | 0:2c0686a07ab8 | 52 | Serial _gps; |
dreday20 | 0:2c0686a07ab8 | 53 | char msg[256]; |
dreday20 | 0:2c0686a07ab8 | 54 | |
dreday20 | 0:2c0686a07ab8 | 55 | }; |
dreday20 | 0:2c0686a07ab8 | 56 | |
dreday20 | 0:2c0686a07ab8 | 57 | #endif |