123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #pragma once
- #include <AP_Common/AP_Common.h>
- #include <AP_HAL/AP_HAL.h>
- #include <AP_HAL/Device.h>
- #include <AP_Math/AP_Math.h>
- #include "AP_Compass.h"
- #include "AP_Compass_Backend.h"
- #ifndef HAL_COMPASS_LIS3MDL_I2C_ADDR
- # define HAL_COMPASS_LIS3MDL_I2C_ADDR 0x1c
- #endif
- #ifndef HAL_COMPASS_LIS3MDL_I2C_ADDR2
- # define HAL_COMPASS_LIS3MDL_I2C_ADDR2 0x1e
- #endif
- class AP_Compass_LIS3MDL : public AP_Compass_Backend
- {
- public:
- static AP_Compass_Backend *probe(AP_HAL::OwnPtr<AP_HAL::Device> dev,
- bool force_external,
- enum Rotation rotation);
- void read() override;
- static constexpr const char *name = "LIS3MDL";
- private:
- AP_Compass_LIS3MDL(AP_HAL::OwnPtr<AP_HAL::Device> dev,
- bool force_external,
- enum Rotation rotation);
- AP_HAL::OwnPtr<AP_HAL::Device> dev;
-
-
- bool init();
- void timer();
- uint8_t compass_instance;
- bool force_external;
- enum Rotation rotation;
- };
|