modified to compile for me
Fork of F401RE-USBHost by
Diff: USBHostGPS.h
- Revision:
- 0:5160ee0c522d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/USBHostGPS.h Sat Jan 18 13:30:22 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; +};