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

Dependents:   Hybrid_interruptGPS Hybrid_main_FirstEdtion rocket_logger_sinkan2018_v1 HYBRYD2018_IZU_ROCKET ... more

Committer:
Gaku0606
Date:
Mon Jun 26 08:14:47 2017 +0000
Revision:
8:3f32df2b66c0
Parent:
6:2f91c71d64b1
Child:
9:dab13bd20f43
ggg

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