-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSendModule.cpp
More file actions
55 lines (47 loc) · 1.51 KB
/
SendModule.cpp
File metadata and controls
55 lines (47 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
* SendModule.cpp
*
* Created on: Mar 22, 2014
* Author: sam
*/
#include "SendModule.h"
MAKE_MODULE(SendModule)
void SendModule::execute()
{
#if defined(ENERGIA)
if (theTestRepresentation2->collectData)
{
Serial.print("{"); //<< SOF
// Write the
// floatToBytes(theTMP006Representation->fAmbient);
// floatToBytes(theTMP006Representation->fObject);
// floatToBytes(theMPU9150Representation->fAccelX);
// floatToBytes(theMPU9150Representation->fAccelY);
// floatToBytes(theMPU9150Representation->fAccelZ);
// floatToBytes(theMPU9150Representation->fGyroX);
// floatToBytes(theMPU9150Representation->fGyroY);
// floatToBytes(theMPU9150Representation->fGyroZ);
// floatToBytes(theMPU9150Representation->fMagnetoX);
// floatToBytes(theMPU9150Representation->fMagnetoY);
// floatToBytes(theMPU9150Representation->fMagnetoZ);
floatToBytes(theMPU9150Representation->fRoll);
floatToBytes(theMPU9150Representation->fPitch);
floatToBytes(theMPU9150Representation->fYaw);
// floatToBytes(thePredictionRepresentation->target);
// floatToBytes(thePredictionRepresentation->prediction);
Serial.println("}"); //<< EOF
}
#endif
}
void SendModule::floatToBytes(const float& value)
{
#if defined(ENERGIA)
FloatDetails floatDetails(value);
const int32_t& mantissa = floatDetails.getMantissa();
const int16_t& exponent = floatDetails.getExponent();
Serial.print((int32_t) mantissa);
Serial.print(" ");
Serial.print((int32_t) exponent);
Serial.print(" ");
#endif
}