Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed Watchdog SDFileSystem DigoleSerialDisp
Ublox6.h
00001 #ifndef __UBLOX6_H 00002 #define __UBLOX6_H 00003 00004 /** 00005 * uBlox UBX Protocol Reader - Wayne Holder 00006 * Ported to mbed - Michael Shimniok 00007 * 00008 * Note: RX pad on 3DR Module is output, TX is input 00009 */ 00010 #include "mbed.h" 00011 #include "GPS.h" 00012 00013 #define MAX_LENGTH 512 00014 00015 #define SYNC1 0xB5 00016 #define SYNC2 0x62 00017 #define POSLLH_MSG 0x02 00018 #define SBAS_MSG 0x32 00019 #define VELNED_MSG 0x12 00020 #define STATUS_MSG 0x03 00021 #define SOL_MSG 0x06 00022 #define DOP_MSG 0x04 00023 #define DGPS_MSG 0x31 00024 #define SVINFO_MSG 0x30 00025 00026 #define CFG 0x06 00027 #define NAV 0x01 00028 00029 #define MSG 0x01 00030 00031 #define LONG(X) *(int32_t *)(&data[X]) 00032 #define ULONG(X) *(uint32_t *)(&data[X]) 00033 #define INT(X) *(int16_t *)(&data[X]) 00034 #define UINT(X) *(uint16_t *)(&data[X]) 00035 00036 class Ublox6: public GPS { 00037 public: 00038 /** 00039 * create a new interface for Ublox6 00040 */ 00041 Ublox6(PinName rx, PinName tx); 00042 00043 /** 00044 * Initalize everything necessary for the GPS to collect the required data 00045 */ 00046 virtual void init(void); 00047 00048 /** 00049 * Set baud rate 00050 */ 00051 virtual void setBaud(int baud); 00052 00053 /** 00054 * return serial object 00055 */ 00056 virtual Serial *getSerial(void); 00057 00058 /** 00059 * Disable serial data collection 00060 */ 00061 virtual void disable(void); 00062 00063 /** 00064 * Enable serial data collection 00065 */ 00066 virtual void enable(void); 00067 00068 /** 00069 * Enable verbose messages for debugging 00070 */ 00071 virtual void enableVerbose(void); 00072 00073 /** 00074 * Disable verbose messages for debugging 00075 */ 00076 virtual void disableVerbose(void); 00077 00078 /** 00079 * get latitude 00080 */ 00081 virtual double latitude(void); 00082 00083 /** 00084 * get longitude 00085 */ 00086 virtual double longitude(void); 00087 00088 /** 00089 * Get Horizontal Dilution of Precision 00090 * @return float horizontal dilution of precision 00091 */ 00092 virtual float hdop(void); 00093 00094 /** 00095 * get count of active satellites 00096 */ 00097 virtual int sat_count(void); 00098 00099 /** 00100 * get speed in m/s 00101 */ 00102 virtual float speed_mps(void); 00103 00104 /** 00105 * get heading in degrees 00106 */ 00107 virtual float heading_deg(void); 00108 00109 /** 00110 * determine if data is available to be used 00111 */ 00112 virtual bool available(void); 00113 00114 /** 00115 * reset the data available flag 00116 */ 00117 virtual void reset_available(void); 00118 00119 int getAvailable(void) { return _available; } 00120 00121 void setUpdateRate(int rate) { return; } 00122 00123 private: 00124 /** 00125 * Configure which Nmea messages to enable/disable 00126 */ 00127 void recv_handler(); 00128 00129 /** 00130 * UBX protocol parser (Wayne Holder) 00131 */ 00132 void parse(unsigned char cc); 00133 00134 /** serial object */ 00135 Serial serial; 00136 int _available; // is data available? 00137 float _latitude; // temp storage, latitude 00138 float _longitude; // temp storage, longitude 00139 float _hdop; // horiz dilution of precision 00140 float _course_deg; // course in degrees 00141 float _speed_mps; // speed in m/s 00142 int _sat_count; // satellite count 00143 //unsigned char buf[MAX_LENGTH]; // FIFO buffer for processing UBX 00144 //int in; // buffer input, write to here 00145 //int out; // buffer output, read from here 00146 }; 00147 00148 #endif
Generated on Tue Jul 12 2022 21:36:19 by
 1.7.2
 1.7.2