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

Dependents:   Hybrid_interruptGPS Hybrid_main_FirstEdtion rocket_logger_sinkan2018_v1 HYBRYD2018_IZU_ROCKET ... more

Committer:
Gaku0606
Date:
Sat Nov 25 07:00:51 2017 +0000
Revision:
11:1897b52fa8a1
Parent:
10:a006445dc76d
Child:
12:935b21d30ec2
aaaa

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