summaryrefslogtreecommitdiff
path: root/src/ao_gps.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2009-07-17 21:34:13 -0700
committerKeith Packard <keithp@keithp.com>2009-07-17 21:34:13 -0700
commit2a7956a64935246475f92d44c08369e0230b676a (patch)
tree9f90e8c9a836889359431576c99dafbe0fa5255b /src/ao_gps.c
parent8d650769c319261c97f5e68eff9138207b95c0f8 (diff)
Allow the GPS port to run at 4800 baud if desired
Diffstat (limited to 'src/ao_gps.c')
-rw-r--r--src/ao_gps.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/ao_gps.c b/src/ao_gps.c
index 1ce738b1..e793de51 100644
--- a/src/ao_gps.c
+++ b/src/ao_gps.c
@@ -22,7 +22,13 @@
__xdata uint8_t ao_gps_mutex;
__xdata struct ao_gps_data ao_gps_data;
-static const char ao_gps_set_nmea[] = "$PSRF100,0,57600,8,1,0*37\r\n";
+#undef AO_GPS_4800
+
+#ifdef AO_GPS_4800
+static const char ao_gps_set_nmea[] = "\r\n$PSRF100,0,57600,8,1,0*37\r\n\r\n";
+#else
+static const char ao_gps_set_nmea[] = "\r\n$PSRF100,0,4800,8,1,0*0F\r\n\r\n";
+#endif
const char ao_gps_config[] = {
0xa0, 0xa2, 0x00, 0x0e, /* length: 14 bytes */
@@ -224,17 +230,22 @@ ao_sirf_parse_41(void)
}
}
-void
+static void
ao_gps_setup(void) __reentrant
{
- uint8_t i;
+ uint8_t i, k;
+#ifdef AO_GPS_4800
ao_serial_set_speed(AO_SERIAL_SPEED_4800);
- for (i = 0; i < 16; i++)
+#endif
+ for (i = 0; i < 64; i++)
ao_serial_putchar(0x00);
- for (i = 0; i < sizeof (ao_gps_set_nmea) - 1; i++)
- ao_serial_putchar(ao_gps_set_nmea[i]);
+ for (k = 0; k < 3; k++)
+ for (i = 0; i < sizeof (ao_gps_set_nmea); i++)
+ ao_serial_putchar(ao_gps_set_nmea[i]);
+#ifdef AO_GPS_4800
ao_serial_set_speed(AO_SERIAL_SPEED_57600);
- for (i = 0; i < 16; i++)
+#endif
+ for (i = 0; i < 64; i++)
ao_serial_putchar(0x00);
}