MCPcopy Create free account
hub / github.com/OpenEarable/open-earable / get_data

Method get_data

src/custom_sensor/IMU_Sensor.cpp:25–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23}
24
25void IMU_Sensor::get_data(int sensorID, byte *data) {
26 float x, y, z;
27
28 if (sensorID != ACC_GYRO_MAG) {
29 memset(data, 0, 36);
30 return;
31 }
32
33 get_all();
34
35 int index = 0;
36 float * floatArray = (float*)data;
37
38 get_acc(x,y,z);
39 floatArray[0+index] = x;
40 floatArray[1+index] = y;
41 floatArray[2+index] = z;
42
43 index += 3;
44
45 get_gyro(x,y,z);
46 floatArray[0+index] = x;
47 floatArray[1+index] = y;
48 floatArray[2+index] = z;
49
50 index += 3;
51
52 get_mag(x,y,z);
53 floatArray[0+index] = x;
54 floatArray[1+index] = y;
55 floatArray[2+index] = z;
56}
57
58void IMU_Sensor::get_acc(float &x, float &y, float &z) {
59 if (!available) return;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected