{baud, NMEA} setting functions for venus GPS chip it is just a copy&paste stuff of these code written by shimniok. http://mbed.org/users/shimniok/code/AVC_2012/docs/tip/GPS_8cpp_source.html https://www.sparkfun.com/datasheets/GPS/Modules/AN0003_v1.4.14_FlashOnly.pdf

Dependents:   GPS_setting_Venus_Helloworld gps-fix

Files at this revision

API Documentation at this revision

Comitter:
sssrc_frsh2013
Date:
Sat Nov 09 12:07:43 2013 +0000
Commit message:
initial release;

Changed in this revision

gps_stg_venus.cpp Show annotated file Show diff for this revision Revisions of this file
gps_stg_venus.h Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r d80196ed93bc gps_stg_venus.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gps_stg_venus.cpp	Sat Nov 09 12:07:43 2013 +0000
@@ -0,0 +1,64 @@
+#include "gps_stg_venus.h"
+GPSVenus::GPSVenus(Serial & GPSPort_) :GPSPort(GPSPort_){
+    GPSPort_.baud(9600);
+}
+
+void GPSVenus::setBaud_115200()
+ {
+         // VENUS Binary MsgID=0x05
+         
+         char msg[11] = { 0xA0, 0xA1, 0x00, 0x04, 
+                          0x05, 0x00, 0x05, 0, 
+                          0, 0x0D, 0x0A };
+         for (int i=4; i < 8; i++) {
+             msg[8] ^= msg[i];
+         }
+         for (int i=0; i < 11; i++)
+              GPSPort.putc(msg[i]);
+ }
+
+void GPSVenus::setNmeaMessages(bool gga, bool gsa, bool gsv, bool gll, bool rmc, bool vtg)
+ {
+         // VENUS Binary MsgID=0x08
+         // GGA interval
+         // GSA interval
+         // GSV interval
+         // GLL interval
+         // RMC interval
+         // VTG interval
+         // ZDA interval -- hardcode off
+         char msg[16] = { 0xA0, 0xA1, 0x00, 0x09, 
+                          0x08, gga, gsa, gsv, gll, rmc, vtg, 0, 0,
+                          0, 0x0D, 0x0A };
+         for (int i=4; i < 13; i++) {
+             msg[13] ^= msg[i];
+         }
+         for (int i=0; i < 16; i++)
+              GPSPort.putc(msg[i]);
+}
+ 
+ 
+void GPSVenus::setUpdateRate(int rate)
+ {
+     char msg[10] = { 0xA0, 0xA1, 0x00, 0x03,
+                     0x0E, rate&0xFF, 01,
+                     0, 0x0D, 0x0A };
+     for (int i=4; i < 7; i++) {
+         msg[7] ^= msg[i];
+     }
+     switch (rate) {
+     case 1 :
+     case 2 :
+     case 4 :
+     case 5 :
+     case 8 :
+     case 10 :
+     case 20 :
+         for (int i=0; i < 10; i++)            
+              GPSPort.putc(msg[i]);
+         break;
+     default :
+         break;
+     }
+}
+
diff -r 000000000000 -r d80196ed93bc gps_stg_venus.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gps_stg_venus.h	Sat Nov 09 12:07:43 2013 +0000
@@ -0,0 +1,13 @@
+#include "mbed.h"
+
+class GPSVenus {
+public:
+    GPSVenus(Serial & GPSPort_);
+    void setBaud_115200();
+    void setNmeaMessages(bool gga, bool gsa, bool gsv, bool gll, bool rmc, bool vtg);
+    void setUpdateRate(int rate);
+private:
+    Serial & GPSPort;
+};
+
+