| 23 | } |
| 24 | |
| 25 | void 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 | |
| 58 | void IMU_Sensor::get_acc(float &x, float &y, float &z) { |
| 59 | if (!available) return; |
nothing calls this directly
no outgoing calls
no test coverage detected