JM9 XRCU Board 0.1.1
Libraries API Reference
Loading...
Searching...
No Matches
Hmc5883l.h
Go to the documentation of this file.
1
8
9#ifndef HMC5883L_H
10#define HMC5883L_H
11
12#include <Arduino.h>
13#include <Wire.h>
14
15#include <General_compass.h>
16
21class Hmc5883l : public General_compass {
22 private:
26 const uint32_t port;
27
31 uint8_t i2c_address;
32
36 static const uint8_t DEFAULT_I2C_ADDRESS;
37
41 static const uint32_t I2C_FREQ;
42
46 unsigned long prev_getdata_millis;
47
51 double raw_to_uT (const int16_t raw);
52
53 public:
58 Hmc5883l (const uint32_t init_port);
59
67 bool begin (const uint8_t init_i2c_address = DEFAULT_I2C_ADDRESS);
68
77 bool begin (const Compass_cal_vals_t compass_cal_values, const uint8_t init_i2c_address = DEFAULT_I2C_ADDRESS);
78
79 // low-level functions
80
85 bool update ();
86
91 uint32_t id ();
92
97 bool is_mag_present ();
98};
99
100#endif // #ifndef HMC5883L_H
General_compass()
Creates a General_compass object.
Definition General_compass.cpp:13
uint32_t id()
Reads the identification register.
Definition Hmc5883l.cpp:150
bool update()
Fetches and updates new data from the compass.
Definition Hmc5883l.cpp:119
bool is_mag_present()
Checks for the presence of the HMC5883L magnetometer on the I2C bus.
Definition Hmc5883l.cpp:170
Hmc5883l(const uint32_t init_port)
Creates a new Hmc5883l object.
Definition Hmc5883l.cpp:88
bool begin(const uint8_t init_i2c_address=DEFAULT_I2C_ADDRESS)
Configures the settings of the I2C bus and the HMC5883L magnetometer.
Definition Hmc5883l.cpp:100
Calibration values of a compass.
Definition General_compass.h:43