FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
Loading...
Searching...
No Matches
devices::magneto Namespace Reference

Defines API for magnetic sensors for direction, speed and acceleration properties. More...

Classes

struct  AllSensors
 Structure to store all MPU6050 sensors data (3 axis gyroscope and accelerometer, chip temperature). More...
 
class  FIFOEnable
 Configuration for MPU6050 FIFO Enable register (register map §4.6). More...
 
class  HMC5883L
 I2C device driver for the HMC5883L compass chip. More...
 
class  INTStatus
 The structure of the Interrupt Status register (register map §4.16). More...
 
class  MPU6050
 I2C device driver for the MPU6050 gyroscope/accelerometer chip. More...
 
struct  Sensor3D
 Structure to store 3 axis data for one sensor (gyroscope or accelerometer). More...
 
class  Status
 The chip status, as defined in datasheet p16. More...
 

Typedefs

using INTEnable = INTStatus
 The structure of the Interrupt Enable register (register map §4.15). More...
 

Enumerations

enum class  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  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  MeasurementMode : uint8_t {
  NORMAL = 0 ,
  POSITIVE_BIAS = 1 ,
  NEGATIVE_BIAS = 2
}
 The measurement mode as defined in datasheet p12, table6. More...
 
enum class  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  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...
 
enum class  GyroRange : uint8_t {
  RANGE_250 = 0 << 3 ,
  RANGE_500 = 1 << 3 ,
  RANGE_1000 = 2 << 3 ,
  RANGE_2000 = 3 << 3
}
 The full-scale range of the gyroscope in dps (datasheet §6.1). More...
 
enum class  AccelRange : uint8_t {
  RANGE_2G = 0 << 3 ,
  RANGE_4G = 1 << 3 ,
  RANGE_8G = 2 << 3 ,
  RANGE_16G = 3 << 3
}
 The full-scale range of the accelerometer in g (datasheet §6.2). More...
 
enum class  ClockSelect : uint8_t {
  INTERNAL_8MHZ = 0 ,
  PLL_X_AXIS_GYRO = 1 ,
  PLL_Y_AXIS_GYRO = 2 ,
  PLL_Z_AXIS_GYRO = 3 ,
  PLL_EXTERNAL_32KHZ = 4 ,
  PLL_EXTERNAL_19MHZ = 5 ,
  STOPPED = 7
}
 The clock to select for the chip (datasheet §6.6). More...
 
enum class  DLPF : uint8_t {
  ACCEL_BW_260HZ = 0 ,
  ACCEL_BW_184HZ = 1 ,
  ACCEL_BW_94HZ = 2 ,
  ACCEL_BW_44HZ = 3 ,
  ACCEL_BW_21HZ = 4 ,
  ACCEL_BW_10HZ = 5 ,
  ACCEL_BW_5HZ = 6 ,
  GYRO_BW_256HZ = 0 ,
  GYRO_BW_188HZ = 1 ,
  GYRO_BW_98HZ = 2 ,
  GYRO_BW_42HZ = 3 ,
  GYRO_BW_20HZ = 4 ,
  GYRO_BW_10HZ = 5 ,
  GYRO_BW_5HZ = 6
}
 The Digital Low Pass Filter bandwidth to select for the chip (register map §4.3). More...
 
enum class  AD0 : uint8_t {
  LOW = 0 ,
  HIGH = 1
}
 Possible values of I2C address lower bit for the chip (the chip may have one of two possible addresses, based on the level of pin AD0, datasheet §6.4, §7.1). More...
 

Functions

float 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...
 
static constexpr uint16_t GYRO_RANGE_DPS (GyroRange range)
 Convert a GyroRange constant to the real gyroscope range in dps. More...
 
static constexpr uint16_t ACCEL_RANGE_G (AccelRange range)
 Convert an AccelRange constant to the real accelerometer range in g. More...
 

Detailed Description

Defines API for magnetic sensors for direction, speed and acceleration properties.

Typedef Documentation

◆ INTEnable

The structure of the Interrupt Enable register (register map §4.15).

See also
MPU6050::begin(FIFOEnable, INTEnable, uint8_t, GyroRange, AccelRange, DLPF, ClockSelect)
MPU6050::FifoBeginFuture
INTStatus

Definition at line 243 of file mpu6050.h.

Enumeration Type Documentation

◆ SamplesAveraged

enum class devices::magneto::SamplesAveraged : uint8_t
strong

The number of samples to average every time a measurement is required from the HMC5883L chip (datasheet p12).

Definition at line 49 of file hmc5883l.h.

◆ DataOutput

enum class devices::magneto::DataOutput : uint8_t
strong

The output rate when used in continuous mode (datasheet p12).

See also
OperatingMode

Definition at line 61 of file hmc5883l.h.

◆ MeasurementMode

enum class devices::magneto::MeasurementMode : uint8_t
strong

The measurement mode as defined in datasheet p12, table6.

Definition at line 75 of file hmc5883l.h.

◆ OperatingMode

enum class devices::magneto::OperatingMode : uint8_t
strong

The operating mode of the chip as defined in datasheet p10, p14 table 12.

Definition at line 85 of file hmc5883l.h.

◆ Gain

enum class devices::magneto::Gain : uint8_t
strong

The gain to set for the chip, as defined in datasheet p13, table9.

Definition at line 95 of file hmc5883l.h.

◆ GyroRange

enum class devices::magneto::GyroRange : uint8_t
strong

The full-scale range of the gyroscope in dps (datasheet §6.1).

See also
MPU6050::begin()
MPU6050::BeginFuture
MPU6050::FifoBeginFuture

Definition at line 45 of file mpu6050.h.

◆ AccelRange

enum class devices::magneto::AccelRange : uint8_t
strong

The full-scale range of the accelerometer in g (datasheet §6.2).

See also
MPU6050::begin()
MPU6050::BeginFuture
MPU6050::FifoBeginFuture

Definition at line 70 of file mpu6050.h.

◆ ClockSelect

enum class devices::magneto::ClockSelect : uint8_t
strong

The clock to select for the chip (datasheet §6.6).

See also
MPU6050::begin()
MPU6050::BeginFuture
MPU6050::FifoBeginFuture

Definition at line 95 of file mpu6050.h.

◆ DLPF

enum class devices::magneto::DLPF : uint8_t
strong

The Digital Low Pass Filter bandwidth to select for the chip (register map §4.3).

This can be expressed either from the gyroscope viewpoint or from the accelerometer viewpoint, but any setting is common to both features, i.e. selecting a DLPF setting for the accelerometer will force the matching setting for the gyroscope.

See also
MPU6050::begin()
MPU6050::BeginFuture
MPU6050::FifoBeginFuture

Definition at line 117 of file mpu6050.h.

◆ AD0

enum class devices::magneto::AD0 : uint8_t
strong

Possible values of I2C address lower bit for the chip (the chip may have one of two possible addresses, based on the level of pin AD0, datasheet §6.4, §7.1).

See also
MPU6050
Enumerator
LOW 

When AD0 pin is low, I2C address is 0x68.

HIGH 

When AD0 pin is high, I2C address is 0x69.

Definition at line 267 of file mpu6050.h.

Function Documentation

◆ magnetic_heading()

float devices::magneto::magnetic_heading ( int16_t  x,
int16_t  y 
)
inline

Calculate the magnetic heading (heading measured clockwise from magnetic north) from X and Y magnetic fields.

Definition at line 39 of file hmc5883l.h.

◆ GYRO_RANGE_DPS()

static constexpr uint16_t devices::magneto::GYRO_RANGE_DPS ( GyroRange  range)
staticconstexpr

Convert a GyroRange constant to the real gyroscope range in dps.

Definition at line 56 of file mpu6050.h.

◆ ACCEL_RANGE_G()

static constexpr uint16_t devices::magneto::ACCEL_RANGE_G ( AccelRange  range)
staticconstexpr

Convert an AccelRange constant to the real accelerometer range in g.

Definition at line 81 of file mpu6050.h.