Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of C027_GPSTransparentSerial by
main.cpp@1:0d32baf4a645, 2013-10-25 (annotated)
- Committer:
- mazgch
- Date:
- Fri Oct 25 20:36:35 2013 +0000
- Revision:
- 1:0d32baf4a645
- Parent:
- 0:7f124c0a351a
- Child:
- 2:490b4b087576
use power config
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; |
| mazgch | 1:0d32baf4a645 | 7 | c027.gpsPower(true); |
| mazgch | 1:0d32baf4a645 | 8 | |
| mazgch | 0:7f124c0a351a | 9 | // open the gps serial port |
| mazgch | 0:7f124c0a351a | 10 | Serial gps(GPSTXD, GPSRXD); |
| mazgch | 0:7f124c0a351a | 11 | gps.baud(GPSBAUD); |
| mazgch | 0:7f124c0a351a | 12 | |
| mazgch | 0:7f124c0a351a | 13 | // open the PC serial port and (use the same baudrate) |
| mazgch | 0:7f124c0a351a | 14 | Serial pc(USBTX, USBRX); |
| mazgch | 0:7f124c0a351a | 15 | pc.baud(GPSBAUD); |
| mazgch | 0:7f124c0a351a | 16 | |
| mazgch | 0:7f124c0a351a | 17 | while (1) |
| mazgch | 0:7f124c0a351a | 18 | { |
| mazgch | 0:7f124c0a351a | 19 | // transfer data from pc to gps |
| mazgch | 0:7f124c0a351a | 20 | if (pc.readable() && gps.writeable()) |
| mazgch | 0:7f124c0a351a | 21 | gps.putc(pc.getc()); |
| mazgch | 0:7f124c0a351a | 22 | // transfer data from gps to pc |
| mazgch | 0:7f124c0a351a | 23 | if (gps.readable() && pc.writeable()) |
| mazgch | 0:7f124c0a351a | 24 | pc.putc(gps.getc()); |
| mazgch | 0:7f124c0a351a | 25 | } |
| mazgch | 0:7f124c0a351a | 26 | } |
