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
USBHostGPS.h
- Committer:
- va009039
- Date:
- 2014-01-23
- Revision:
- 2:0cdac6bcc534
- Parent:
- 0:5160ee0c522d
File content as of revision 2:0cdac6bcc534:
// 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;
};
