This class provides an API to communicate with a u-blox GNSS chip. The files here were originally part of the C027_Support library (https://developer.mbed.org/teams/ublox/code/C027_Support/ at revision 138:dafbbf31bf76) but have been separated out, primarily for use on the u-blox C030 board where the cellular interace portion of the C027_Support library will instead be provided through the new mbed Cellular API.
Dependents: example-ublox-at-cellular-interface-ext example-low-power-sleep example-C030-out-of-box-demo example-C030-out-of-box-demo ... more
Diff: gnss_operations.cpp
- Revision:
- 20:bc678f383db1
- Parent:
- 19:119e7c15ff97
- Child:
- 21:f91c0334d017
diff -r 119e7c15ff97 -r bc678f383db1 gnss_operations.cpp --- a/gnss_operations.cpp Fri Oct 05 17:28:16 2018 +0500 +++ b/gnss_operations.cpp Fri Oct 05 18:46:48 2018 +0500 @@ -358,6 +358,7 @@ length = GnssSerial::sendUbx(0x06, 0x3B, semi_continuous_pm2, sizeof(semi_continuous_pm2)); wait(1); length = GnssSerial::sendUbx(0x06, 0x08, semi_continuous_rate, sizeof(semi_continuous_rate)); + wait(1); break; case AGGRESSIVE_CONTINUOS: @@ -367,6 +368,7 @@ length = GnssSerial::sendUbx(0x06, 0x3B, aggresive_continuous_pm2, sizeof(aggresive_continuous_pm2)); wait(1); length = GnssSerial::sendUbx(0x06, 0x08, aggressive_continuous_rate, sizeof(aggressive_continuous_rate)); + wait(1); break; case CONSERVATIVE_CONTINOUS: @@ -376,6 +378,7 @@ length = GnssSerial::sendUbx(0x06, 0x3B, conservative_continuous_pm2, sizeof(conservative_continuous_pm2)); wait(1); length = GnssSerial::sendUbx(0x06, 0x08, conservative_continuous_rate, sizeof(conservative_continuous_rate)); + wait(1); break; case FULL_POWER: @@ -383,23 +386,49 @@ length = GnssSerial::sendUbx(0x06, 0x86, full_power_pms, sizeof(full_power_pms)); wait(1); length = GnssSerial::sendUbx(0x06, 0x08, full_power_rate, sizeof(full_power_rate)); + wait(1); break; case FULL_POWER_BLOCK_LEVEL: SEND_LOGGING_MESSAGE("Configuring FULL_POWER_BLOCK_LEVEL"); length = GnssSerial::sendUbx(0x06, 0x86, full_power_block_level_pms, sizeof(full_power_block_level_pms)); wait(1); length = GnssSerial::sendUbx(0x06, 0x08, full_power_block_level_rate, sizeof(full_power_block_level_rate)); + wait(1); break; case FULL_POWER_BUILDING_LEVEL: SEND_LOGGING_MESSAGE("Configuring FULL_POWER_BUILDING_LEVEL"); length = GnssSerial::sendUbx(0x06, 0x86, full_power_building_level_pms, sizeof(full_power_building_level_pms)); wait(1); length = GnssSerial::sendUbx(0x06, 0x08, full_power_building_level_rate, sizeof(full_power_building_level_rate)); + wait(1); break; } + return (length >= (int)(sizeof(semi_continuous_pms) + UBX_FRAME_SIZE)) ? 1 : 0; } +bool GnssOperations::verify_gnss_mode() { + + unsigned char CFG_PMS[] = {0xB5, 0x62, 0x06, 0x86, 0x00, 0x00, 0x8c, 0xAA}; + unsigned char CFG_PM2[] = {0xB5, 0x62, 0x06, 0x3B, 0x00, 0x00, 0x41, 0xC9}; + unsigned char CFG_RATE[] = {0xB5, 0x62, 0x06, 0x08, 0x00, 0x00, 0x0E, 0x30}; + unsigned char CFG_NAV5[] = {0xB5, 0x62, 0x06, 0x24, 0x00, 0x00, 0x2A, 0x84}; + + this->_send(CFG_PMS, sizeof(CFG_PMS)); + wait(1); + + this->_send(CFG_PM2, sizeof(CFG_PM2)); + wait(1); + + this->_send(CFG_RATE, sizeof(CFG_RATE)); + wait(1); + + this->_send(CFG_NAV5, sizeof(CFG_NAV5)); + wait(1); + + return true; +} + /** * GNSS start modes (Hot/Warm/Cold start) *