2017年伊豆大島共同打ち上げ実験用電装モジュール搭載GPS測位プログラム

Dependents:   Hybrid_interruptGPS Hybrid_main_FirstEdtion rocket_logger_sinkan2018_v1 HYBRYD2018_IZU_ROCKET ... more

Committer:
Gaku0606
Date:
Sun Jan 15 20:20:56 2017 +0000
Revision:
5:15ff963f066b
Parent:
4:758f97bee95a
Child:
6:2f91c71d64b1
GPS_interrupt.h ver 1.3.5

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Gaku0606 0:74d8e952a3bd 1 /*=============================================================================
Gaku0606 4:758f97bee95a 2 * GPS_interrupt.lib ver 1.3.5
Gaku0606 0:74d8e952a3bd 3 *
Gaku0606 1:57eeee14dd31 4 * Each palameters are not stable because they can be changed unexpectedly.
Gaku0606 1:57eeee14dd31 5 * Therefor, you should use the funtions which have return value.
Gaku0606 1:57eeee14dd31 6 * Then, you must not substitute any value for those palameters.
Gaku0606 2:7be89bab6db9 7 * なんかコマンドの送信ミスがあるみたいで、確認して次に進めるようにすべきかも
Gaku0606 2:7be89bab6db9 8 * PCソフトで設定して、バックアップ電池付けるのが正確っぽい
Gaku0606 0:74d8e952a3bd 9 *=============================================================================*/
Gaku0606 4:758f97bee95a 10 /**
Gaku0606 4:758f97bee95a 11 * @file GPS_interrupt.h
Gaku0606 5:15ff963f066b 12 * @bref GPSから送られてくるデータをバックグラウンドで解析し、呼び出せるライブラリ
Gaku0606 4:758f97bee95a 13 * @author 松本岳
Gaku0606 4:758f97bee95a 14 * @note ver1.3.5
Gaku0606 4:758f97bee95a 15 */
Gaku0606 4:758f97bee95a 16
Gaku0606 0:74d8e952a3bd 17 #ifndef GPS_INTERRUPT_H_
Gaku0606 0:74d8e952a3bd 18 #define GPS_INTERRUPT_H_
Gaku0606 0:74d8e952a3bd 19
Gaku0606 2:7be89bab6db9 20 #include "mbed.h"//要る?
Gaku0606 0:74d8e952a3bd 21
Gaku0606 0:74d8e952a3bd 22 class GPS_interrupt{
Gaku0606 0:74d8e952a3bd 23
Gaku0606 0:74d8e952a3bd 24 public:
Gaku0606 5:15ff963f066b 25
Gaku0606 5:15ff963f066b 26 /**
Gaku0606 5:15ff963f066b 27 * @bref GPS_interrupt's constructer
Gaku0606 5:15ff963f066b 28 * @param _gps GPSと通信したいRawSerialバスのポインタ
Gaku0606 5:15ff963f066b 29 * @param _frequency GPSから何Hzでデータを取得したいか
Gaku0606 4:758f97bee95a 30 */
Gaku0606 4:758f97bee95a 31 GPS_interrupt(RawSerial *_gps, int _frequency = 10);
Gaku0606 5:15ff963f066b 32
Gaku0606 5:15ff963f066b 33
Gaku0606 0:74d8e952a3bd 34 void initialize();//初期化関数
Gaku0606 0:74d8e952a3bd 35 void gps_auto_receive();
Gaku0606 2:7be89bab6db9 36 bool processGPRMC(char *line);
Gaku0606 2:7be89bab6db9 37 bool processGPGGA(char *line);
Gaku0606 4:758f97bee95a 38 void debug(bool tf);
Gaku0606 2:7be89bab6db9 39 unsigned char checkSum(char *str);
Gaku0606 2:7be89bab6db9 40 void rmc_initialize();
Gaku0606 2:7be89bab6db9 41 void gga_initialize();
Gaku0606 0:74d8e952a3bd 42
Gaku0606 2:7be89bab6db9 43 private://別にpublicにしても良かったけれど、unexpectedlyに変更されるので使えないようにしてやった
Gaku0606 5:15ff963f066b 44 GPS_interrupt* gps_irq;
Gaku0606 2:7be89bab6db9 45 int baudrate;
Gaku0606 2:7be89bab6db9 46 int frequency;
Gaku0606 2:7be89bab6db9 47
Gaku0606 4:758f97bee95a 48 double latitude;
Gaku0606 4:758f97bee95a 49 double longitude;
Gaku0606 4:758f97bee95a 50 int year;
Gaku0606 4:758f97bee95a 51 int month;
Gaku0606 4:758f97bee95a 52 int day;
Gaku0606 4:758f97bee95a 53 int hour;
Gaku0606 4:758f97bee95a 54 int minutes;
Gaku0606 4:758f97bee95a 55 double seconds;
Gaku0606 4:758f97bee95a 56 double knot;
Gaku0606 4:758f97bee95a 57 double degree;
Gaku0606 4:758f97bee95a 58 double height;
Gaku0606 4:758f97bee95a 59 double geoid;
Gaku0606 4:758f97bee95a 60 int number;
Gaku0606 0:74d8e952a3bd 61
Gaku0606 4:758f97bee95a 62 char gps_buffer_A[128];
Gaku0606 4:758f97bee95a 63 char gps_buffer_B[128];
Gaku0606 4:758f97bee95a 64
Gaku0606 4:758f97bee95a 65 bool debugFlag;
Gaku0606 2:7be89bab6db9 66
Gaku0606 2:7be89bab6db9 67 public:
Gaku0606 4:758f97bee95a 68 char *gps_read_buffer;
Gaku0606 4:758f97bee95a 69 bool gps_readable;
Gaku0606 0:74d8e952a3bd 70 private:
Gaku0606 0:74d8e952a3bd 71 RawSerial *gps;
Gaku0606 0:74d8e952a3bd 72 public:
Gaku0606 5:15ff963f066b 73
Gaku0606 5:15ff963f066b 74 /** 経度を返す関数
Gaku0606 5:15ff963f066b 75 * @bref 経度を取得
Gaku0606 4:758f97bee95a 76 * @return double型 経度
Gaku0606 5:15ff963f066b 77 * @note inline展開したつもり
Gaku0606 4:758f97bee95a 78 */
Gaku0606 0:74d8e952a3bd 79 inline double Longitude(){
Gaku0606 0:74d8e952a3bd 80 return longitude;
Gaku0606 0:74d8e952a3bd 81 }
Gaku0606 4:758f97bee95a 82
Gaku0606 5:15ff963f066b 83 /** 緯度を返す関数
Gaku0606 5:15ff963f066b 84 * @bref 緯度を取得
Gaku0606 4:758f97bee95a 85 * @return double型 緯度
Gaku0606 5:15ff963f066b 86 * @note inline展開したつもり
Gaku0606 4:758f97bee95a 87 */
Gaku0606 0:74d8e952a3bd 88 inline double Latitude(){
Gaku0606 0:74d8e952a3bd 89 return latitude;
Gaku0606 0:74d8e952a3bd 90 }
Gaku0606 4:758f97bee95a 91
Gaku0606 5:15ff963f066b 92 /** 年を返す関数
Gaku0606 5:15ff963f066b 93 * @bref 年を取得
Gaku0606 4:758f97bee95a 94 * @return int型 年
Gaku0606 5:15ff963f066b 95 * @note inline展開したつもり
Gaku0606 4:758f97bee95a 96 */
Gaku0606 0:74d8e952a3bd 97 inline int Year(){
Gaku0606 0:74d8e952a3bd 98 return year;
Gaku0606 0:74d8e952a3bd 99 }
Gaku0606 4:758f97bee95a 100
Gaku0606 5:15ff963f066b 101 /** 月を返す関数
Gaku0606 5:15ff963f066b 102 * @bref 月を取得
Gaku0606 4:758f97bee95a 103 * @return int型 月
Gaku0606 5:15ff963f066b 104 * @note inline展開したつもり
Gaku0606 4:758f97bee95a 105 */
Gaku0606 0:74d8e952a3bd 106 inline int Month(){
Gaku0606 0:74d8e952a3bd 107 return month;
Gaku0606 0:74d8e952a3bd 108 }
Gaku0606 4:758f97bee95a 109
Gaku0606 5:15ff963f066b 110 /** 日にちを返す関数
Gaku0606 5:15ff963f066b 111 * @bref 日にちを取得
Gaku0606 4:758f97bee95a 112 * @return int型 日にち
Gaku0606 5:15ff963f066b 113 * @note inline展開したつもり
Gaku0606 4:758f97bee95a 114 */
Gaku0606 0:74d8e952a3bd 115 inline int Day(){
Gaku0606 0:74d8e952a3bd 116 return day;
Gaku0606 0:74d8e952a3bd 117 }
Gaku0606 4:758f97bee95a 118
Gaku0606 5:15ff963f066b 119 /** 時間を返す関数
Gaku0606 5:15ff963f066b 120 * @bref 時間を取得
Gaku0606 4:758f97bee95a 121 * @return int型 時間
Gaku0606 5:15ff963f066b 122 * @note inline展開したつもり
Gaku0606 4:758f97bee95a 123 */
Gaku0606 0:74d8e952a3bd 124 inline int Hour(){
Gaku0606 0:74d8e952a3bd 125 return hour;
Gaku0606 0:74d8e952a3bd 126 }
Gaku0606 4:758f97bee95a 127
Gaku0606 5:15ff963f066b 128 /** 分を返す関数
Gaku0606 5:15ff963f066b 129 * @bref 分を取得
Gaku0606 4:758f97bee95a 130 * @return int型 分
Gaku0606 5:15ff963f066b 131 * @note inline展開したつもり
Gaku0606 4:758f97bee95a 132 */
Gaku0606 0:74d8e952a3bd 133 inline int Minutes(){
Gaku0606 0:74d8e952a3bd 134 return minutes;
Gaku0606 0:74d8e952a3bd 135 }
Gaku0606 4:758f97bee95a 136
Gaku0606 5:15ff963f066b 137 /** 秒を返す関数
Gaku0606 5:15ff963f066b 138 * @bref 秒を取得
Gaku0606 4:758f97bee95a 139 * @return double型 秒
Gaku0606 4:758f97bee95a 140 */
Gaku0606 0:74d8e952a3bd 141 inline double Seconds(){
Gaku0606 0:74d8e952a3bd 142 return seconds;
Gaku0606 0:74d8e952a3bd 143 }
Gaku0606 4:758f97bee95a 144
Gaku0606 5:15ff963f066b 145 /** 経度・緯度を取得できる関数
Gaku0606 5:15ff963f066b 146 * @bref 2つの変数に経度、緯度の順に値を代入する
Gaku0606 5:15ff963f066b 147 * @param lon double型 経度 ポインタ
Gaku0606 5:15ff963f066b 148 * @param lat double型 緯度 ポインタ
Gaku0606 4:758f97bee95a 149 * @return データが有効かどうか 有効ならtrue, 無効ならfalse
Gaku0606 5:15ff963f066b 150 * @note 2つ変数を作って、そのアドレスを引数に与えてください。
Gaku0606 4:758f97bee95a 151 */
Gaku0606 4:758f97bee95a 152 inline bool getPosition(double *lon, double *lat){
Gaku0606 0:74d8e952a3bd 153 *lon = longitude;
Gaku0606 4:758f97bee95a 154 *lat = latitude;
Gaku0606 4:758f97bee95a 155 if(gps_readable) return true;
Gaku0606 4:758f97bee95a 156 else return false;
Gaku0606 0:74d8e952a3bd 157 }
Gaku0606 4:758f97bee95a 158
Gaku0606 5:15ff963f066b 159 /** 経度・緯度を取得できる関数
Gaku0606 5:15ff963f066b 160 * @bref 2つの配列に経度、緯度の順に値を代入する
Gaku0606 5:15ff963f066b 161 * @param lonlat double型 要素2の配列
Gaku0606 4:758f97bee95a 162 * @return データが有効かどうか 有効ならtrue, 無効ならfalse
Gaku0606 5:15ff963f066b 163 * @note 要素2の配列を作って、そのアドレスを引数に与えてください。
Gaku0606 4:758f97bee95a 164 */
Gaku0606 4:758f97bee95a 165 inline bool getPosition(double *lonlat){
Gaku0606 0:74d8e952a3bd 166 lonlat[0] = longitude;
Gaku0606 4:758f97bee95a 167 lonlat[1] = latitude;
Gaku0606 4:758f97bee95a 168 if(gps_readable) return true;
Gaku0606 4:758f97bee95a 169 else return false;
Gaku0606 0:74d8e952a3bd 170 }
Gaku0606 4:758f97bee95a 171
Gaku0606 5:15ff963f066b 172 /** 日付・時刻を取得できる関数
Gaku0606 5:15ff963f066b 173 * @bref 6つの変数に年、月、日、時間、分、秒の順に値を代入する
Gaku0606 5:15ff963f066b 174 * @param _year int型 年 ポインタ
Gaku0606 5:15ff963f066b 175 * @param _month int型 月 ポインタ
Gaku0606 5:15ff963f066b 176 * @param _day int型 日 ポインタ
Gaku0606 5:15ff963f066b 177 * @param _hour int型 時間 ポインタ
Gaku0606 5:15ff963f066b 178 * @param _minutes int型 分 ポインタ
Gaku0606 5:15ff963f066b 179 * @param _seconds double型 秒 ポインタ
Gaku0606 4:758f97bee95a 180 * @return データが有効かどうか 有効ならtrue, 無効ならfalse
Gaku0606 5:15ff963f066b 181 * @note 6つ変数を作って、そのアドレスを引数に与えてください。
Gaku0606 4:758f97bee95a 182 */
Gaku0606 4:758f97bee95a 183 inline bool getUTC(int *_year, int *_month, int *_day, int *_hour, int *_minutes, double *_seconds){
Gaku0606 0:74d8e952a3bd 184 *_year = year;
Gaku0606 0:74d8e952a3bd 185 *_month = month;
Gaku0606 0:74d8e952a3bd 186 *_day = day;
Gaku0606 0:74d8e952a3bd 187 *_hour = hour;
Gaku0606 0:74d8e952a3bd 188 *_minutes = minutes;
Gaku0606 4:758f97bee95a 189 *_seconds = seconds;
Gaku0606 4:758f97bee95a 190 if(gps_readable) return true;
Gaku0606 4:758f97bee95a 191 else return false;
Gaku0606 0:74d8e952a3bd 192 }
Gaku0606 4:758f97bee95a 193
Gaku0606 5:15ff963f066b 194 /** 世界協定時間の日付・時刻を取得できる関数
Gaku0606 5:15ff963f066b 195 * @bref 要素数6の配列に年、月、日、時間、分、秒の順に値を代入する
Gaku0606 4:758f97bee95a 196 * @param (*_utc) float型 秒 アドレス
Gaku0606 4:758f97bee95a 197 * @return データが有効かどうか 有効ならtrue, 無効ならfalse
Gaku0606 4:758f97bee95a 198 * @detail 要素6の配列を作って、そのアドレスを引数に与えてください。
Gaku0606 4:758f97bee95a 199 */
Gaku0606 4:758f97bee95a 200 inline bool getUTC(float *_utc){
Gaku0606 0:74d8e952a3bd 201 _utc[0] = (float)year;
Gaku0606 0:74d8e952a3bd 202 _utc[1] = (float)month;
Gaku0606 0:74d8e952a3bd 203 _utc[2] = (float)day;
Gaku0606 0:74d8e952a3bd 204 _utc[3] = (float)hour;
Gaku0606 0:74d8e952a3bd 205 _utc[4] = (float)minutes;
Gaku0606 0:74d8e952a3bd 206 _utc[5] = seconds;
Gaku0606 4:758f97bee95a 207
Gaku0606 4:758f97bee95a 208 if(gps_readable) return true;
Gaku0606 4:758f97bee95a 209 else return false;
Gaku0606 0:74d8e952a3bd 210 }
Gaku0606 4:758f97bee95a 211
Gaku0606 5:15ff963f066b 212 /** 世界協定時間の日付・時刻を取得できる関数
Gaku0606 5:15ff963f066b 213 * @bref 要素数6の配列に年、月、日、時間、分、秒の順に値を代入する
Gaku0606 5:15ff963f066b 214 * @param _utc int型 秒 ポインタ
Gaku0606 4:758f97bee95a 215 * @return データが有効かどうか 有効ならtrue, 無効ならfalse
Gaku0606 5:15ff963f066b 216 * @note 要素6の配列を作って、そのアドレスを引数に与えてください。
Gaku0606 4:758f97bee95a 217 */
Gaku0606 4:758f97bee95a 218 inline bool getUTC(int *_utc){
Gaku0606 0:74d8e952a3bd 219 _utc[0] = year;
Gaku0606 0:74d8e952a3bd 220 _utc[1] = month;
Gaku0606 0:74d8e952a3bd 221 _utc[2] = day;
Gaku0606 0:74d8e952a3bd 222 _utc[3] = hour;
Gaku0606 0:74d8e952a3bd 223 _utc[4] = minutes;
Gaku0606 0:74d8e952a3bd 224 _utc[5] = (int)seconds;
Gaku0606 4:758f97bee95a 225 if(gps_readable) return true;
Gaku0606 4:758f97bee95a 226 else return false;
Gaku0606 0:74d8e952a3bd 227 }
Gaku0606 4:758f97bee95a 228
Gaku0606 5:15ff963f066b 229 /** 速度・進行方角を取得できる関数
Gaku0606 5:15ff963f066b 230 * @bref 2つの変数に速度、進行方角の順に値を代入する
Gaku0606 5:15ff963f066b 231 * @param _knot double型 経度 ポインタ [knot]
Gaku0606 5:15ff963f066b 232 * @param _degree double型 緯度 ポインタ [degree] 北から右回り正です。
Gaku0606 4:758f97bee95a 233 * @return データが有効かどうか 有効ならtrue, 無効ならfalse
Gaku0606 4:758f97bee95a 234 * @detail 2つ変数を作って、そのアドレスを引数に与えてください。
Gaku0606 4:758f97bee95a 235 */
Gaku0606 4:758f97bee95a 236 inline bool getSpeedVector(double *_knot, double *_degree){
Gaku0606 2:7be89bab6db9 237 *_knot = knot;
Gaku0606 2:7be89bab6db9 238 *_degree = degree;
Gaku0606 4:758f97bee95a 239 if(gps_readable) return true;
Gaku0606 4:758f97bee95a 240 else return false;
Gaku0606 2:7be89bab6db9 241 }
Gaku0606 4:758f97bee95a 242
Gaku0606 5:15ff963f066b 243 /** 捕捉衛星数を取得できる関数
Gaku0606 5:15ff963f066b 244 * @bref 捕捉衛星数を返します。
Gaku0606 4:758f97bee95a 245 * @return int型 捕捉衛星数 アドレス
Gaku0606 4:758f97bee95a 246 */
Gaku0606 2:7be89bab6db9 247 inline int Number(){
Gaku0606 2:7be89bab6db9 248 return number;
Gaku0606 2:7be89bab6db9 249 }
Gaku0606 4:758f97bee95a 250
Gaku0606 5:15ff963f066b 251 /** 標高を取得できる関数
Gaku0606 5:15ff963f066b 252 * @bref 標高を返します。
Gaku0606 4:758f97bee95a 253 * @return double型 標高 アドレス
Gaku0606 4:758f97bee95a 254 */
Gaku0606 2:7be89bab6db9 255 inline double Height(){
Gaku0606 2:7be89bab6db9 256 return height;
Gaku0606 2:7be89bab6db9 257 }
Gaku0606 4:758f97bee95a 258
Gaku0606 4:758f97bee95a 259
Gaku0606 5:15ff963f066b 260 /** 速さを取得できる関数
Gaku0606 5:15ff963f066b 261 * @bref 速さを返します。
Gaku0606 4:758f97bee95a 262 * @return double型 速さ アドレス[knot]
Gaku0606 4:758f97bee95a 263 */
Gaku0606 2:7be89bab6db9 264 inline double Knot(){
Gaku0606 2:7be89bab6db9 265 return knot;
Gaku0606 2:7be89bab6db9 266 }
Gaku0606 4:758f97bee95a 267
Gaku0606 4:758f97bee95a 268
Gaku0606 5:15ff963f066b 269 /** 進行方角を取得できる関数
Gaku0606 5:15ff963f066b 270 * @bref 進行方角を返します。
Gaku0606 4:758f97bee95a 271 * @return double型 進行方角 アドレス 北から右回り正です。
Gaku0606 4:758f97bee95a 272 */
Gaku0606 2:7be89bab6db9 273 inline double Degree(){
Gaku0606 2:7be89bab6db9 274 return degree;
Gaku0606 2:7be89bab6db9 275 }
Gaku0606 0:74d8e952a3bd 276 };
Gaku0606 1:57eeee14dd31 277 /////////////////
Gaku0606 1:57eeee14dd31 278 /////sample//////
Gaku0606 1:57eeee14dd31 279 /////////////////
Gaku0606 1:57eeee14dd31 280 /*
Gaku0606 4:758f97bee95a 281 @code
Gaku0606 1:57eeee14dd31 282 #include "mbed.h"
Gaku0606 1:57eeee14dd31 283 #include "GPS_interrupt.h"
Gaku0606 1:57eeee14dd31 284 Serial pc(USBTX, USBRX);
Gaku0606 1:57eeee14dd31 285 RawSerial mygps(p9, p10);
Gaku0606 0:74d8e952a3bd 286
Gaku0606 2:7be89bab6db9 287 GPS_interrupt gps(&mygps, 115200, 10, 115200);
Gaku0606 2:7be89bab6db9 288
Gaku0606 2:7be89bab6db9 289 void bootFunction(){//do not need
Gaku0606 2:7be89bab6db9 290 pc.printf("\r\n");
Gaku0606 2:7be89bab6db9 291 pc.printf("start LPC1768 boot phase\r\n");
Gaku0606 2:7be89bab6db9 292 wait(0.5);
Gaku0606 2:7be89bab6db9 293 for(int i = 0;i < 100;i++){
Gaku0606 2:7be89bab6db9 294 pc.printf("Loading... : %3d [%%]\r", i);
Gaku0606 2:7be89bab6db9 295 wait(0.025);
Gaku0606 2:7be89bab6db9 296 }
Gaku0606 2:7be89bab6db9 297 pc.printf("Loading... : %3d [%%]\r\n", 100);
Gaku0606 2:7be89bab6db9 298 pc.printf("\t-> finished!!\r\n");
Gaku0606 2:7be89bab6db9 299 pc.printf("System : %d Hz\r\n", SystemCoreClock );
Gaku0606 2:7be89bab6db9 300 wait(0.5);
Gaku0606 2:7be89bab6db9 301 pc.printf("start main program\r\n");
Gaku0606 2:7be89bab6db9 302 wait(0.1);
Gaku0606 2:7be89bab6db9 303 pc.printf("initialize");
Gaku0606 2:7be89bab6db9 304 wait(0.75);
Gaku0606 2:7be89bab6db9 305 pc.printf(" -> OK\r\n");
Gaku0606 2:7be89bab6db9 306 wait(0.1);
Gaku0606 2:7be89bab6db9 307 pc.printf("GPS Connecting");
Gaku0606 2:7be89bab6db9 308 wait(0.5);
Gaku0606 2:7be89bab6db9 309 pc.printf(".");
Gaku0606 2:7be89bab6db9 310 wait(0.5);
Gaku0606 2:7be89bab6db9 311 pc.printf(".");
Gaku0606 2:7be89bab6db9 312 wait(0.5);
Gaku0606 2:7be89bab6db9 313 pc.printf(".");
Gaku0606 2:7be89bab6db9 314 wait(0.5);
Gaku0606 2:7be89bab6db9 315 pc.printf(".");
Gaku0606 2:7be89bab6db9 316 wait(0.5);
Gaku0606 2:7be89bab6db9 317 pc.printf(".");
Gaku0606 2:7be89bab6db9 318 wait(0.5);
Gaku0606 2:7be89bab6db9 319 pc.printf(".");
Gaku0606 2:7be89bab6db9 320 wait(0.5);
Gaku0606 2:7be89bab6db9 321 while(1){
Gaku0606 2:7be89bab6db9 322 if(gps.gps_readable) break;
Gaku0606 2:7be89bab6db9 323 }
Gaku0606 2:7be89bab6db9 324 pc.printf(" -> OK\r\n");
Gaku0606 2:7be89bab6db9 325 pc.printf("start!!\r\n\r\n");
Gaku0606 2:7be89bab6db9 326 wait(0.5);
Gaku0606 2:7be89bab6db9 327 }
Gaku0606 1:57eeee14dd31 328
Gaku0606 1:57eeee14dd31 329 int main() {
Gaku0606 1:57eeee14dd31 330
Gaku0606 1:57eeee14dd31 331 pc.baud(115200);
Gaku0606 2:7be89bab6db9 332 //mygps.baud(9600);
Gaku0606 1:57eeee14dd31 333
Gaku0606 2:7be89bab6db9 334 bootFunction();
Gaku0606 1:57eeee14dd31 335
Gaku0606 1:57eeee14dd31 336 while(1){
Gaku0606 2:7be89bab6db9 337 double xy[2] = {0};
Gaku0606 2:7be89bab6db9 338 float utc[6] = {0};
Gaku0606 2:7be89bab6db9 339 gps.getPosition(xy);
Gaku0606 2:7be89bab6db9 340 gps.getUTC(utc);
Gaku0606 2:7be89bab6db9 341 pc.printf("\033[K");
Gaku0606 2:7be89bab6db9 342 pc.printf("%d/%d/%d %d:%d:%02.2f ",(int)utc[0],(int)utc[1], (int)utc[2], (int)utc[3], (int)utc[4] ,utc[5]);
Gaku0606 2:7be89bab6db9 343 pc.printf("(%3.7fe,%3.7fn) ",xy[0], xy[1]);
Gaku0606 2:7be89bab6db9 344 pc.printf("%d satellites, %.2f[m], %.3f[m/s], %3.2f[degree]\r", gps.Number(), gps.Height(), gps.Knot()*1852/3600, gps.Degree());
Gaku0606 2:7be89bab6db9 345 wait(0.1);
Gaku0606 1:57eeee14dd31 346 }
Gaku0606 1:57eeee14dd31 347 }
Gaku0606 4:758f97bee95a 348 @codeend
Gaku0606 1:57eeee14dd31 349 */
Gaku0606 0:74d8e952a3bd 350 #endif