GPS NEMA String parser library. Only supports SkyTraq Venus chip at this time.
Dependents: MTDOT-EVB-LinkCheck-AL MTDOT-BOX-EVB-Factory-Firmware-LIB-108 TelitSensorToCloud mDot_sensor_to_cloud ... more
Revision 6:2050b4795b66, committed 2015-12-04
- Comitter:
- Mike Fiore
- Date:
- Fri Dec 04 16:40:41 2015 -0600
- Parent:
- 5:11f41dee386b
- Child:
- 7:bd1013ba8afd
- Commit message:
- accept NCP5623B led controller as optional parameter - blink led_3 when not locked, keep solid when locked
Changed in this revision
| GPSPARSER.cpp | Show annotated file Show diff for this revision Revisions of this file |
| GPSPARSER.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/GPSPARSER.cpp Mon Nov 09 12:36:04 2015 -0600
+++ b/GPSPARSER.cpp Fri Dec 04 16:40:41 2015 -0600
@@ -31,8 +31,10 @@
using namespace mts;
-GPSPARSER::GPSPARSER(MTSSerial *uart)
- : _getSentenceThread(&GPSPARSER::startSentenceThread,this)
+GPSPARSER::GPSPARSER(MTSSerial *uart, NCP5623B* led)
+ : _getSentenceThread(&GPSPARSER::startSentenceThread,this),
+ _led(led),
+ _led_state(0)
{
_gps_uart = uart;
_gps_uart->baud(9600); //set GPS baud rate here
@@ -57,6 +59,7 @@
if (GPSPARSER::initGps() == 0) {
_gps_detected = true;
_getSentenceThread.signal_set(START_THREAD);
+ _led_timer.start();
printf("Started Nema Sentence Thread\r\n");
} else {
printf("No GPS detected\r\n");
@@ -203,6 +206,16 @@
printf("RX empty before all data read\r\n");
}
+ if (_led) {
+ if (_fix_status >= 2) {
+ _led->setPWM(NCP5623B::LED_3, 8);
+ } else if (_led_timer.read_ms() > 1000) {
+ _led_timer.reset();
+ _led_state = (_led_state == 0) ? 8 : 0;
+ _led->setPWM(NCP5623B::LED_3, _led_state);
+ }
+ }
+
osDelay(100);
} while(true);
@@ -414,3 +427,4 @@
{
return _msl_altitude;
}
+
--- a/GPSPARSER.h Mon Nov 09 12:36:04 2015 -0600
+++ b/GPSPARSER.h Fri Dec 04 16:40:41 2015 -0600
@@ -29,6 +29,7 @@
#include "mbed.h"
#include "rtos.h"
#include "MTSSerial.h"
+#include "NCP5623B.h"
#include <string>
#include <vector>
#include <ctime>
@@ -68,8 +69,9 @@
/** Create the GPSPARSER object
* @param uart - an MTSSerial object
+ * @param led - an NCP5623B led controller object
*/
- GPSPARSER(MTSSerial *uart);
+ GPSPARSER(MTSSerial *uart, NCP5623B* led = NULL);
/** destroy the GPSPARSER object
*/
@@ -149,6 +151,9 @@
MTSSerial *_gps_uart;
Thread _getSentenceThread;
+ NCP5623B* _led;
+ int8_t _led_state;
+ Timer _led_timer;
/** Detect and initialize GPS device
* @return status of initialization