Example #1
0
// Constructors ////////////////////////////////////////////////////////////////
AP_GPS_NMEA::AP_GPS_NMEA(Stream *s) :
	GPS(s)
{
	FastSerial	*fs = (FastSerial *)_port;

	// Re-open the port with enough receive buffering for the messages we expect
	// and very little tx buffering, since we don't care about sending.
	// Leave the port speed alone as we don't actually know at what rate we're running...
	//
	fs->begin(0, 200, 16);
}
// The EM406 defalts to NMEA at 4800bps.  We want to switch it to SiRF binary
// mode at a higher rate.
//
// The change is sticky, but only for as long as the internal supercap holds
// settings (usually less than a week).
//
void
AP_GPS_406::_change_to_sirf_protocol(void)
{
    FastSerial  *fs = (FastSerial *)_port;      // this is a bit grody...

    fs->begin(4800);
    delay(300);
    _port->print(init_str);
    delay(300);

    fs->begin(9600);
    delay(300);
    _port->print(init_str);
    delay(300);

    fs->begin(GPS_406_BITRATE);
    delay(300);
    _port->print(init_str);
    delay(300);
}