Library for Skytraq Venus838 GPS

Dependents:   Venus838_Test Atlas

Committer:
ethanharstad
Date:
Tue Jun 24 04:46:31 2014 +0000
Revision:
0:8c7efefad15e
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ethanharstad 0:8c7efefad15e 1 #include "Venus838.h"
ethanharstad 0:8c7efefad15e 2
ethanharstad 0:8c7efefad15e 3 // A0 A1 PL(2b) ID Body CS 0D 0A
ethanharstad 0:8c7efefad15e 4 Venus838::Venus838(PinName tx, PinName rx) : _gps(tx, rx) {
ethanharstad 0:8c7efefad15e 5 _gps.baud(115200);
ethanharstad 0:8c7efefad15e 6 }
ethanharstad 0:8c7efefad15e 7
ethanharstad 0:8c7efefad15e 8 void Venus838::setNmeaMessages(const bool gga, const bool gsa, const bool gsv, const bool gll, const bool rmc, const bool vtg) {
ethanharstad 0:8c7efefad15e 9 char cmd[16] = {
ethanharstad 0:8c7efefad15e 10 0xA0, 0xA1, 0x00, 0x09,
ethanharstad 0:8c7efefad15e 11 0x08, gga, gsa, gsv, gll, rmc, vtg, 0x00, 0x01,
ethanharstad 0:8c7efefad15e 12 0x00, 0x0D, 0x0A
ethanharstad 0:8c7efefad15e 13 };
ethanharstad 0:8c7efefad15e 14 for(int i = 4; i < 13; i++) cmd[13] ^= cmd[i];
ethanharstad 0:8c7efefad15e 15 for(int i = 0; i < 16; i++) _gps.putc(cmd[i]);
ethanharstad 0:8c7efefad15e 16 }
ethanharstad 0:8c7efefad15e 17
ethanharstad 0:8c7efefad15e 18 void Venus838::setUpdateRate(const uint8_t rate) {
ethanharstad 0:8c7efefad15e 19 char cmd[10] = {
ethanharstad 0:8c7efefad15e 20 0xA0, 0xA1, 0x00, 0x03,
ethanharstad 0:8c7efefad15e 21 0x0E, rate, 0x01,
ethanharstad 0:8c7efefad15e 22 0x00, 0x0D, 0x0A
ethanharstad 0:8c7efefad15e 23 };
ethanharstad 0:8c7efefad15e 24 for(int i = 4; i < 7; i++) cmd[7] ^= cmd[i];
ethanharstad 0:8c7efefad15e 25 for(int i = 0; i < 10; i++) _gps.putc(cmd[i]);
ethanharstad 0:8c7efefad15e 26 }
ethanharstad 0:8c7efefad15e 27
ethanharstad 0:8c7efefad15e 28 void Venus838::setNavigationMode(const int mode) {
ethanharstad 0:8c7efefad15e 29 char cmd[] = {
ethanharstad 0:8c7efefad15e 30 0xA0, 0xA1, 0x00, 0x04,
ethanharstad 0:8c7efefad15e 31 0x64, 0x17, 0x04, 0x01,
ethanharstad 0:8c7efefad15e 32 0x00, 0x0D, 0x0A
ethanharstad 0:8c7efefad15e 33 };
ethanharstad 0:8c7efefad15e 34 for(int i = 4; i < 8; i++) cmd[8] ^= cmd[i];
ethanharstad 0:8c7efefad15e 35 for(int i = 0; i < 10; i++) _gps.putc(cmd[i]);
ethanharstad 0:8c7efefad15e 36 }
ethanharstad 0:8c7efefad15e 37
ethanharstad 0:8c7efefad15e 38 bool Venus838::readable() {
ethanharstad 0:8c7efefad15e 39 return _gps.readable();
ethanharstad 0:8c7efefad15e 40 }
ethanharstad 0:8c7efefad15e 41
ethanharstad 0:8c7efefad15e 42 void Venus838::putc(char in) {
ethanharstad 0:8c7efefad15e 43 _gps.putc(in);
ethanharstad 0:8c7efefad15e 44 }
ethanharstad 0:8c7efefad15e 45
ethanharstad 0:8c7efefad15e 46 char Venus838::getc() {
ethanharstad 0:8c7efefad15e 47 return _gps.getc();
ethanharstad 0:8c7efefad15e 48 }