CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: Ardupilot/ardupilot
Path: blob/master/libraries/AP_Compass/AP_Compass_MAG3110.h
Views: 1798
1
#pragma once
2
3
#include "AP_Compass_config.h"
4
5
#if AP_COMPASS_MAG3110_ENABLED
6
7
#include <AP_Common/AP_Common.h>
8
#include <AP_HAL/AP_HAL.h>
9
#include <AP_HAL/Device.h>
10
#include <AP_Math/AP_Math.h>
11
12
#include "AP_Compass.h"
13
#include "AP_Compass_Backend.h"
14
15
16
#ifndef HAL_MAG3110_I2C_ADDR
17
#define HAL_MAG3110_I2C_ADDR 0x0E
18
#endif
19
20
class AP_Compass_MAG3110 : public AP_Compass_Backend
21
{
22
public:
23
static AP_Compass_Backend *probe(AP_HAL::OwnPtr<AP_HAL::Device> dev,
24
enum Rotation rotation);
25
26
static constexpr const char *name = "MAG3110";
27
28
void read() override;
29
30
~AP_Compass_MAG3110() { }
31
32
private:
33
AP_Compass_MAG3110(AP_HAL::OwnPtr<AP_HAL::Device> dev);
34
35
bool init(enum Rotation rotation);
36
37
bool _read_sample();
38
39
bool _hardware_init();
40
void _update();
41
42
AP_HAL::OwnPtr<AP_HAL::Device> _dev;
43
44
int32_t _mag_x;
45
int32_t _mag_y;
46
int32_t _mag_z;
47
48
uint8_t _compass_instance;
49
bool _initialised;
50
};
51
52
#endif // AP_COMPASS_MAG3110_ENABLED
53
54