AA
Dependents: coen490_controller_
Fork of gps_settings_venus by
gps_stg_venus.cpp@0:d80196ed93bc, 2013-11-09 (annotated)
- Committer:
- sssrc_frsh2013
- Date:
- Sat Nov 09 12:07:43 2013 +0000
- Revision:
- 0:d80196ed93bc
- Child:
- 1:eafd1873083c
initial release;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sssrc_frsh2013 | 0:d80196ed93bc | 1 | #include "gps_stg_venus.h" |
sssrc_frsh2013 | 0:d80196ed93bc | 2 | GPSVenus::GPSVenus(Serial & GPSPort_) :GPSPort(GPSPort_){ |
sssrc_frsh2013 | 0:d80196ed93bc | 3 | GPSPort_.baud(9600); |
sssrc_frsh2013 | 0:d80196ed93bc | 4 | } |
sssrc_frsh2013 | 0:d80196ed93bc | 5 | |
sssrc_frsh2013 | 0:d80196ed93bc | 6 | void GPSVenus::setBaud_115200() |
sssrc_frsh2013 | 0:d80196ed93bc | 7 | { |
sssrc_frsh2013 | 0:d80196ed93bc | 8 | // VENUS Binary MsgID=0x05 |
sssrc_frsh2013 | 0:d80196ed93bc | 9 | |
sssrc_frsh2013 | 0:d80196ed93bc | 10 | char msg[11] = { 0xA0, 0xA1, 0x00, 0x04, |
sssrc_frsh2013 | 0:d80196ed93bc | 11 | 0x05, 0x00, 0x05, 0, |
sssrc_frsh2013 | 0:d80196ed93bc | 12 | 0, 0x0D, 0x0A }; |
sssrc_frsh2013 | 0:d80196ed93bc | 13 | for (int i=4; i < 8; i++) { |
sssrc_frsh2013 | 0:d80196ed93bc | 14 | msg[8] ^= msg[i]; |
sssrc_frsh2013 | 0:d80196ed93bc | 15 | } |
sssrc_frsh2013 | 0:d80196ed93bc | 16 | for (int i=0; i < 11; i++) |
sssrc_frsh2013 | 0:d80196ed93bc | 17 | GPSPort.putc(msg[i]); |
sssrc_frsh2013 | 0:d80196ed93bc | 18 | } |
sssrc_frsh2013 | 0:d80196ed93bc | 19 | |
sssrc_frsh2013 | 0:d80196ed93bc | 20 | void GPSVenus::setNmeaMessages(bool gga, bool gsa, bool gsv, bool gll, bool rmc, bool vtg) |
sssrc_frsh2013 | 0:d80196ed93bc | 21 | { |
sssrc_frsh2013 | 0:d80196ed93bc | 22 | // VENUS Binary MsgID=0x08 |
sssrc_frsh2013 | 0:d80196ed93bc | 23 | // GGA interval |
sssrc_frsh2013 | 0:d80196ed93bc | 24 | // GSA interval |
sssrc_frsh2013 | 0:d80196ed93bc | 25 | // GSV interval |
sssrc_frsh2013 | 0:d80196ed93bc | 26 | // GLL interval |
sssrc_frsh2013 | 0:d80196ed93bc | 27 | // RMC interval |
sssrc_frsh2013 | 0:d80196ed93bc | 28 | // VTG interval |
sssrc_frsh2013 | 0:d80196ed93bc | 29 | // ZDA interval -- hardcode off |
sssrc_frsh2013 | 0:d80196ed93bc | 30 | char msg[16] = { 0xA0, 0xA1, 0x00, 0x09, |
sssrc_frsh2013 | 0:d80196ed93bc | 31 | 0x08, gga, gsa, gsv, gll, rmc, vtg, 0, 0, |
sssrc_frsh2013 | 0:d80196ed93bc | 32 | 0, 0x0D, 0x0A }; |
sssrc_frsh2013 | 0:d80196ed93bc | 33 | for (int i=4; i < 13; i++) { |
sssrc_frsh2013 | 0:d80196ed93bc | 34 | msg[13] ^= msg[i]; |
sssrc_frsh2013 | 0:d80196ed93bc | 35 | } |
sssrc_frsh2013 | 0:d80196ed93bc | 36 | for (int i=0; i < 16; i++) |
sssrc_frsh2013 | 0:d80196ed93bc | 37 | GPSPort.putc(msg[i]); |
sssrc_frsh2013 | 0:d80196ed93bc | 38 | } |
sssrc_frsh2013 | 0:d80196ed93bc | 39 | |
sssrc_frsh2013 | 0:d80196ed93bc | 40 | |
sssrc_frsh2013 | 0:d80196ed93bc | 41 | void GPSVenus::setUpdateRate(int rate) |
sssrc_frsh2013 | 0:d80196ed93bc | 42 | { |
sssrc_frsh2013 | 0:d80196ed93bc | 43 | char msg[10] = { 0xA0, 0xA1, 0x00, 0x03, |
sssrc_frsh2013 | 0:d80196ed93bc | 44 | 0x0E, rate&0xFF, 01, |
sssrc_frsh2013 | 0:d80196ed93bc | 45 | 0, 0x0D, 0x0A }; |
sssrc_frsh2013 | 0:d80196ed93bc | 46 | for (int i=4; i < 7; i++) { |
sssrc_frsh2013 | 0:d80196ed93bc | 47 | msg[7] ^= msg[i]; |
sssrc_frsh2013 | 0:d80196ed93bc | 48 | } |
sssrc_frsh2013 | 0:d80196ed93bc | 49 | switch (rate) { |
sssrc_frsh2013 | 0:d80196ed93bc | 50 | case 1 : |
sssrc_frsh2013 | 0:d80196ed93bc | 51 | case 2 : |
sssrc_frsh2013 | 0:d80196ed93bc | 52 | case 4 : |
sssrc_frsh2013 | 0:d80196ed93bc | 53 | case 5 : |
sssrc_frsh2013 | 0:d80196ed93bc | 54 | case 8 : |
sssrc_frsh2013 | 0:d80196ed93bc | 55 | case 10 : |
sssrc_frsh2013 | 0:d80196ed93bc | 56 | case 20 : |
sssrc_frsh2013 | 0:d80196ed93bc | 57 | for (int i=0; i < 10; i++) |
sssrc_frsh2013 | 0:d80196ed93bc | 58 | GPSPort.putc(msg[i]); |
sssrc_frsh2013 | 0:d80196ed93bc | 59 | break; |
sssrc_frsh2013 | 0:d80196ed93bc | 60 | default : |
sssrc_frsh2013 | 0:d80196ed93bc | 61 | break; |
sssrc_frsh2013 | 0:d80196ed93bc | 62 | } |
sssrc_frsh2013 | 0:d80196ed93bc | 63 | } |
sssrc_frsh2013 | 0:d80196ed93bc | 64 |