M5Unit-IMU 0.0.2 git rev:e5b00aa
Loading...
Searching...
No Matches
unit_bmi270_data.hpp File Reference

BMI270 setting enums and measurement data (framework independent) More...

#include <array>
#include <cstdint>
#include "unit_bmm150_data.hpp"

Go to the source code of this file.

Classes

struct  m5::unit::bmi270::Data
 One measurement. Accel/gyro are always 12 bytes, little-endian (register 0x0C when the AUX/BMM150 bridge is not in use, or bytes [8..19] of the 20 byte burst from register 0x04 when it is; see UnitBMI270::read_measurement()) More...
 

Namespaces

namespace  m5
 Top level namespace of M5Stack.
 

Enumerations

enum class  m5::unit::bmi270::AccelRange : uint8_t { G2 , G4 , G8 , G16 }
 Accelerometer full scale range (REG_ACC_RANGE register 0x41) More...
 
enum class  m5::unit::bmi270::GyroRange : uint8_t {
  DPS2000 , DPS1000 , DPS500 , DPS250 ,
  DPS125
}
 Gyroscope full scale range (REG_GYR_RANGE register 0x43) More...
 
enum class  m5::unit::bmi270::AccelODR : uint8_t {
  Rate12_5Hz = 0x05 , Rate25Hz , Rate50Hz , Rate100Hz ,
  Rate200Hz , Rate400Hz , Rate800Hz , Rate1600Hz
}
 Accelerometer output data rate (REG_ACC_CONF register 0x40, bits[3:0]) More...
 
enum class  m5::unit::bmi270::GyroODR : uint8_t {
  Rate25Hz = 0x06 , Rate50Hz , Rate100Hz , Rate200Hz ,
  Rate400Hz , Rate800Hz , Rate1600Hz , Rate3200Hz
}
 Gyroscope output data rate (REG_GYR_CONF register 0x42, bits[3:0]) More...
 
enum class  m5::unit::bmi270::FilterPerf : uint8_t { PowerOptimized , Performance }
 Filter performance mode (REG_ACC_CONF bit7 / REG_GYR_CONF bit7) More...
 
enum class  m5::unit::bmi270::AccelBwp : uint8_t {
  Osr4Avg1 , Osr2Avg2 , NormAvg4 , CicAvg8 ,
  Avg16 , Avg32 , Avg64 , Avg128
}
 Accelerometer bandwidth parameter (REG_ACC_CONF register 0x40, bits[6:4]) More...
 
enum class  m5::unit::bmi270::GyroBwp : uint8_t { Osr4 , Osr2 , Norm }
 Gyroscope bandwidth parameter (REG_GYR_CONF register 0x42, bits[5:4]) More...
 

Functions

constexpr bool m5::unit::bmi270::bwp_fits (const FilterPerf perf, const AccelBwp bwp)
 Is this bandwidth parameter usable in the given filter performance mode?
 
constexpr uint8_t m5::unit::bmi270::acc_conf_value (const FilterPerf perf, const AccelBwp bwp, const AccelODR odr)
 REG_ACC_CONF value for the given settings.
 
constexpr uint8_t m5::unit::bmi270::gyr_conf_value (const FilterPerf perf, const GyroBwp bwp, const GyroODR odr)
 REG_GYR_CONF value for the given settings.
 
constexpr float m5::unit::bmi270::accel_res (const AccelRange r)
 G per LSB for each AccelRange.
 
constexpr float m5::unit::bmi270::gyro_res (const GyroRange r)
 dps per LSB for each GyroRange (note: value 0 is the largest range, see GyroRange)
 
constexpr uint32_t m5::unit::bmi270::odr_interval_ms (const GyroODR odr)
 Sampling interval in milliseconds for the given GyroODR.
 

Variables

constexpr uint32_t m5::unit::bmi270::GYRO_ODR_INTERVAL_MS [14]
 

Detailed Description

BMI270 setting enums and measurement data (framework independent)

Enumeration Type Documentation

◆ AccelBwp

enum class m5::unit::bmi270::AccelBwp : uint8_t
strong

Accelerometer bandwidth parameter (REG_ACC_CONF register 0x40, bits[6:4])

One field with two meanings, chosen by FilterPerf: a filter setting in Performance mode, an averaging factor in PowerOptimized mode. The averaging-only values are reserved in Performance mode, so the combination is validated (see bwp_fits())

Enumerator
Osr4Avg1 

OSR4 filter / no averaging.

Osr2Avg2 

OSR2 filter / average 2 samples.

NormAvg4 

Normal filter (power-on default) / average 4 samples.

CicAvg8 

CIC filter / average 8 samples.

Avg16 

Average 16 samples (PowerOptimized only; reserved in Performance mode)

Avg32 

Average 32 samples (PowerOptimized only)

Avg64 

Average 64 samples (PowerOptimized only)

Avg128 

Average 128 samples (PowerOptimized only)

◆ AccelODR

enum class m5::unit::bmi270::AccelODR : uint8_t
strong

Accelerometer output data rate (REG_ACC_CONF register 0x40, bits[3:0])

Enumerator
Rate12_5Hz 

12.5Hz

Rate25Hz 

25Hz

Rate50Hz 

50Hz

Rate100Hz 

100Hz (power-on default)

Rate200Hz 

200Hz

Rate400Hz 

400Hz

Rate800Hz 

800Hz

Rate1600Hz 

1600Hz

◆ AccelRange

enum class m5::unit::bmi270::AccelRange : uint8_t
strong

Accelerometer full scale range (REG_ACC_RANGE register 0x41)

Enumerator
G2 

+-2G (16384 LSB/G)

G4 

+-4G (8192 LSB/G)

G8 

+-8G (4096 LSB/G, power-on default)

G16 

+-16G (2048 LSB/G)

◆ FilterPerf

enum class m5::unit::bmi270::FilterPerf : uint8_t
strong

Filter performance mode (REG_ACC_CONF bit7 / REG_GYR_CONF bit7)

Note
Also selects how the bandwidth parameter is interpreted; see AccelBwp
Enumerator
PowerOptimized 

Power optimized (ulp): the accelerometer's Bwp averages instead of filtering.

Performance 

Performance optimized (hp, power-on default)

◆ GyroBwp

enum class m5::unit::bmi270::GyroBwp : uint8_t
strong

Gyroscope bandwidth parameter (REG_GYR_CONF register 0x42, bits[5:4])

Note
Only a filter setting – the gyroscope has no averaging modes, so unlike AccelBwp it means the same thing in either FilterPerf. Register value 0x03 is reserved and therefore not offered
Enumerator
Osr4 

OSR4 filter.

Osr2 

OSR2 filter.

Norm 

Normal filter (power-on default)

◆ GyroODR

enum class m5::unit::bmi270::GyroODR : uint8_t
strong

Gyroscope output data rate (REG_GYR_CONF register 0x42, bits[3:0])

Enumerator
Rate25Hz 

25Hz

Rate50Hz 

50Hz

Rate100Hz 

100Hz

Rate200Hz 

200Hz (power-on default)

Rate400Hz 

400Hz

Rate800Hz 

800Hz

Rate1600Hz 

1600Hz

Rate3200Hz 

3200Hz

◆ GyroRange

enum class m5::unit::bmi270::GyroRange : uint8_t
strong

Gyroscope full scale range (REG_GYR_RANGE register 0x43)

Note
Unlike UnitMPU6886's GyroRange, value 0 is the largest range here (register encoding is chip-native, not renumbered to match MPU6886)
Enumerator
DPS2000 

+-2000 dps (power-on default)

DPS1000 

+-1000 dps

DPS500 

+-500 dps

DPS250 

+-250 dps

DPS125 

+-125 dps

Function Documentation

◆ acc_conf_value()

uint8_t m5::unit::bmi270::acc_conf_value ( const FilterPerf perf,
const AccelBwp bwp,
const AccelODR odr )
constexpr

REG_ACC_CONF value for the given settings.

Note
Reproduces the register's 0xA8 reset value at Performance / NormAvg4 / Rate100Hz

◆ bwp_fits()

bool m5::unit::bmi270::bwp_fits ( const FilterPerf perf,
const AccelBwp bwp )
constexpr

Is this bandwidth parameter usable in the given filter performance mode?

Note
The accelerometer's averaging-only values (Avg16 and up) are reserved in Performance mode

◆ gyr_conf_value()

uint8_t m5::unit::bmi270::gyr_conf_value ( const FilterPerf perf,
const GyroBwp bwp,
const GyroODR odr )
constexpr

REG_GYR_CONF value for the given settings.

Note
Bit6 (gyr_noise_perf) is left at its 0 reset value; reproduces the register's 0xA9 reset value at Performance / Norm / Rate200Hz

Variable Documentation

◆ GYRO_ODR_INTERVAL_MS

uint32_t m5::unit::bmi270::GYRO_ODR_INTERVAL_MS[14]
constexpr
Initial value:
= {
0, 0, 0, 0, 0, 0,
40,
20,
10,
5,
3,
2,
1,
1,
}