APM:Libraries
AP_Compass_MAG3110.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <AP_Common/AP_Common.h>
4 #include <AP_HAL/AP_HAL.h>
5 #include <AP_HAL/Device.h>
6 #include <AP_Math/AP_Math.h>
7 
8 #include "AP_Compass.h"
9 #include "AP_Compass_Backend.h"
10 
11 
12 #ifndef HAL_MAG3110_I2C_ADDR
13  #define HAL_MAG3110_I2C_ADDR 0x0E
14 #endif
15 
17 {
18 public:
21  enum Rotation = ROTATION_NONE);
22 
23  static constexpr const char *name = "MAG3110";
24 
25  void read() override;
26 
28 
29 private:
31 
32  bool init(enum Rotation rotation);
33 
34  bool _read_sample();
35 
36  bool _hardware_init();
37  void _update();
38 
40 
41  int32_t _mag_x;
42  int32_t _mag_y;
43  int32_t _mag_z;
44 
45  float _mag_x_accum;
46  float _mag_y_accum;
47  float _mag_z_accum;
48  uint8_t _accum_count;
49 
52 };
static constexpr const char * name
AP_HAL::OwnPtr< AP_HAL::Device > _dev
bool init(enum Rotation rotation)
Rotation
Definition: rotations.h:27
#define constexpr
Definition: AP_HAL_Macros.h:16
static AP_HAL::OwnPtr< AP_HAL::Device > dev
Definition: ICM20789.cpp:16
AP_Compass_MAG3110(Compass &compass, AP_HAL::OwnPtr< AP_HAL::Device > dev)
static Compass compass
Definition: AHRS_Test.cpp:20
static AP_Compass_Backend * probe(Compass &compass, AP_HAL::OwnPtr< AP_HAL::Device > dev, enum Rotation=ROTATION_NONE)
Common definitions and utility routines for the ArduPilot libraries.