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 dgps by
Diff: handle/handleGPS.cpp
- Revision:
- 20:81d5655fecc2
- Parent:
- 16:4f5d20b87dc3
- Child:
- 29:b47b4fd78c00
- Child:
- 30:327191ff57e8
diff -r 8c1f2a2204fb -r 81d5655fecc2 handle/handleGPS.cpp --- a/handle/handleGPS.cpp Sun Apr 20 22:01:05 2014 +0000 +++ b/handle/handleGPS.cpp Tue Apr 22 04:26:31 2014 +0000 @@ -2,6 +2,8 @@ //Serial gps(p28,p27); +GPSHandle* GPSHandle::hand = NULL; + void testVar(){ } void GPSHandle::setup(){ @@ -14,6 +16,40 @@ // gps config. } +char GPSHandle::readWaypoints(){ + USB::getSerial().printf("getting waypoitns\r\n"); + PacketStruct pack; + char rx_status = getPS().receivePacket(&pack); + if(rx_status != 1){ + return rx_status; + } + Point* points = (Point*)pack.data; + unsigned int num_points = pack.size; + for(int i=0;i<num_points;i++){ + USB::getSerial().printf("Adding Waypoint: %f, %f\r\n",points[i].lat,points[i].lon); + } + return 1; +} + +void GPSHandle::sendLoc(){ + wait_us(100000); + getPS().openConnection(); + wait_us(100000); + unsigned int sID=getPS().getSuperID(); + getPS().sendPacket(0,NULL,0,PT_EMPTY); + getPS().sendPacket(sID,NULL,0,PT_SENDLOC); + getPS().sendPacket(sID,(char*)(&DH::Locs().getC().getLoc()),sizeof(DataLocation)); + getPS().sendPacket(sID,NULL,0,PT_END); + wait_us(100000); + getPS().closeConnection(); + wait_us(100000); +} + +bool GPSHandle::if_image_location(){ + USB::getSerial().printf("Checking if at waypoint\r\n"); + return true; +} + static bool reading = false; //static std::stringstream line; static char line[MAXREADIN+10];