2018 revision to classic DataBus AVC code.
Dependencies: LSM303DLM Servo SerialGraphicLCD L3G4200D IncrementalEncoder SimpleShell
Diff: main.cpp
- Revision:
- 18:3f8a8f6e3cc1
- Parent:
- 16:eb28d0f64a9b
- Child:
- 19:0d1728091519
diff -r 5c2af0904e87 -r 3f8a8f6e3cc1 main.cpp --- a/main.cpp Thu Dec 13 23:27:04 2018 +0000 +++ b/main.cpp Fri Dec 14 00:36:06 2018 +0000 @@ -21,12 +21,12 @@ LocalFileSystem lfs("etc"); Config config; SimpleShell sh; +Ublox6 ublox; DigitalOut led1(LED1); DigitalOut led3(LED3); void do_gps() { - Ublox6 ublox; RawSerial s(UART1TX, UART1RX, 38400); while (1) { int c = s.getc(); @@ -43,6 +43,21 @@ printf("Hello world!\n"); } +void read_gps() +{ + double lat=0; + double lon=0; + float course=0; + float speed=0; + float hdop=0.0; + int svcount=0; + + ublox.read(lat, lon, course, speed, hdop, svcount); + printf("%3.7f %3.7f\n", lat, lon); + printf("hdg=%03.1f deg spd=%3.1f m/s\n", course, speed); + printf("%d %f\n", svcount, hdop); +} + void read_gyro() { int g[3]; @@ -106,6 +121,7 @@ sh.attach(test, "test"); sh.attach(read_gyro, "gyro"); sh.attach(read_enc, "enc"); + sh.attach(read_gps, "gps"); sh.attach(reset, "reset"); Thread shellThread; shellThread.start(callback(&sh, &SimpleShell::run));