diff --git a/IMU.hpp b/IMU.hpp index 5b97992..1922998 100644 --- a/IMU.hpp +++ b/IMU.hpp @@ -8,7 +8,53 @@ #ifndef AUTOPILOT_SHARED_DATA_IMU_HPP_ #define AUTOPILOT_SHARED_DATA_IMU_HPP_ +#include +namespace IMU { + + +enum class Orientation { + ENU = 0, // +X = East, +Y = North, +Z = up + NED = 1, // +X = North, +Y = East, +Z = down +}; + + +struct Data { + + int16_t magX = 0; + int16_t magY = 0; + int16_t magZ = 0; + + int16_t temp = 0; + + int16_t accX = 0; + int16_t accY = 0; + int16_t accZ = 0; + + int16_t gyrX = 0; + int16_t gyrY = 0; + int16_t gyrZ = 0; + + float temperature; + + Orientation orientation = Orientation::ENU; + + uint8_t* imuDataPtr( void ) { + return (uint8_t*)&temp; + } + + uint8_t* magDataPtr( void ) { + return (uint8_t*)&magX; + } + + void calcTemperature( void ) { + temperature = (((float)temp / 256.0f) + 25.0f); + } +}; + + + +} // namespace IMU