modified to compile for me
Fork of F401RE-USBHost by
USBHostGPS/USBHostGPS.h@3:a3872f7593e2, 2014-01-25 (annotated)
- Committer:
- va009039
- Date:
- Sat Jan 25 12:51:44 2014 +0000
- Revision:
- 3:a3872f7593e2
- Parent:
- USBHostGPS.h@0:5160ee0c522d
- Child:
- 8:6463cd1964c0
fix max packet size
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
va009039 | 0:5160ee0c522d | 1 | // Simple USBHost GPS Dongle for FRDM-KL46Z |
va009039 | 0:5160ee0c522d | 2 | #include "USBHost.h" |
va009039 | 0:5160ee0c522d | 3 | |
va009039 | 0:5160ee0c522d | 4 | #define PL2303_SET_LINE_CODING 0x20 |
va009039 | 0:5160ee0c522d | 5 | |
va009039 | 0:5160ee0c522d | 6 | class USBHostGPS { |
va009039 | 0:5160ee0c522d | 7 | public: |
va009039 | 0:5160ee0c522d | 8 | USBHostGPS(int baud = 38400) { |
va009039 | 0:5160ee0c522d | 9 | host = USBHost::getHostInst(); |
va009039 | 0:5160ee0c522d | 10 | // stop bit = 1, parity = none, 8bit |
va009039 | 0:5160ee0c522d | 11 | uint8_t data[] = {baud&0xff, baud>>8, baud>>16, baud>>24, 0x00, 0x00, 0x08}; |
va009039 | 0:5160ee0c522d | 12 | SETUP_PACKET setup = {0x21, PL2303_SET_LINE_CODING, 0, 0, 0}; |
va009039 | 0:5160ee0c522d | 13 | host->ControlWrite(&setup, data, sizeof(data)); |
va009039 | 0:5160ee0c522d | 14 | } |
va009039 | 0:5160ee0c522d | 15 | int readNMEA(char* data, int size) { |
va009039 | 0:5160ee0c522d | 16 | return host->BulkRead((uint8_t*)data, size); |
va009039 | 0:5160ee0c522d | 17 | } |
va009039 | 0:5160ee0c522d | 18 | |
va009039 | 0:5160ee0c522d | 19 | private: |
va009039 | 0:5160ee0c522d | 20 | USBHost * host; |
va009039 | 0:5160ee0c522d | 21 | }; |