#ifndef _HAL_H_ #define _HAL_H_ #ifdef __cplusplus extern "C" { #endif #pragma anon_unions #include /** * \struct _HAL_gyro_SI_t * \brief Gyroscope data with SI unit (rad/s) * * seq - sample count * v - latest gyro data * vi - integrate gyro from last call for EKF(rad) * dti - intergrate time from last call * temperature - For Temperature Compensation */ typedef struct _HAL_gyro_SI_t { uint32_t seq; union { float v[3]; struct { float x; float y; float z; }; }; union { float vi[3]; struct { float xi; float yi; float zi; }; }; float dti; float temperature; ///< Unit is Celsius } HAL_gyro_SI_t; /** * \struct _HAL_acc_SI_t * \brief Accelerometer data with SI unit (m/s2) * * seq - sample count * v - latest Accelerometer data * vi - integrated speed from last call for EKF(m/s) * dti - intergrate time from last call * temperature - For Temperature Compensation */ typedef struct _HAL_acc_SI_t { uint32_t seq; union { float a[3]; struct { float x; float y; float z; }; }; union { float v[3]; struct { float xi; float yi; float zi; }; }; float dti; float temperature; ///< Unit is Celsius } HAL_acc_SI_t; /** * \struct _HAL_magn_mg_t * \brief Magnetic data with mG unit * * seq - sample count * v - latest Magnetic data */ typedef struct _HAL_magn_mG_t { uint32_t seq; union { float v[3]; struct { float x; float y; float z; }; }; } HAL_magn_mG_t; /** * \struct _HAL_pressurePS_SI_t * \brief Pressure data of pressure sensor with SI unit * seq - sample count * pressure - latest Magnetic data * temperature - For Temperature Compensation */ typedef struct _HAL_pressure_SI_t { uint32_t seq; float pressure; ///< Unit is Pascal float temperature; ///< Unit is Celsius } HAL_pressure_SI_t; typedef struct _HAL_sbus_in_t { uint16_t channels[18]; uint8_t seq; uint8_t id; uint8_t valid; } HAL_sbus_in_t; typedef struct _HAL_led_color_t { union { uint8_t rgb[3]; struct { uint8_t r; uint8_t g; uint8_t b; }; }; } HAL_led_color_t; /** * \struct _HAL_GPS_SI_t * \brief GPS receiver with SI unit * * fixtype: * 0 - No GPS connected * 1 - No position information, GPS is connected * 2 - 2D position * 3 - 3D position * 4 - DGPS/SBAS aided 3D position * 5 - RTK float, 3D position * 6 - RTK Fixed, 3D position * 7 - Static fixed, typically used for base stations * 8 - PPP, 3D position. * * att_fixtype: * 0 - attitude invalid * 1 - pitch/heading valid */ typedef struct _HAL_GPS_SI_t { double latitude; ///< Unit is degree double longitude; ///< Unit is degree float altitude; ///< aititude from MSL, Unit is meter union { float vNED[3]; ///< Unit is meter per second, in NED axes struct { float vel_north; float vel_east; float vel_down; }; }; float heading; ///< Unit is radian, valid when fixtype_att>1 float pitch; ///< Unit is radian, valid when fixtype_att>1 float h_acc; ///< Unit is meter, Position uncertainty float v_acc; ///< Unit is meter, Altitude uncertainty float vel_acc; ///< Unit is m/s, velocity uncertainty float att_acc; ///< Unit is radian, attitude uncertainty when fixtype_att>1 uint32_t TOW; ///< Unit is millisecond, Time of Week uint32_t seq; ///< update count uint32_t seq_att; ///< attitude update count uint16_t HDOP; ///< GPS HDOP horizontal dilution of position uint16_t VDOP; ///< GPS VDOP vertical dilution of position uint16_t WN; ///< Week Number of GPS uint8_t fixtype; ///< GPS fixtype uint8_t fixtype_att; uint8_t satnum; } HAL_GPS_SI_t; /** * \struct _HAL_INS_SI_t * \brief INS device output with SI unit */ typedef struct _HAL_INS_SI_t { double latitude; ///< Unit is degree double longitude; ///< Unit is degree float altitude; ///< aititude from MSL, Unit is meter union { float vNED[3]; ///< Unit is meter per second, in NED axes struct { float vel_north; float vel_east; float vel_down; }; }; union { float attitude[3]; ///