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.
Fork of mbed_gps3 by
Diff: main.cpp
- Revision:
- 1:fbc9c604df21
- Parent:
- 0:0389ce4f9789
diff -r 0389ce4f9789 -r fbc9c604df21 main.cpp --- a/main.cpp Sat May 12 07:28:33 2018 +0000 +++ b/main.cpp Wed May 16 02:37:22 2018 +0000 @@ -23,43 +23,43 @@ system_state_packet_t system_state_packet; an_decoder_initialise(&an_decoder); - pc.baud(115200); device.baud(115200); - + while(1) { - while(device.readable()) { - + // an_decoder.buffer_length = 0; + while(device.readable()) { + //pc.printf("%d\r\n",sizeof(an_decoder.buffer)); + //j = device.readable() ; int i = an_decoder.buffer_length; an_decoder.buffer[i+1] = device.getc(); an_decoder_increment(&an_decoder, 1); - - + //pc.printf("%d\r\n",(an_decoder.buffer_length)); } /* iterate through an example data dump from spatial */ - if (40 < an_decoder.buffer_length) + if (40<an_decoder.buffer_length) { //calculate the number of bytes to copy //bytes_to_copy = an_decoder_size(&an_decoder); - + while ((an_packet = an_packet_decode(&an_decoder)) != NULL) { //an_packet = an_packet_decode(&an_decoder); - pc.printf("what is problem? \r\n"); if (an_packet->id == packet_id_system_state) //system state packet - { pc.printf("what is problem?222"); + { //copy all the binary data into the typedef struct for the packet //this allows easy access to all the different values if (decode_system_state_packet(&system_state_packet, an_packet) == 0) - {pc.printf("what is problem?222"); + { pc.printf("System State Packet:\n"); pc.printf("\tLatitude = %f, Longitude = %f, Height = %f\n", system_state_packet.latitude * RADIANS_TO_DEGREES, system_state_packet.longitude * RADIANS_TO_DEGREES, system_state_packet.height); pc.printf("\tRoll = %f, Pitch = %f, Heading = %f\n", system_state_packet.orientation[0] * RADIANS_TO_DEGREES, system_state_packet.orientation[1] * RADIANS_TO_DEGREES, system_state_packet.orientation[2] * RADIANS_TO_DEGREES); + pc.printf("\tVelocity_north = %f, Velocith_east = %f, Velocity_down = %f\n", system_state_packet.velocity[0], system_state_packet.velocity[1], system_state_packet.velocity[2]); } } else @@ -67,6 +67,7 @@ pc.printf("Packet ID %u of Length %u\n", an_packet->id, an_packet->length); } } + } }