diff options
author | Keith Packard <keithp@keithp.com> | 2012-12-04 09:45:01 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2012-12-04 09:45:01 -0800 |
commit | ce12787b56f699166cafe4cdee9e2a4d8e66ebed (patch) | |
tree | cbdcbc5a1283310e17282d4fae2075d2c1e39eb6 | |
parent | d1778937e136fdecf8607dd9b358cf972d87ca34 (diff) |
altos: Break out GPS speed resetting sequence
To set the GPS speed, we delay for 1/2 sec, change speed, then delay
for another 1/2 sec.
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | src/drivers/ao_gps_skytraq.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/drivers/ao_gps_skytraq.c b/src/drivers/ao_gps_skytraq.c index d637a602..d2f67e6b 100644 --- a/src/drivers/ao_gps_skytraq.c +++ b/src/drivers/ao_gps_skytraq.c @@ -507,6 +507,13 @@ static __code uint8_t ao_gps_115200[] = { }; static void +ao_gps_set_speed_delay(uint8_t speed) { + ao_delay(AO_MS_TO_TICKS(500)); + ao_gps_set_speed(speed); + ao_delay(AO_MS_TO_TICKS(500)); +} + +static void gps_update(void) __reentrant { ao_gps_updating = 1; @@ -515,13 +522,9 @@ gps_update(void) __reentrant ao_timer_set_adc_interval(0); #endif ao_skytraq_sendstruct(ao_gps_115200); - ao_delay(AO_MS_TO_TICKS(500)); - ao_gps_set_speed(AO_SERIAL_SPEED_4800); - ao_delay(AO_MS_TO_TICKS(500)); + ao_gps_set_speed_delay(AO_SERIAL_SPEED_4800); ao_skytraq_sendstruct(ao_gps_115200); - ao_delay(AO_MS_TO_TICKS(500)); - ao_gps_set_speed(AO_SERIAL_SPEED_115200); - ao_delay(AO_MS_TO_TICKS(500)); + ao_gps_set_speed_delay(AO_SERIAL_SPEED_115200); /* It's a binary protocol; abandon attempts to escape */ for (;;) |