123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #pragma once
- #include <AP_Common/AP_Common.h>
- #include <AP_HAL/AP_HAL.h>
- #include <AP_HAL/I2CDevice.h>
- #include <AP_Math/AP_Math.h>
- #include "AP_Compass.h"
- #include "AP_Compass_Backend.h"
- #ifndef HAL_COMPASS_IST8310_I2C_ADDR
- #define HAL_COMPASS_IST8310_I2C_ADDR 0x0E
- #endif
- class AP_Compass_IST8310 : public AP_Compass_Backend
- {
- public:
- static AP_Compass_Backend *probe(AP_HAL::OwnPtr<AP_HAL::I2CDevice> dev,
- bool force_external,
- enum Rotation rotation);
- void read() override;
- static constexpr const char *name = "IST8310";
- private:
- AP_Compass_IST8310(AP_HAL::OwnPtr<AP_HAL::Device> dev,
- bool force_external,
- enum Rotation rotation);
- void timer();
- bool init();
- void start_conversion();
- AP_HAL::OwnPtr<AP_HAL::Device> _dev;
- AP_HAL::Device::PeriodicHandle _periodic_handle;
- AP_HAL::Util::perf_counter_t _perf_xfer_err;
- AP_HAL::Util::perf_counter_t _perf_bad_data;
- enum Rotation _rotation;
- uint8_t _instance;
- bool _ignore_next_sample;
- bool _force_external;
- };
|