コード例 #1
0
ファイル: position.cpp プロジェクト: DanielHeo94/IntelliPilot
void System::Publish::position(void *arg) {

        gpsCustom _mode(_gps, "GPGSA", 1);
        gpsCustom _fixtype(_gps, "GPGSA", 2);
        gpsCustom _pdop(_gps, "GPGSA", 15);
        gpsCustom _vdop(_gps, "GPGSA", 17);

        gpsCustom _nummessages(_gps, "GPGSV", 1);
        gpsCustom _messagenum(_gps, "GPGSV", 2);
        gpsCustom _numsatsinview(_gps, "GPGSV", 3);
        gpsCustom _prn(_gps, "GPGSV", 4);
        gpsCustom _elevation(_gps, "GPGSV", 5);
        gpsCustom _azimuth(_gps, "GPGSV", 6);
        gpsCustom _snr(_gps, "GPGSV", 7);

        gpsCustom _cog(_gps, "GPRMC", 8);
        gpsCustom _timestamp(_gps, "GPRMC", 1);

        for (;; ) {
                unsigned long start = millis();
                do
                {
                        while (Serial2.available())
                                _gps.encode(Serial2.read());
                } while (millis() - start < 100);

                positionBox.latitude = _gps.location.lat();
                positionBox.longitude = _gps.location.lng();
                positionBox.cog = _cog.value();

                gpsInfoBox.mode = _mode.value();
                gpsInfoBox.fixtype = _fixtype.value();
                gpsInfoBox.pdop = _pdop.value();
                gpsInfoBox.hdop = _gps.hdop.value();
                gpsInfoBox.vdop = _vdop.value();
                gpsInfoBox.numbers_of_gpgsv_messages = _nummessages.value();
                gpsInfoBox.index_number_of_gpgsv_message = _messagenum.value();
                gpsInfoBox.numbers_of_sats_inview = _numsatsinview.value();
                gpsInfoBox.prn = _prn.value();
                gpsInfoBox.snr = _snr.value();
                gpsInfoBox.elevation = _elevation.value();
                gpsInfoBox.azimuth = _azimuth.value();
                gpsInfoBox.timestamp = _timestamp.value();
                gpsInfoBox.number_of_satellites = _gps.satellites.value();
        }
}
コード例 #2
0
ファイル: logging.c プロジェクト: AshishKumar4/acess2
void Debug_HexDump(const char *Prefix, const void *Data, size_t Length)
{
	const uint8_t *data = Data;
	size_t	ofs;
	LOG_LOCK_ACQUIRE();
	fprintf(stderr, "[HexDump ]d %s: %i bytes\n", Prefix, (int)Length);
	for( ofs = 0; ofs + 16 <= Length; ofs += 16 )
	{
		const uint8_t	*d = data + ofs;
		fprintf(stderr, "[HexDump ]d %s:", Prefix);
		fprintf(stderr, "  %02x %02x %02x %02x %02x %02x %02x %02x",
			d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7]);
		fprintf(stderr, "  %02x %02x %02x %02x %02x %02x %02x %02x",
			d[8], d[9], d[10], d[11], d[12], d[13], d[14], d[15]);
		fprintf(stderr, " |%c%c%c%c""%c%c%c%c %c%c%c%c""%c%c%c%c",
			_prn(d[ 0]), _prn(d[ 1]), _prn(d[ 2]), _prn(d[ 3]),
			_prn(d[ 4]), _prn(d[ 5]), _prn(d[ 6]), _prn(d[ 7]),
			_prn(d[ 8]), _prn(d[ 9]), _prn(d[10]), _prn(d[11]),
			_prn(d[12]), _prn(d[13]), _prn(d[14]), _prn(d[15])
			);
		fprintf(stderr, "\n");
	}
	
	if( ofs < Length )
	{
		const uint8_t	*d = data + ofs;
		fprintf(stderr, "[HexDump ]d %s: ", Prefix);
		for( int i = 0; i < Length - ofs; i ++ )
		{
			if( i == 8 )	fprintf(stderr, " ");
			fprintf(stderr, " %02x", d[i]);
		}
		for( int i = Length - ofs; i < 16; i ++ )
		{
			if( i == 8 )	fprintf(stderr, " ");
			fprintf(stderr, "   ");
		}
		fprintf(stderr, " |");
		for( int i = 0; i < Length - ofs; i ++ )
		{
			if( i == 8 )	fprintf(stderr, " ");
			fprintf(stderr, "%c", _prn(d[i]));
		}
		
		fprintf(stderr, "\n");
	}
	LOG_LOCK_RELEASE();
}
コード例 #3
0
ファイル: CoreModule.cpp プロジェクト: novalabs/core-mw
uint32_t
CoreModule::getPseudorandom()
{
    return _prn();
}