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.
Diff: GPSM.cpp
- Revision:
- 3:467dee159d16
- Parent:
- 2:32c97cf5c676
- Child:
- 4:61f6f5ae0f8c
diff -r 32c97cf5c676 -r 467dee159d16 GPSM.cpp
--- a/GPSM.cpp Tue Dec 04 16:19:41 2018 +0000
+++ b/GPSM.cpp Thu Dec 13 20:29:18 2018 +0000
@@ -47,6 +47,53 @@
wait(1.0);
_gps->attach(callback(GPSM::rx_interrupt));
}
+
+
+#ifdef OPEN_LOG
+void GPSM::start_log()
+{
+ is_logging = true;
+}
+
+void GPSM::new_file(void)
+{
+ _openLog->newFile();
+}
+
+void GPSM::stop_log(void)
+{
+ is_logging = false;
+}
+#endif
+
+float GPSM::nmea_to_dec(float deg_coord, char nsew)
+{
+ int degree = (int)(deg_coord/100);
+ float minutes = deg_coord - degree*100;
+ float dec_deg = minutes / 60;
+ float decimal = degree + dec_deg;
+ if (nsew == 'S' || nsew == 'W') { // return negative
+ decimal *= -1;
+ }
+ return decimal;
+}
+
+int GPSM::poll()
+{
+ if (!ready) return NOT_READY;
+#ifdef OPEN_LOG
+ if (is_logging && lock) {
+ format_for_log();
+ _openLog->write(bfr);
+ }
+#endif
+ ready=false;
+ if (lock) return GOOD;
+ else return NO_LOCK;
+}
+
+
+// INTERNAL FUNCTINS ////////////////////////////////////////////////////////////
void GPSM::rx_interrupt()
{
if(msg_ind < 0) {
@@ -174,51 +221,6 @@
_gps->putc(0x6A);
}
-#ifdef OPEN_LOG
-void GPSM::start_log()
-{
- is_logging = true;
-}
-
-void GPSM::new_file(void)
-{
- _openLog->newFile();
-}
-
-void GPSM::stop_log(void)
-{
- is_logging = false;
-}
-#endif
-
-float GPSM::nmea_to_dec(float deg_coord, char nsew)
-{
- int degree = (int)(deg_coord/100);
- float minutes = deg_coord - degree*100;
- float dec_deg = minutes / 60;
- float decimal = degree + dec_deg;
- if (nsew == 'S' || nsew == 'W') { // return negative
- decimal *= -1;
- }
- return decimal;
-}
-
-int GPSM::poll()
-{
- if (!ready) return NOT_READY;
-#ifdef OPEN_LOG
- if (is_logging && lock) {
- format_for_log();
- _openLog->write(bfr);
- }
-#endif
- ready=false;
- if (lock) return GOOD;
- else return NO_LOCK;
-}
-
-
-// INTERNAL FUNCTINS ////////////////////////////////////////////////////////////
float GPSM::trunc(float v)
{
if (v < 0.0) {