This example establishes a transparent link between the mbed seial port and the gps on the C027. You can use it to use the standard u-blox tools such as u-center. These tools can then connect to the serial port and talk directly to the GPS receiver. Baudrate should be set to 9600 baud and is fixed. m-center can be downloaded from u-blox website following this link: http://www.u-blox.com/en/evaluation-tools-a-software/u-center/u-center.html
Fork of C027_GPSTransparentSerial by
main.cpp@4:a82068d36685, 2013-12-15 (annotated)
- Committer:
- dixter1
- Date:
- Sun Dec 15 22:06:01 2013 +0000
- Revision:
- 4:a82068d36685
- Parent:
- 3:e62c5d162729
Just update the library.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mazgch | 0:7f124c0a351a | 1 | #include "mbed.h" |
mazgch | 1:0d32baf4a645 | 2 | #include "C027.h" |
mazgch | 0:7f124c0a351a | 3 | |
mazgch | 0:7f124c0a351a | 4 | int main() |
mazgch | 0:7f124c0a351a | 5 | { |
mazgch | 1:0d32baf4a645 | 6 | C027 c027; |
dixter1 | 3:e62c5d162729 | 7 | c027.gpsPower(true,false); |
mazgch | 1:0d32baf4a645 | 8 | |
mazgch | 2:490b4b087576 | 9 | int baud = GPSBAUD; |
mazgch | 2:490b4b087576 | 10 | |
mazgch | 0:7f124c0a351a | 11 | // open the gps serial port |
mazgch | 0:7f124c0a351a | 12 | Serial gps(GPSTXD, GPSRXD); |
mazgch | 2:490b4b087576 | 13 | gps.baud(baud); |
mazgch | 0:7f124c0a351a | 14 | |
mazgch | 0:7f124c0a351a | 15 | // open the PC serial port and (use the same baudrate) |
mazgch | 0:7f124c0a351a | 16 | Serial pc(USBTX, USBRX); |
mazgch | 2:490b4b087576 | 17 | pc.baud(baud); |
mazgch | 0:7f124c0a351a | 18 | |
mazgch | 0:7f124c0a351a | 19 | while (1) |
mazgch | 0:7f124c0a351a | 20 | { |
mazgch | 0:7f124c0a351a | 21 | // transfer data from pc to gps |
mazgch | 0:7f124c0a351a | 22 | if (pc.readable() && gps.writeable()) |
mazgch | 0:7f124c0a351a | 23 | gps.putc(pc.getc()); |
mazgch | 0:7f124c0a351a | 24 | // transfer data from gps to pc |
mazgch | 0:7f124c0a351a | 25 | if (gps.readable() && pc.writeable()) |
mazgch | 0:7f124c0a351a | 26 | pc.putc(gps.getc()); |
mazgch | 0:7f124c0a351a | 27 | } |
mazgch | 0:7f124c0a351a | 28 | } |