Nikola Milenic / GPSM
Revision:
3:467dee159d16
Parent:
2:32c97cf5c676
Child:
4:61f6f5ae0f8c
--- 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) {