Skyward boardcore
Loading...
Searching...
No Matches
Boardcore::BMX160Config Struct Reference

BMX160 Configuration. More...

#include <BMX160Config.h>

Public Types

enum class  FifoMode { DISABLED , HEADERLESS , HEADER }
 Fifo operationg mode. More...
 
enum class  FifoInterruptPin { DISABLED , PIN_INT1 , PIN_INT2 }
 Fifo interrupt mode. More...
 
enum class  AccelerometerRange { G_2 = 0x3 , G_4 = 0x5 , G_8 = 0x8 , G_16 = 0xC }
 Range of the accelerometer expressed in ±g. More...
 
enum class  GyroscopeRange {
  DEG_2000 = 0x0 , DEG_1000 = 0x1 , DEG_500 = 0x2 , DEG_250 = 0x3 ,
  DEG_125 = 0x4
}
 Gyroscope range expressed in °/sec. More...
 
enum class  GyroscopeMeasureUnit { DEG , RAD }
 Gyroscope measure unit (degrees or radiants). More...
 
enum class  OutputDataRate {
  HZ_0_78125 = 0x01 , HZ_1_5625 = 0x02 , HZ_3_125 = 0x03 , HZ_6_25 = 0x04 ,
  HZ_12_5 = 0x05 , HZ_25 = 0x06 , HZ_50 = 0x07 , HZ_100 = 0x08 ,
  HZ_200 = 0x09 , HZ_400 = 0x0A , HZ_800 = 0x0B , HZ_1600 = 0x0C ,
  HZ_3200 = 0x0D
}
 Output Data Rate expressed in Hz. More...
 
enum class  BandwidthParameter { NORMAL = 0x20 , OSR2 = 0x10 , OSR4 = 0x00 }
 Bandwidth parameter. More...
 
enum class  IntMode { PUSH_PULL , OPEN_DRAIN }
 Interrupt pin mode. More...
 

Public Member Functions

 BMX160Config ()
 

Public Attributes

uint8_t fifoWatermark = -1
 Fifo watermark to use, in multiples of 4.
 
uint8_t magnetometerRepetitionsXY = 0x04
 Repetitions for the XY axis.
 
uint8_t magnetometerRepetitionsZ = 0x0E
 Repetitions for the Z axis.
 
bool enableCompensation = true
 Enable magnetometer data compensation.
 
int temperatureDivider = 0
 Divide the temperature sampling rate.
 
bool fifoAccelerometerFiltered = true
 Should the fifo use accelerometer filtered data?
 
uint8_t fifoAccelerationDownsampling = 0
 Fifo accelerometer downsampling (between 0 and 15).
 
bool fifoGyroscopeFiltered = true
 Should the fifo use gyroscope filtered data?
 
uint8_t fifoGyroscopeDownsampling = 0
 Fifo gyroscope downsampling (between 0 and 15).
 
FifoMode fifoMode = FifoMode::DISABLED
 
FifoInterruptPin fifoInterrupt = FifoInterruptPin::DISABLED
 
OutputDataRate accelerometerDataRate = OutputDataRate::HZ_100
 
BandwidthParameter accelerometerBandwidth = BandwidthParameter::NORMAL
 
AccelerometerRange accelerometerRange = AccelerometerRange::G_2
 
OutputDataRate gyroscopeDataRate = OutputDataRate::HZ_100
 
BandwidthParameter gyroscopeBandwidth = BandwidthParameter::NORMAL
 
GyroscopeRange gyroscopeRange = GyroscopeRange::DEG_2000
 
GyroscopeMeasureUnit gyroscopeUnit = GyroscopeMeasureUnit::RAD
 
OutputDataRate magnetometerRate = OutputDataRate::HZ_100
 
IntMode interrupt1Mode = IntMode::PUSH_PULL
 
IntMode interrupt2Mode = IntMode::PUSH_PULL
 

Detailed Description

BMX160 Configuration.

Definition at line 31 of file BMX160Config.h.

Member Enumeration Documentation

◆ AccelerometerRange

Range of the accelerometer expressed in ±g.

Enumerator
G_2 

Accelaration range ±2g.

G_4 

Accelaration range ±4g.

G_8 

Accelaration range ±8g.

G_16 

Accelaration range ±16g.

Definition at line 60 of file BMX160Config.h.

◆ BandwidthParameter

Bandwidth parameter.

For more detailed explanation, check the 2.4.1 Data Processing Accelerometer and 2.4.2 Data Processing Gyroscope chapters of the BMX160 datasheet.

Enumerator
NORMAL 

Normal filter operation.

OSR2 

Oversampling rate of 2.

OSR4 

Oversampling rate of 4.

Definition at line 122 of file BMX160Config.h.

◆ FifoInterruptPin

Fifo interrupt mode.

Uses fifo full/watermark as triggers. We configure the pin as push-pull and active-low.

Enumerator
DISABLED 

The interrupts are completely disabled.

PIN_INT1 

Interrupts are enabled on pin 2.

PIN_INT2 

Interrupts are enabled on pin 1.

Definition at line 49 of file BMX160Config.h.

◆ FifoMode

Fifo operationg mode.

Enumerator
DISABLED 

The fifo is completely disabled.

HEADERLESS 

Sensors MUST have the same odr.

HEADER 

Sensors can have different odr.

Definition at line 36 of file BMX160Config.h.

◆ GyroscopeMeasureUnit

Gyroscope measure unit (degrees or radiants).

Enumerator
DEG 

Degrees.

RAD 

Radiants.

Definition at line 83 of file BMX160Config.h.

◆ GyroscopeRange

Gyroscope range expressed in °/sec.

Enumerator
DEG_2000 

Gyroscope range 2000°/sec.

DEG_1000 

Gyroscope range 1000°/sec.

DEG_500 

Gyroscope range 500°/sec.

DEG_250 

Gyroscope range 250°/sec.

DEG_125 

Gyroscope range 125°/sec.

Definition at line 71 of file BMX160Config.h.

◆ IntMode

Interrupt pin mode.

Configuration for interrupt pin behaviour.

Enumerator
PUSH_PULL 

Push-pull behaviour.

OPEN_DRAIN 

Open drain behaviour.

Definition at line 134 of file BMX160Config.h.

◆ OutputDataRate

Output Data Rate expressed in Hz.

Limits are as follows (wrong values will error the device):

  • Accelerometer: 25/2 - 1600 (25/32 - 1600 if undersampling is enabled, which is not)
  • Gyroscope: 25 - 3200
  • Magnetometer: 25/32 - 800
Enumerator
HZ_0_78125 

Output Data Rate of 25/32Hz = 0.78125.

HZ_1_5625 

Output Data Rate of 25/16Hz = 1.5625.

HZ_3_125 

Output Data Rate of 25/8Hz = 3.125.

HZ_6_25 

Output Data Rate of 25/4Hz = 6.25.

HZ_12_5 

Output Data Rate of 25/2Hz = 12.5.

HZ_25 

Output Data Rate of 25Hz.

HZ_50 

Output Data Rate of 50Hz.

HZ_100 

Output Data Rate of 100Hz.

HZ_200 

Output Data Rate of 200Hz.

HZ_400 

Output Data Rate of 400Hz.

HZ_800 

Output Data Rate of 800Hz.

HZ_1600 

Output Data Rate of 1600Hz.

HZ_3200 

Output Data Rate of 3200Hz.

Definition at line 98 of file BMX160Config.h.

Constructor & Destructor Documentation

◆ BMX160Config()

Boardcore::BMX160Config::BMX160Config ( )
inline

Definition at line 244 of file BMX160Config.h.

Member Data Documentation

◆ accelerometerBandwidth

BandwidthParameter Boardcore::BMX160Config::accelerometerBandwidth = BandwidthParameter::NORMAL

Definition at line 231 of file BMX160Config.h.

◆ accelerometerDataRate

OutputDataRate Boardcore::BMX160Config::accelerometerDataRate = OutputDataRate::HZ_100

Definition at line 230 of file BMX160Config.h.

◆ accelerometerRange

AccelerometerRange Boardcore::BMX160Config::accelerometerRange = AccelerometerRange::G_2

Definition at line 232 of file BMX160Config.h.

◆ enableCompensation

bool Boardcore::BMX160Config::enableCompensation = true

Enable magnetometer data compensation.

The magnetomer support compensation, but it's not documented, and the current implementation is based on the source of the bosch driver.

The implementation is slow, probably buggy, and only god knows what it does, it's so bad that I added a switch to disable it, use it wisely!

Definition at line 194 of file BMX160Config.h.

◆ fifoAccelerationDownsampling

uint8_t Boardcore::BMX160Config::fifoAccelerationDownsampling = 0

Fifo accelerometer downsampling (between 0 and 15).

Definition at line 215 of file BMX160Config.h.

◆ fifoAccelerometerFiltered

bool Boardcore::BMX160Config::fifoAccelerometerFiltered = true

Should the fifo use accelerometer filtered data?

Definition at line 210 of file BMX160Config.h.

◆ fifoGyroscopeDownsampling

uint8_t Boardcore::BMX160Config::fifoGyroscopeDownsampling = 0

Fifo gyroscope downsampling (between 0 and 15).

Definition at line 225 of file BMX160Config.h.

◆ fifoGyroscopeFiltered

bool Boardcore::BMX160Config::fifoGyroscopeFiltered = true

Should the fifo use gyroscope filtered data?

Definition at line 220 of file BMX160Config.h.

◆ fifoInterrupt

FifoInterruptPin Boardcore::BMX160Config::fifoInterrupt = FifoInterruptPin::DISABLED

Definition at line 228 of file BMX160Config.h.

◆ fifoMode

FifoMode Boardcore::BMX160Config::fifoMode = FifoMode::DISABLED

Definition at line 227 of file BMX160Config.h.

◆ fifoWatermark

uint8_t Boardcore::BMX160Config::fifoWatermark = -1

Fifo watermark to use, in multiples of 4.

Only values between [0-250] make sense to use. A really high watermark value (the default) will disable it, falling back to FIFO full.

Definition at line 147 of file BMX160Config.h.

◆ gyroscopeBandwidth

BandwidthParameter Boardcore::BMX160Config::gyroscopeBandwidth = BandwidthParameter::NORMAL

Definition at line 235 of file BMX160Config.h.

◆ gyroscopeDataRate

OutputDataRate Boardcore::BMX160Config::gyroscopeDataRate = OutputDataRate::HZ_100

Definition at line 234 of file BMX160Config.h.

◆ gyroscopeRange

GyroscopeRange Boardcore::BMX160Config::gyroscopeRange = GyroscopeRange::DEG_2000

Definition at line 236 of file BMX160Config.h.

◆ gyroscopeUnit

GyroscopeMeasureUnit Boardcore::BMX160Config::gyroscopeUnit = GyroscopeMeasureUnit::RAD

Definition at line 237 of file BMX160Config.h.

◆ interrupt1Mode

IntMode Boardcore::BMX160Config::interrupt1Mode = IntMode::PUSH_PULL

Definition at line 241 of file BMX160Config.h.

◆ interrupt2Mode

IntMode Boardcore::BMX160Config::interrupt2Mode = IntMode::PUSH_PULL

Definition at line 242 of file BMX160Config.h.

◆ magnetometerRate

OutputDataRate Boardcore::BMX160Config::magnetometerRate = OutputDataRate::HZ_100

Definition at line 239 of file BMX160Config.h.

◆ magnetometerRepetitionsXY

uint8_t Boardcore::BMX160Config::magnetometerRepetitionsXY = 0x04

Repetitions for the XY axis.

Repetitions represent how many internal samples are averaged in order to get the final outputted sample, these presets are the ones recommended in the BMX160 datasheet, for more informations consult the BMM150 datasheet, chapter 4.2.4 Active mode.

This are the recommended presets:

  • 0x01, RMS Noise (x/y/z) 1.0/1.0/1.4, Current: 0.17mA (Low power)
  • 0x04, RMS Noise (x/y/z) 0.6/0.6/0.6, Current: 0.5mA (Regular) (Default)
  • 0x07, RMS Noise (x/y/z) 0.5/0.5/0.5, Current: 0.8mA (Enhanced regular)
  • 0x17, RMS Noise (x/y/z) 0.3/0.3/0.3, Current: 4.9mA (High accuracy)

Definition at line 165 of file BMX160Config.h.

◆ magnetometerRepetitionsZ

uint8_t Boardcore::BMX160Config::magnetometerRepetitionsZ = 0x0E

Repetitions for the Z axis.

Repetitions represent how many internal samples are averaged in order to get the final outputted sample, these presets are the ones recommended in the BMX160 datasheet, for more informations consult the BMM150 datasheet, chapter 4.2.4 Active mode.

This are the recommended presets:

  • 0x02, RMS Noise (x/y/z) 1.0/1.0/1.4, Current: 0.17mA (Low power)
  • 0x0E, RMS Noise (x/y/z) 0.6/0.6/0.6, Current: 0.5mA (Regular) (Default)
  • 0x1A, RMS Noise (x/y/z) 0.5/0.5/0.5, Current: 0.8mA (Enhanced regular)
  • 0x52, RMS Noise (x/y/z) 0.3/0.3/0.3, Current: 4.9mA (High accuracy)

Definition at line 183 of file BMX160Config.h.

◆ temperatureDivider

int Boardcore::BMX160Config::temperatureDivider = 0

Divide the temperature sampling rate.

This is used to limit the sampling of the temperature, use 0 to disable it completely.

Every time you call onSimpleUpdate a value is incremented and only if the value is a multiple of this parameter a read is performed.

Definition at line 205 of file BMX160Config.h.


The documentation for this struct was generated from the following file: