X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=ao_gps.c;h=353272f1badb4558a7825a13387d49b2b87b4564;hp=83f44d55f42f80c0c738b5f754d04b6c3f40d610;hb=4ae74fffb939d67424efa3e7f433637f1f920ebc;hpb=c4e983daa4579896b227fdcb2be43fad75e94307 diff --git a/ao_gps.c b/ao_gps.c index 83f44d55..353272f1 100644 --- a/ao_gps.c +++ b/ao_gps.c @@ -17,8 +17,6 @@ #include "ao.h" -__xdata struct ao_task ao_gps_task; - #define AO_GPS_LEADER 6 static const uint8_t ao_gps_header[] = "GPGGA,"; @@ -248,15 +246,31 @@ ao_gps(void) __reentrant ao_gps_error = 1; if (!ao_gps_error) { ao_mutex_get(&ao_gps_mutex); - memcpy(&ao_gps_data, &ao_gps_next, sizeof (ao_gps_data)); + memcpy(&ao_gps_data, &ao_gps_next, sizeof (struct ao_gps_data)); ao_mutex_put(&ao_gps_mutex); ao_wakeup(&ao_gps_data); } } } +__xdata struct ao_task ao_gps_task; + +static void +gps_dump(void) __reentrant +{ + ao_mutex_get(&ao_gps_mutex); + ao_gps_print(&ao_gps_data); + ao_mutex_put(&ao_gps_mutex); +} + +__code struct ao_cmds ao_gps_cmds[] = { + { 'g', gps_dump, "g Display current GPS values" }, + { 0, gps_dump, NULL }, +}; + void ao_gps_init(void) { ao_add_task(&ao_gps_task, ao_gps, "gps"); + ao_cmd_register(&ao_gps_cmds[0]); }