DUDS
Distributed Update of Data from Something
duds::hardware::devices::instruments::LSM9DS1_internal Namespace Reference

Prevent Doxygen from mixing this up with other source-file specific items from other files. More...

Enumerations

enum  AccelGyroRegs {
  AgrDeviceId = 0xF, AgrGyroConfig1, AgrGyroConfig2, AgrGyroConfig3,
  AgrTemp = 0x15, AgrStatusPreGyro = 0x17, AgrGyroSampleX, AgrGyroSampleY = 0x1A,
  AgrGyroSampleZ = 0x1C, AgrGyroConfig4 = 0x1E, AgrAccelConfig5, AgrAccelConfig6,
  AgrAccelConfig7, AgrConfig8, AgrConfig9, AgrStatusPreAccel = 0x27,
  AgrAccelSampleX, AgrAccelSampleY = 0x2A, AgrAccelSampleZ = 0x2C, AgrFifoConfig = 0x2E,
  AgrFifoStatus
}
 The registers for the accelerometer and gyroscope device. More...
 
enum  MagRegs {
  MagOffsetX = 5, MagOffsetY = 7, MagOffsetZ = 9, MagDeviceId = 0xF,
  MagConfig1 = 0x20, MagConfig2, MagConfig3, MagConfig4,
  MagConfig5, MagStatus = 0x27, MagSampleX, MagSampleY = 0x2A,
  MagSampleZ = 0x2C
}
 The registers for the magnetometer device. More...
 

Functions

static bool matchDataRate (std::int8_t &destVal, float &actualRate, float reqRate, const std::map< float, int > &rateMap)
 Finds the lowest data rate that is at least as fast as requested, and the value needed to select this rate with the device. More...
 

Variables

static const std::map< float, int > AccelDataRateVals
 Available sampling rates for the accelerometer when the gyroscope is not in use. More...
 
static const std::map< float, int > AccelGyroDataRateVals
 Available sampling rates for the accelerometer and gyroscope when both are in use. More...
 
static const double AccelScaleToUnits []
 
static const double GyroScaleToUnits []
 
static const std::map< float, int > MagDataRateVals
 Sample rates for the magnetometer. More...
 
static const double MagScaleToUnits []
 

Detailed Description

Prevent Doxygen from mixing this up with other source-file specific items from other files.

Enumeration Type Documentation

◆ AccelGyroRegs

The registers for the accelerometer and gyroscope device.

They have been renamed to be more readable, understandable, and consistent with other code in this library.

Enumerator
AgrDeviceId 
AgrGyroConfig1 

CTRL_REG1_G.

AgrGyroConfig2 

CTRL_REG2_G.

AgrGyroConfig3 

CTRL_REG3_G.

AgrTemp 
AgrStatusPreGyro 

A general status register; same data as AgrStatusPreAccel.

AgrGyroSampleX 

OUT_X_G.

AgrGyroSampleY 

OUT_Y_G.

AgrGyroSampleZ 

OUT_Z_G.

AgrGyroConfig4 

CTRL_REG4.

AgrAccelConfig5 

CTRL_REG5_XL.

AgrAccelConfig6 

CTRL_REG6_XL.

AgrAccelConfig7 

CTRL_REG7_XL.

AgrConfig8 

CTRL_REG8.

AgrConfig9 

CTRL_REG9.

AgrStatusPreAccel 

A general status register; same data as AgrStatusPreGyro.

AgrAccelSampleX 

OUT_X_XL.

AgrAccelSampleY 

OUT_Y_XL.

AgrAccelSampleZ 

OUT_Z_XL.

AgrFifoConfig 

FIFO_CTRL.

AgrFifoStatus 

FIFO_SRC.

Definition at line 32 of file LSM9DS1.cpp.

◆ MagRegs

The registers for the magnetometer device.

They have been renamed to be more readable, understandable, and consistent with other code in this library.

Enumerator
MagOffsetX 
MagOffsetY 
MagOffsetZ 
MagDeviceId 
MagConfig1 

CTRL_REG1_M.

MagConfig2 

CTRL_REG2_M.

MagConfig3 

CTRL_REG3_M.

MagConfig4 

CTRL_REG4_M.

MagConfig5 

CTRL_REG5_M.

MagStatus 

STATUS_REG_M.

MagSampleX 

OUT_X_L_M.

MagSampleY 

OUT_Y_L_M.

MagSampleZ 

OUT_Z_L_M.

Definition at line 67 of file LSM9DS1.cpp.

Function Documentation

◆ matchDataRate()

static bool duds::hardware::devices::instruments::LSM9DS1_internal::matchDataRate ( std::int8_t &  destVal,
float &  actualRate,
float  reqRate,
const std::map< float, int > &  rateMap 
)
static

Finds the lowest data rate that is at least as fast as requested, and the value needed to select this rate with the device.

No exception is thrown so that the caller may throw an object based on which data rate has trouble.

Parameters
destValWill be set to the value to send to the device to select the data rate.
actualRateWill be set to the actual rate to use if one is found.
reqRateThe requested data rate. The actual rate may be greater, but will not be lower.
rateMapThe map containing the data rates and values.
Returns
True if a rate was found, false if the requested rate is faster than all supported rates. If false, destVal and actualRate will not be altered.
Todo:
Make something generic like this.

Definition at line 140 of file LSM9DS1.cpp.

Referenced by duds::hardware::devices::instruments::LSM9DS1AccelGyro::configure(), and duds::hardware::devices::instruments::LSM9DS1Mag::configure().

Variable Documentation

◆ AccelDataRateVals

const std::map<float, int> duds::hardware::devices::instruments::LSM9DS1_internal::AccelDataRateVals
static
Initial value:
= {
{ 0, 0 },
{ 10.0, 1 },
{ 50.0, 2 },
{ 119.0, 3 },
{ 238.0, 4 },
{ 476.0, 5 },
{ 952.0, 6 }
}

Available sampling rates for the accelerometer when the gyroscope is not in use.

Definition at line 87 of file LSM9DS1.cpp.

Referenced by duds::hardware::devices::instruments::LSM9DS1AccelGyro::configure().

◆ AccelGyroDataRateVals

const std::map<float, int> duds::hardware::devices::instruments::LSM9DS1_internal::AccelGyroDataRateVals
static
Initial value:
= {
{ 0, 0 },
{ 14.9, 1 },
{ 59.5, 2 },
{ 119.0, 3 },
{ 238.0, 4 },
{ 476.0, 5 },
{ 952.0, 6 }
}

Available sampling rates for the accelerometer and gyroscope when both are in use.

Definition at line 101 of file LSM9DS1.cpp.

Referenced by duds::hardware::devices::instruments::LSM9DS1AccelGyro::configure().

◆ AccelScaleToUnits

const double duds::hardware::devices::instruments::LSM9DS1_internal::AccelScaleToUnits[]
static
Initial value:
= {
}
constexpr Quantity EarthSurfaceGravity(9.80665,)
A definition for Earth-normal acceleration from gravity that comes from the 1901 General Conference o...
double value
Some value; probably something measured.
Definition: Quantity.hpp:41

Definition at line 156 of file LSM9DS1.cpp.

Referenced by duds::hardware::devices::instruments::LSM9DS1AccelGyro::accelerometerQuantity().

◆ GyroScaleToUnits

const double duds::hardware::devices::instruments::LSM9DS1_internal::GyroScaleToUnits[]
static
Initial value:
= {
8.75 * 1e-3 * M_PI / 180.0,
17.5 * 1e-3 * M_PI / 180.0,
0,
70.0 * 1e-3 * M_PI / 180.0
}

Definition at line 164 of file LSM9DS1.cpp.

Referenced by duds::hardware::devices::instruments::LSM9DS1AccelGyro::gyroscopeQuantity().

◆ MagDataRateVals

const std::map<float, int> duds::hardware::devices::instruments::LSM9DS1_internal::MagDataRateVals
static
Initial value:
= {
{ 0.625, 0 },
{ 1.25, 1 },
{ 2.5, 2 },
{ 5.0, 3 },
{ 10.0, 4 },
{ 20.0, 5 },
{ 40.0, 6 },
{ 80.0, 7 }
}

Sample rates for the magnetometer.

Definition at line 114 of file LSM9DS1.cpp.

Referenced by duds::hardware::devices::instruments::LSM9DS1Mag::configure().

◆ MagScaleToUnits

const double duds::hardware::devices::instruments::LSM9DS1_internal::MagScaleToUnits[]
static
Initial value:
= {
0.14 * 1e-7,
0.29 * 1e-7,
0.43 * 1e-7,
0.58 * 1e-7
}

Definition at line 172 of file LSM9DS1.cpp.

Referenced by duds::hardware::devices::instruments::LSM9DS1Mag::quantity().