#pragma once #include #if CONFIG_HAL_BOARD == HAL_BOARD_LINUX #include #include #include #include #include "AP_InertialSensor.h" #include "AP_InertialSensor_Backend.h" class AP_InertialSensor_RST : public AP_InertialSensor_Backend { public: AP_InertialSensor_RST(AP_InertialSensor &imu, AP_HAL::OwnPtr dev_gyro, AP_HAL::OwnPtr dev_accel, enum Rotation rotation_a, enum Rotation rotation_g); virtual ~AP_InertialSensor_RST(); // probe the sensor on SPI bus static AP_InertialSensor_Backend *probe(AP_InertialSensor &imu, AP_HAL::OwnPtr dev_gyro, AP_HAL::OwnPtr dev_accel, enum Rotation rotation_a, enum Rotation rotation_g); /* update accel and gyro state */ bool update() override; void start(void) override; private: bool _init_sensor(); bool _init_gyro(); bool _init_accel(); void gyro_measure(); void accel_measure(); AP_HAL::OwnPtr _dev_gyro;//i3g4250d AP_HAL::OwnPtr _dev_accel;//iis328dq float _gyro_scale; float _accel_scale; enum Rotation _rotation_g; enum Rotation _rotation_a; }; #endif