From bd6511dd0a22836accb608f97272a449c2c7f477 Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Sun, 24 Nov 2013 14:53:08 +0900 Subject: [PATCH] GPS: add GPS_UBLOX_passthrough sketch This sketch allows the user to configure the Ublox GPS using U-Center without the need for an FTDI cable. --- .../GPS_UBLOX_passthrough.pde | 44 +++++++++++++++++++ .../examples/GPS_UBLOX_passthrough/Makefile | 2 + .../GPS_UBLOX_passthrough/nocore.inoflag | 0 3 files changed, 46 insertions(+) create mode 100644 libraries/AP_GPS/examples/GPS_UBLOX_passthrough/GPS_UBLOX_passthrough.pde create mode 100644 libraries/AP_GPS/examples/GPS_UBLOX_passthrough/Makefile create mode 100644 libraries/AP_GPS/examples/GPS_UBLOX_passthrough/nocore.inoflag diff --git a/libraries/AP_GPS/examples/GPS_UBLOX_passthrough/GPS_UBLOX_passthrough.pde b/libraries/AP_GPS/examples/GPS_UBLOX_passthrough/GPS_UBLOX_passthrough.pde new file mode 100644 index 0000000000..d824bb5b9f --- /dev/null +++ b/libraries/AP_GPS/examples/GPS_UBLOX_passthrough/GPS_UBLOX_passthrough.pde @@ -0,0 +1,44 @@ +// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- +/* + * GPS UBlox passthrough sketch + * Code by DIYDrones.com + * + * Works with APM2.x + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const AP_HAL::HAL& hal = AP_HAL_BOARD_DRIVER; + +void setup() +{ + // initialise console uart to 38400 baud + hal.console->begin(38400); + + // initialise gps uart to 38400 baud + hal.uartB->begin(38400); +} + +void loop() +{ + // send characters received from the console to the GPS + while (hal.console->available()) { + hal.uartB->write(hal.console->read()); + } + // send GPS characters to the console + while (hal.uartB->available()) { + hal.console->write(hal.uartB->read()); + } +} + +AP_HAL_MAIN(); diff --git a/libraries/AP_GPS/examples/GPS_UBLOX_passthrough/Makefile b/libraries/AP_GPS/examples/GPS_UBLOX_passthrough/Makefile new file mode 100644 index 0000000000..87e4482ca3 --- /dev/null +++ b/libraries/AP_GPS/examples/GPS_UBLOX_passthrough/Makefile @@ -0,0 +1,2 @@ +BOARD = mega +include ../../../../mk/apm.mk diff --git a/libraries/AP_GPS/examples/GPS_UBLOX_passthrough/nocore.inoflag b/libraries/AP_GPS/examples/GPS_UBLOX_passthrough/nocore.inoflag new file mode 100644 index 0000000000..e69de29bb2