SDP Code
Fork of MODGPS by
The MODGPS API
Functions | |
bool | isTimeValid (void) |
Is the time reported by the GPS valid. | |
int | getGPSquality (void) |
Is the positional fix reported by the GPS valid. | |
int | numOfSats (void) |
How many satellites were used in the last fix. | |
double | latitude (void) |
What was the last reported latitude (in degrees) | |
double | longitude (void) |
What was the last reported longitude (in degrees) | |
double | altitude (void) |
What was the last reported altitude (in kilometers) | |
double | height (void) |
What was the last reported altitude/height (in kilometers) | |
GPS_VTG * | vtg (GPS_VTG *g) |
Get all vector parameters together. | |
GPS_VTG * | vtg (void) |
Get all vector parameters together. | |
GPS_Geodetic * | geodetic (GPS_Geodetic *g) |
Get all three geodetic parameters together. | |
GPS_Geodetic * | geodetic (void) |
Get all three geodetic parameters together. | |
GPS_Time * | timeNow (GPS_Time *n) |
Take a snap shot of the current time. | |
GPS_Time * | timeNow (void) |
Take a snap shot of the current time. | |
double | julianDayNumber (void) |
Return the curent day. | |
double | julianDate (void) |
Return the curent date/time as a Julian date. | |
double | siderealDegrees (void) |
Get the current sidereal degree angle. | |
double | siderealHA (void) |
Get the current sidereal hour angle. | |
void | ppsAttach (PinName irq, ppsEdgeType type=ppsRise) |
Optionally, connect a 1PPS single to an Mbed pin. | |
template<typename T > | |
void | attach_pps (T *tptr, void(T::*mptr)(void)) |
Attach a user object/method callback function to the PPS signal. | |
void | attach_pps (void(*fptr)(void)) |
Attach a user callback function to the PPS signal. | |
template<typename T > | |
void | attach_rmc (T *tptr, void(T::*mptr)(void)) |
Attach a user callback function to the NMEA RMC message processed signal. | |
void | attach_rmc (void(*fptr)(void)) |
Attach a user callback function to the NMEA RMC message processed signal. | |
template<typename T > | |
void | attach_gga (T *tptr, void(T::*mptr)(void)) |
Attach a user callback function to the NMEA GGA message processed signal. | |
void | attach_gga (void(*fptr)(void)) |
Attach a user callback function to the NMEA GGA message processed signal. | |
template<typename T > | |
void | attach_vtg (T *tptr, void(T::*mptr)(void)) |
Attach a user callback function to the NMEA VTG message processed signal. | |
void | attach_vtg (void(*fptr)(void)) |
Attach a user callback function to the NMEA VTG message processed signal. | |
template<typename T > | |
void | attach_ukn (T *tptr, void(T::*mptr)(void)) |
Attach a user callback function to the unknown NMEA message. | |
void | attach_ukn (void(*fptr)(void)) |
Attach a user callback function to the unknown NMEA message. | |
void | baud (int baudrate) |
Set the baud rate the GPS module is using. | |
void | format (int bits, Parity parity, int stop_bits) |
Set the serial port format the GPS module is using. | |
void | NmeaOnUart0 (bool b) |
Send incoming GPS bytes to Uart0. |
Function Documentation
double altitude | ( | void | ) | [inherited] |
void attach_gga | ( | T * | tptr, |
void(T::*)(void) | mptr | ||
) | [inherited] |
Attach a user callback function to the NMEA GGA message processed signal.
Attach a user callback object/method to call when an NMEA GGA packet has been processed.
class FOO { public: void myCallback(void); }; GPS gps(NC, p9); Foo foo; gps.attach_gga(foo, &FOO::myCallback);
- Parameters:
-
tptr pointer to the object to call the member function on mptr pointer to the member function to be called
void attach_gga | ( | void(*)(void) | fptr ) | [inherited] |
Attach a user callback function to the NMEA GGA message processed signal.
Attach a user callback function pointer to call when an NMEA GGA packet has been processed.
void myCallback(void) { ... } GPS gps(NC, p9); Foo foo; gps.attach_gga(&myCallback);
- Parameters:
-
fptr Callback function pointer.
void attach_pps | ( | T * | tptr, |
void(T::*)(void) | mptr | ||
) | [inherited] |
Attach a user object/method callback function to the PPS signal.
Attach a user callback object/method to call when the 1PPS signal activates.
class FOO { public: void myCallback(void); }; GPS gps(NC, p9); Foo foo; gps.attach_pps(foo, &FOO::myCallback);
- Parameters:
-
tptr pointer to the object to call the member function on mptr pointer to the member function to be called
void attach_pps | ( | void(*)(void) | fptr ) | [inherited] |
Attach a user callback function to the PPS signal.
Attach a user callback function pointer to call when the 1PPS signal activates.
void myCallback(void) { ... } GPS gps(NC, p9); Foo foo; gps.attach_pps(&myCallback);
- Parameters:
-
fptr Callback function pointer
void attach_rmc | ( | T * | tptr, |
void(T::*)(void) | mptr | ||
) | [inherited] |
Attach a user callback function to the NMEA RMC message processed signal.
Attach a user callback object/method to call when an NMEA RMC packet has been processed.
class FOO { public: void myCallback(void); }; GPS gps(NC, p9); Foo foo; gps.attach_rmc(foo, &FOO::myCallback);
- Parameters:
-
tptr pointer to the object to call the member function on mptr pointer to the member function to be called
void attach_rmc | ( | void(*)(void) | fptr ) | [inherited] |
Attach a user callback function to the NMEA RMC message processed signal.
Attach a user callback function pointer to call when an NMEA RMC packet has been processed.
void myCallback(void) { ... } GPS gps(NC, p9); Foo foo; gps.attach_rmc(&myCallback);
- Parameters:
-
fptr Callback function pointer.
void attach_ukn | ( | T * | tptr, |
void(T::*)(void) | mptr | ||
) | [inherited] |
Attach a user callback function to the unknown NMEA message.
Attach a user callback object/method to call when an unknown NMEA packet.
class FOO { public: void myCallback(void); }; GPS gps(NC, p9); Foo foo; gps.attach_ukn(foo, &FOO::myCallback);
- Parameters:
-
tptr pointer to the object to call the member function on mptr pointer to the member function to be called
void attach_ukn | ( | void(*)(void) | fptr ) | [inherited] |
Attach a user callback function to the unknown NMEA message.
Attach a user callback function pointer to call when an unknown NMEA.
void myCallback(void) { ... } GPS gps(NC, p9); Foo foo; gps.attach_ukn(&myCallback);
- Parameters:
-
fptr Callback function pointer.
void attach_vtg | ( | T * | tptr, |
void(T::*)(void) | mptr | ||
) | [inherited] |
Attach a user callback function to the NMEA VTG message processed signal.
Attach a user callback object/method to call when an NMEA VTG packet has been processed.
class FOO { public: void myCallback(void); }; GPS gps(NC, p9); Foo foo; gps.attach_vtg(foo, &FOO::myCallback);
- Parameters:
-
tptr pointer to the object to call the member function on mptr pointer to the member function to be called
void attach_vtg | ( | void(*)(void) | fptr ) | [inherited] |
Attach a user callback function to the NMEA VTG message processed signal.
Attach a user callback function pointer to call when an NMEA VTG packet has been processed.
void myCallback(void) { ... } GPS gps(NC, p9); Foo foo; gps.attach_vtg(&myCallback);
- Parameters:
-
fptr Callback function pointer.
void baud | ( | int | baudrate ) | [inherited] |
Set the baud rate the GPS module is using.
Set the baud rate of the serial port
- Parameters:
-
baudrate The baudrate to set.
void format | ( | int | bits, |
Parity | parity, | ||
int | stop_bits | ||
) | [inherited] |
Set the serial port format the GPS module is using.
Set the transmission format used by the Serial port
- Parameters:
-
bits - The number of bits in a word (5-8; default = 8) parity - The parity used (GPS::None, GPS::Odd, GPS::Even, GPS::Forced1, GPS::Forced0; default = GPS::None) stop_bits - The number of stop bits (1 or 2; default = 1)
GPS_Geodetic * geodetic | ( | GPS_Geodetic * | g ) | [inherited] |
Get all three geodetic parameters together.
Pass a pointer to a GPS_Geodetic object and the current GPS data will be copied into it.
// Assuming we have a GPS object previously created... GPS gps(NC, p9); // Then get the data... GPS_Geodetic p; gps.geodetic(&p); printf("Latitude = %.4f", p.lat); printf("Longitude = %.4f", p.lon); printf("Altitude = %.4f", p.alt);
- Parameters:
-
g A GSP_Geodetic pointer to an existing GPS_Geodetic object.
- Returns:
- GPS_Geodetic * The pointer passed in.
GPS_Geodetic* geodetic | ( | void | ) | [inherited] |
Get all three geodetic parameters together.
Get all the geodetic data at once. For example:-
// Assuming we have a GPS object previously created... GPS gps(NC, p9); // Then get the data... GPS_Geodetic *p = gps.geodetic(); printf("Latitude = %.4f", p->lat); delete(p); // then remember to delete the object to prevent memory leaks.
- Returns:
- GPS_Geodetic * A pointer to the data.
int getGPSquality | ( | void | ) | [inherited] |
Is the positional fix reported by the GPS valid.
Method used to check the validity of the positional data. This method returns the GGA field, 0 is "bad, 1 is "ok", etc. See the NMEA GGA description for more details.
// Assuming we have a GPS object previously created... GPS gps(NC, p9); if (gps.getGPSquality() == 0) { // The location fix is no good/not accurate :( } else { // All good, can use last fix data. )
- Returns:
- int 0 on no fix, 1... (see NMEA GGA for more details).
double height | ( | void | ) | [inherited] |
bool isTimeValid | ( | void | ) | [inherited] |
Is the time reported by the GPS valid.
Method used to check the validity of the time the GPS module is reporting.
// Assuming we have a GPS object previously created... GPS gps(NC, p9); if (gps.isTimeValid()) { // Time is valid :) } else { // Doh, time is not valid :( )
- Returns:
- bool true if valid, false otherwise
double julianDate | ( | void | ) | [inherited] |
Return the curent date/time as a Julian date.
// Assuming we have a GPS object previously created... GPS gps(NC, p9); // Then get the Julian Date. double julianDate = gps.julianDate();
- Returns:
- double The Julian Date as a double.
double julianDayNumber | ( | void | ) | [inherited] |
Return the curent day.
// Assuming we have a GPS object previously created... GPS gps(NC, p9); // Then get the Julain Day Number. double julianDayNumber = gps.julianDayNumber();
- Returns:
- double The Julian Date as a double.
double latitude | ( | void | ) | [inherited] |
double longitude | ( | void | ) | [inherited] |
void NmeaOnUart0 | ( | bool | b ) | [inherited] |
Send incoming GPS bytes to Uart0.
Send incoming GPS bytes to Uart0
This can be useful for printing out the bytes from the GPS onto a the common debug port Uart0. Note, Uart0 should have been setup and initialised before switching this on. Also, realistically, you should ensure Uart0 has a higher baud rate than that being used by the GPS. Sending of bytes to Uart0 is "raw" and should only be used to initially gather data and should NOT be used as part of the application design. If you need to forward on the data you should come up with a proper strategy.
- Parameters:
-
b - True to send to Uart0, false otherwise
int numOfSats | ( | void | ) | [inherited] |
void ppsAttach | ( | PinName | irq, |
ppsEdgeType | type = ppsRise |
||
) | [inherited] |
Optionally, connect a 1PPS single to an Mbed pin.
Optional: If the GPS unit has a 1PPS output, use this to connect that to our internal ISR. Using the 1PPS increases the GPS_Time time accuracy from +/-0.25s to +/-0.001s
// Assuming we have a GPS object previously created... GPS gps(NC, p9); gps.ppsAttach(p29); // default to GPS::ppsRise, rising edge. // Or... gps.ppsAttach(p29, GPS::ppsRise ); // The default. // Or... gps.ppsAttach(p29, GPS::ppsFall ); // If a falling edge.
Note, before using this function you should attach an actual callback function using attach_pps()
- See also:
- attach_pps()
- Parameters:
-
irq A PinName to attach type The type of edge, MAX7456::ppsRise OR MAX7456::ppsFall
double siderealDegrees | ( | void | ) | [inherited] |
Get the current sidereal degree angle.
// Assuming we have a GPS object previously created... GPS gps(NC, p9); double sidereal = gps.siderealDegrees();
- Returns:
- double Sidereal degree angle..
double siderealHA | ( | void | ) | [inherited] |
Get the current sidereal hour angle.
// Assuming we have a GPS object previously created... GPS gps(NC, p9); double sidereal = gps.siderealHA();
- Returns:
- double Sidereal degree angle..
GPS_Time* timeNow | ( | void | ) | [inherited] |
Take a snap shot of the current time.
Pass a pointer to a GPS_Time object to get a copy of the current time and date as reported by the GPS.
// Assuming we have a GPS object previously created... GPS gps(NC, p9); // Then get the data... GPS_Time *t = gps.timeNow(); printf("Year = %d", t->year); delete(t); // Avoid memory leaks.
- Returns:
- GPS_Time * The pointer passed in.
Take a snap shot of the current time.
Pass a pointer to a GPS_Time object to get a copy of the current time and date as reported by the GPS.
// Assuming we have a GPS object previously created... GPS gps(NC, p9); // Then get the data... GPS_Time t; gps.timeNow(&t); printf("Year = %d", t.year);
- Returns:
- GPS_Time * The pointer passed in.
GPS_VTG* vtg | ( | void | ) | [inherited] |
Get all vector parameters together.
Get all the vector data at once. For example:-
// Assuming we have a GPS object previously created... GPS gps(NC, p9); // Then get the data... GPS_VTG *p = gps.vtg(); printf("Speed (knots) = %.4f", p->velocity_knots); printf("Speed (kps) = %.4f", p->velocity_kps); printf("Track (true) = %.4f", p->track_true); printf("Track (mag) = %.4f", p->track_mag); delete(p); // then remember to delete the object to prevent memory leaks.
- Returns:
- GPS_Geodetic * A pointer to the data.
Get all vector parameters together.
Pass a pointer to a GPS_VTG object and the current GPS data will be copied into it.
// Assuming we have a GPS object previously created... GPS gps(NC, p9); // Then get the data... GPS_VTG p; gps.vtg(&p); printf("Speed (knots) = %.4f", p.velocity_knots); printf("Speed (kps) = %.4f", p.velocity_kps); printf("Track (true) = %.4f", p.track_true); printf("Track (mag) = %.4f", p.track_mag);
- Parameters:
-
g A GSP_VTG pointer to an existing GPS_VTG object.
- Returns:
- GPS_VTG * The pointer passed in.
Generated on Thu Jul 14 2022 03:46:43 by 1.7.2