summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2013-08-17 17:40:33 +0200
committerKeith Packard <keithp@keithp.com>2013-08-17 17:40:33 +0200
commit9a22a300009679a14d66214a5d61e9e6a177279f (patch)
tree500189fe2b13c080c1e320f4bdaaffaf01dcdddf
parente0a0a747624c2df66ca4a73b5a0de014ea204dca (diff)
altos: Allow ublox to run at other baud rates
Provides a configuration option to set the ublox serial baud rate to something other than 57600 baud Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--src/drivers/ao_gps_ublox.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/drivers/ao_gps_ublox.c b/src/drivers/ao_gps_ublox.c
index 80869561..fa6ff0e0 100644
--- a/src/drivers/ao_gps_ublox.c
+++ b/src/drivers/ao_gps_ublox.c
@@ -26,11 +26,21 @@ __pdata uint16_t ao_gps_tick;
__xdata struct ao_telemetry_location ao_gps_data;
__xdata struct ao_telemetry_satellite ao_gps_tracking_data;
-static const char ao_gps_set_nmea[] = "\r\n$PUBX,41,1,3,1,57600,0*2d\r\n";
+#ifndef AO_SERIAL_SPEED_UBLOX
+#define AO_SERIAL_SPEED_UBLOX AO_SERIAL_SPEED_57600
+#endif
-const char ao_gps_config[] = {
+#if AO_SERIAL_SPEED_UBLOX == AO_SERIAL_SPEED_57600
+#define SERIAL_SPEED_STRING "57600"
+#endif
+#if AO_SERIAL_SPEED_UBLOX == AO_SERIAL_SPEED_19200
+#define SERIAL_SPEED_STRING "19200"
+#endif
+#if AO_SERIAL_SPEED_UBLOX == AO_SERIAL_SPEED_9600
+#define SERIAL_SPEED_STRING "9600"
+#endif
-};
+static const char ao_gps_set_nmea[] = "\r\n$PUBX,41,1,3,1," SERIAL_SPEED_STRING ",0*2d\r\n";
struct ao_ublox_cksum {
uint8_t a, b;
@@ -419,10 +429,12 @@ ao_gps_setup(void)
for (i = 0; i < sizeof (ao_gps_set_nmea); i++)
ao_gps_putchar(ao_gps_set_nmea[i]);
+#if AO_SERIAL_SPEED_UBLOX != AO_SERIAL_SPEED_9600
/*
* Increase the baud rate
*/
- ao_gps_set_speed(AO_SERIAL_SPEED_57600);
+ ao_gps_set_speed(AO_SERIAL_SPEED_UBLOX);
+#endif
/*
* Pad with nulls to give the chip