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>
SKYTRAQ_MSG_3(5,0,5,0) /* Set to 115200 baud */
};
SKYTRAQ_MSG_3(5,0,5,0) /* Set to 115200 baud */
};
+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
{
static void
gps_update(void) __reentrant
{
ao_timer_set_adc_interval(0);
#endif
ao_skytraq_sendstruct(ao_gps_115200);
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_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 (;;)
/* It's a binary protocol; abandon attempts to escape */
for (;;)