Cubic Hand project for EECS 249A course.
Dependencies: MMA8451Q TSI cc3000_hostdriver_mbedsocket NVIC_set_all_priorities mbed Multi_WS2811
Diff: DataGlove.cpp
- Revision:
- 23:a8de4f87cada
- Parent:
- 22:0cc5b7e55419
- Child:
- 26:42ae7eed0b68
diff -r 0cc5b7e55419 -r a8de4f87cada DataGlove.cpp --- a/DataGlove.cpp Thu Dec 11 04:07:54 2014 +0000 +++ b/DataGlove.cpp Thu Dec 11 04:17:46 2014 +0000 @@ -14,6 +14,7 @@ corrected = new Glove; ReceiveCount = 0; numReceived = 0; + NewData = false; //Initialize correction values to 0 correction->roll = 0.0; correction->pitch = 0.0; @@ -123,6 +124,7 @@ } break; } + NewData = true; Buf[0] = 0; //Clear Token so no repeats. notConnectedCount = 0; numReceived = 0; @@ -311,4 +313,20 @@ gl->pitch = 0.0; gl->yaw = 0.0; gl->lastPkgTime = timeOfArrival; +} + +Glove DataGlove::GetCurrentValues() +{ + return *gl; +} +bool DataGlove::CheckForNewValues() +{ + if(NewData == true) + { + NewData = false; + return true; + }else + { + return false; + } } \ No newline at end of file