int BetterStream::_getchar(FILE *stream) { BetterStream *bs; bs = (BetterStream *)fdev_get_udata(stream); // We return -1 if there is nothing to read, which the library interprets // as an error, which our clients will need to deal with. return(bs->read()); }
int BetterStream::_putchar(char c, FILE *stream) { BetterStream *bs; bs = (BetterStream *)fdev_get_udata(stream); if ('\n' == c) bs->write('\r'); // ASCII translation on the cheap bs->write(c); return(0); }
// Public Methods ////////////////////////////////////////////////////////////// void AP_GPS_NMEA::init(enum GPS_Engine_Setting nav_setting) { BetterStream *bs = (BetterStream *)_port; // send the SiRF init strings bs->print_P((const prog_char_t *)_SiRF_init_string); // send the MediaTek init strings bs->print_P((const prog_char_t *)_MTK_init_string); // send the ublox init strings bs->print_P((const prog_char_t *)_ublox_init_string); idleTimeout = 1200; }
// Public Methods ////////////////////////////////////////////////////////////// void AP_GPS_NMEA::init(void) { BetterStream *bs = (BetterStream *)_port; // send the SiRF init strings bs->print_P((const prog_char_t *)_SiRF_init_string); // send the MediaTek init strings bs->print_P((const prog_char_t *)_MTK_init_string); // send the ublox init strings bs->print_P((const prog_char_t *)_ublox_init_string); // @kenny try, try to remove pinout from nmea, Thx to Kevorkian for this // PMTK300,FixInterval,0,0,0,0 // PIOS_COM_SendStringNonBlocking(gpsPort, "$PMTK397,0*23\r\n"); bs->print_P((const prog_char_t *)"$PMTK397,0*23\n\r"); idleTimeout = 1200; }