FastArduino  v1.7
C++ library to build fast but small Arduino/AVR projects
hmc5883l.h File Reference

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

#include <math.h>
#include "common_magneto.h"
#include "../i2c_device.h"
#include "../array.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...
 
class  devices::magneto::HMC5883L< MANAGER >::EndFuture
 Create a future to be used by asynchronous method end(EndFuture&). More...
 
class  devices::magneto::HMC5883L< MANAGER >::StatusFuture
 Create a future to be used by asynchronous method status(StatusFuture&). More...
 
class  devices::magneto::HMC5883L< MANAGER >::MagneticFieldsFuture
 Create a future to be used by asynchronous method magnetic_fields(MagneticFieldsFuture&). More...
 

Namespaces

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

Enumerations

enum  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).
 
enum  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  devices::magneto::MeasurementMode : uint8_t {
  NORMAL = 0,
  POSITIVE_BIAS = 1,
  NEGATIVE_BIAS = 2
}
 The measurement mode as defined in datasheet p12, table6.
 
enum  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.
 
enum  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.
 

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.
 

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.