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.
Dependents: F401RE-USBHostMIDI_RecieveExample
Fork of F401RE-USBHost by
Diff: USBHostGPS/USBHostGPS.h
- Revision:
- 3:a3872f7593e2
- Parent:
- 0:5160ee0c522d
- Child:
- 8:6463cd1964c0
diff -r 0cdac6bcc534 -r a3872f7593e2 USBHostGPS/USBHostGPS.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/USBHostGPS/USBHostGPS.h Sat Jan 25 12:51:44 2014 +0000
@@ -0,0 +1,21 @@
+// Simple USBHost GPS Dongle for FRDM-KL46Z
+#include "USBHost.h"
+
+#define PL2303_SET_LINE_CODING 0x20
+
+class USBHostGPS {
+public:
+ USBHostGPS(int baud = 38400) {
+ host = USBHost::getHostInst();
+ // stop bit = 1, parity = none, 8bit
+ uint8_t data[] = {baud&0xff, baud>>8, baud>>16, baud>>24, 0x00, 0x00, 0x08};
+ SETUP_PACKET setup = {0x21, PL2303_SET_LINE_CODING, 0, 0, 0};
+ host->ControlWrite(&setup, data, sizeof(data));
+ }
+ int readNMEA(char* data, int size) {
+ return host->BulkRead((uint8_t*)data, size);
+ }
+
+private:
+ USBHost * host;
+};
