Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of gnss by
Diff: gnss.cpp
- Revision:
- 2:b10ca4aa2e5e
- Parent:
- 1:ef70a58a6c98
- Child:
- 3:2a1cd49ead85
--- a/gnss.cpp Mon Apr 10 11:28:24 2017 +0100 +++ b/gnss.cpp Thu Apr 13 14:45:17 2017 +0000 @@ -26,17 +26,29 @@ GnssParser::GnssParser(void) { // Create the power pins but set everything to disabled + _gnssPower = NULL; + _gnssEnable = NULL; + +#if defined GNSSPWR && defined TARGET_UBLOX_C030 /* TODO */ _gnssPower = new DigitalInOut(GNSSPWR, PIN_OUTPUT, OpenDrain, 0); +#endif +#if defined GNSSEN && defined TARGET_UBLOX_C030 /* TODO */ _gnssEnable = new DigitalInOut(GNSSEN, PIN_OUTPUT, PushPullNoPull, 0); +#endif } GnssParser::~GnssParser(void) { // Set the power pins to lowest power state before ending - *_gnssPower = 0; - *_gnssEnable = 0; - delete _gnssPower; - delete _gnssEnable; + if (_gnssPower != NULL) { + *_gnssPower = 0; + delete _gnssPower; + } + + if (_gnssEnable != NULL) { + *_gnssEnable = 0; + delete _gnssEnable; + } } void GnssParser::powerOff(void) @@ -49,9 +61,13 @@ void GnssParser::_powerOn(void) { // Power up and enable the module - *_gnssPower = 1; + if (_gnssPower != NULL) { + *_gnssPower = 1; + } wait_ms (1); - *_gnssEnable = 1; + if (_gnssEnable != NULL) { + *_gnssEnable = 1; + } wait_ms (1); }