FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
Loading...
Searching...
No Matches
hmc5883l.h File Reference

API to handle HMC5883L 3-axis digital compass I2C chip. More...

#include <math.h>
#include "common_magneto.h"
#include "../bits.h"
#include "../functors.h"
#include "../i2c_device.h"
#include "../i2c_device_utilities.h"
#include "../utilities.h"
Include dependency graph for hmc5883l.h:

Go to the source code of this file.

Classes

class  devices::magneto::Status
 The chip status, as defined in datasheet p16. More...
 
class  devices::magneto::HMC5883L< MANAGER >
 I2C device driver for the HMC5883L compass chip. More...
 
class  devices::magneto::HMC5883L< MANAGER >::BeginFuture
 Create a future to be used by asynchronous method begin(BeginFuture&). More...
 

Namespaces

namespace  devices
 Defines all API for all external devices supported by FastArduino.
 
namespace  devices::magneto
 Defines API for magnetic sensors for direction, speed and acceleration properties.
 

Enumerations

enum class  devices::magneto::SamplesAveraged : uint8_t {
  ONE_SAMPLE = 0 << 5 ,
  TWO_SAMPLES = 1 << 5 ,
  FOUR_SAMPLES = 2 << 5 ,
  EIGHT_SAMPLES = 3 << 5
}
 The number of samples to average every time a measurement is required from the HMC5883L chip (datasheet p12). More...
 
enum class  devices::magneto::DataOutput : uint8_t {
  RATE_0_75HZ = 0 << 2 ,
  RATE_1_5HZ = 1 << 2 ,
  RATE_3HZ = 2 << 2 ,
  RATE_7_5HZ = 3 << 2 ,
  RATE_15HZ = 4 << 2 ,
  RATE_30HZ = 5 << 2 ,
  RATE_75HZ = 6 << 2
}
 The output rate when used in continuous mode (datasheet p12). More...
 
enum class  devices::magneto::MeasurementMode : uint8_t {
  NORMAL = 0 ,
  POSITIVE_BIAS = 1 ,
  NEGATIVE_BIAS = 2
}
 The measurement mode as defined in datasheet p12, table6. More...
 
enum class  devices::magneto::OperatingMode : uint8_t {
  CONTINUOUS = 0 ,
  SINGLE = 1 ,
  IDLE = 2
}
 The operating mode of the chip as defined in datasheet p10, p14 table 12. More...
 
enum class  devices::magneto::Gain : uint8_t {
  GAIN_0_88GA = 0 << 5 ,
  GAIN_1_3GA = 1 << 5 ,
  GAIN_1_9GA = 2 << 5 ,
  GAIN_2_5GA = 3 << 5 ,
  GAIN_4_0GA = 4 << 5 ,
  GAIN_4_7GA = 5 << 5 ,
  GAIN_5_6GA = 6 << 5 ,
  GAIN_8_1GA = 7 << 5
}
 The gain to set for the chip, as defined in datasheet p13, table9. More...
 

Functions

float devices::magneto::magnetic_heading (int16_t x, int16_t y)
 Calculate the magnetic heading (heading measured clockwise from magnetic north) from X and Y magnetic fields. More...
 

Detailed Description

API to handle HMC5883L 3-axis digital compass I2C chip.

See also
https://github.com/jfpoilpret/fast-arduino-lib/blob/master/refs/devices/HMC5883L.pdf

Definition in file hmc5883l.h.