modm API documentation
modm::bmi270< Transport > Class Template Reference

#include <modm/driver/inertial/bmi270.hpp>

Inheritance diagram for modm::bmi270< Transport >:

Classes

struct  AccData
 
struct  AccOffsets
 
struct  Data
 
struct  DriveConfig
 
struct  ErrorInfo
 
struct  ErrorInterruptMask
 
struct  FifoConfiguration
 
struct  FifoDownsampling
 
struct  GyroCrtConfig
 
struct  GyroData
 
struct  GyroOffsets
 
struct  GyroUserGain
 
struct  InterfaceConfig
 
struct  InternalError
 
struct  InternalStatus
 
struct  InterruptIoControl
 
struct  InterruptMapData
 
struct  InterruptStatus
 
struct  SensorStatus
 
struct  Temperature
 

Public Types

enum  AccRange : uint8_t { Range2g = 0x00, Range4g = 0x01, Range8g = 0x02, Range16g = 0x03 }
 
enum  GyroRange : uint8_t {
  Range2000dps = 0x00, Range1000dps = 0x01, Range500dps = 0x02, Range250dps = 0x03,
  Range125dps = 0x04
}
 
enum  AccRate : uint8_t {
  Rate25Hz_Osr4 = 0x06 | 0x80, Rate25Hz_Normal = 0x06 | 0x20 | 0x80, Rate50Hz_Normal = 0x07 | 0x20 | 0x80, Rate100Hz_Normal = 0x08 | 0x20 | 0x80,
  Rate200Hz_Normal = 0x09 | 0x20 | 0x80, Rate400Hz_Normal = 0x0A | 0x20 | 0x80, Rate800Hz_Normal = 0x0B | 0x20 | 0x80, Rate1600Hz_Normal = 0x0C | 0x20 | 0x80
}
 
enum  GyroRate : uint8_t {
  Rate25Hz_Normal = 0x06 | 0x20 | 0x40 | 0x80, Rate50Hz_Normal = 0x07 | 0x20 | 0x40 | 0x80, Rate100Hz_Normal = 0x08 | 0x20 | 0x40 | 0x80, Rate200Hz_Normal = 0x09 | 0x20 | 0x40 | 0x80,
  Rate400Hz_Normal = 0x0A | 0x20 | 0x40 | 0x80, Rate800Hz_Normal = 0x0B | 0x20 | 0x40 | 0x80, Rate1600Hz_Normal = 0x0C | 0x20 | 0x40 | 0x80
}
 
enum  Status : uint8_t { AccDataReady = Bit7, GyroDataReady = Bit6, CommandReady = Bit4 }
 
enum  PowerControl : uint8_t { Auxiliary = Bit0, Gyroscope = Bit1, Accelerometer = Bit2, Temperature = Bit3 }
 
enum  PowerConfiguration : uint8_t { AdvancedPowerSave = Bit0, FifoSelfWakeup = Bit1, FastPowerUp = Bit2 }
 
enum  InterruptOutputLevel : uint8_t { ActiveLow = 0x00, ActiveHigh = 0x01 }
 
enum  InterruptOutputType : uint8_t { PushPull = 0x00, OpenDrain = 0x01 }
 
enum  InterruptLatch : uint8_t { None = 0x00, Permanent = 0x01 }
 
enum  InternalMessage : uint8_t {
  NotInitialized = 0x00, Initialized = 0x01, InitError = 0x02, DriverError = 0x03,
  SensorError = 0x04, NvmError = 0x05, StartupError = 0x06, CompatibilityError = 0x07
}
 
enum  PullUpConfiguration : uint8_t { Off = 0x00, PullUp40k = 0x01, PullUp10k = 0x02, PullUp2k = 0x03 }
 
enum  InterfaceSpiMode : uint8_t { Spi4Wire = 0x00, Spi3Wire = 0x01 }
 
enum  DriveStrength : uint8_t {
  Level0 = 0b000, Level1 = 0b001, Level2 = 0b010, Level3 = 0b011,
  Level4 = 0b100, Level5 = 0b101, Level6 = 0b110, Level7 = 0b111
}
 
enum  Command : uint8_t { TriggerGyro = 0x02, ProgramNvm = 0xA0, FlushFifo = 0xB0, SoftReset = 0xB6 }
 
enum  FifoFilterData : uint8_t { Unfiltered = 0x00, Filtered = 0x01 }
 
enum  FifoTagInterrupt : uint8_t { Edge = 0x00, Level = 0x01, AccSaturation = 0x02, GyroSaturation = 0x03 }
 

Public Member Functions

 MODM_FLAGS8 (Status)
 
 MODM_FLAGS8 (PowerControl)
 
 MODM_FLAGS8 (PowerConfiguration)
 
template<typename... Args>
 Bmi270 (Args...transportArgs)
 
bool initialize (std::span< const uint8_t > configFile={})
 
bool reset ()
 Soft-reset device and wait for reset completion.
 
std::optional< DatareadData ()
 Read acceleration and gyroscope data and sensor time from one burst read.
 
std::optional< AccDatareadAccData ()
 
std::optional< GyroDatareadGyroData ()
 
bool readAccDataReady ()
 
bool readGyroDataReady ()
 
bool readCommandReady ()
 
std::optional< uint8_t > getChipId ()
 
std::optional< ErrorInfogetErrors ()
 
std::optional< SensorStatusgetStatus ()
 
std::optional< InternalStatusgetInternalStatus ()
 
std::optional< TemperaturegetTemperature ()
 
std::optional< InterruptStatusgetInterruptStatus ()
 
std::optional< ErrorInterruptMaskgetErrorInterruptMask ()
 
bool setErrorInterruptMask (ErrorInterruptMask mask)
 
std::optional< InterruptIoControlgetInt1IoControl ()
 
bool setInt1IoControl (InterruptIoControl control)
 
std::optional< InterruptIoControlgetInt2IoControl ()
 
bool setInt2IoControl (InterruptIoControl control)
 
std::optional< InterruptLatch > getInterruptLatch ()
 
bool setInterruptLatch (InterruptLatch mode)
 
std::optional< InterruptMapDatagetInterruptMapData ()
 
bool setInterruptMapData (InterruptMapData map)
 
std::optional< InternalErrorgetInternalError ()
 
std::optional< PullUpConfiguration > getPullUpConfiguration ()
 
bool setPullUpConfiguration (PullUpConfiguration configuration)
 
std::optional< GyroCrtConfiggetGyroCrtConfig ()
 
bool setGyroCrtConfig (GyroCrtConfig configuration)
 
std::optional< bool > getNvmCrtEnabled ()
 
bool setNvmCrtEnabled (bool enable)
 
bool triggerGyroCrt ()
 
bool doCrt (std::span< const uint8_t > configFile={})
 
std::optional< InterfaceConfiggetInterfaceConfig ()
 
bool setInterfaceConfig (InterfaceConfig configuration)
 
std::optional< DriveConfiggetDriveConfig ()
 
bool setDriveConfig (DriveConfig configuration)
 
std::optional< AccOffsetsgetAccOffsets ()
 
bool setAccOffsets (AccOffsets offsets)
 
std::optional< GyroOffsetsgetGyroOffsets ()
 
bool setGyroOffsets (GyroOffsets offsets)
 
std::optional< GyroUserGaingetGyroUserGain ()
 Read compensated gyroscope user-gain values.
 
bool setGyroUserGain (GyroUserGain gain)
 
std::optional< PowerConfiguration_t > getPowerConfiguration ()
 
bool setPowerConfiguration (PowerConfiguration_t configuration)
 
std::optional< PowerControl_t > getPowerControl ()
 
bool sendCommand (Command command)
 
bool setAccRate (AccRate rate)
 
bool setAccRange (AccRange range)
 
bool setGyroRate (GyroRate rate)
 
bool setGyroRange (GyroRange range)
 
bool setPowerControl (PowerControl_t control)
 Enable/disable sensor power domains.
 
std::optional< uint16_t > getFifoLength ()
 
std::optional< FifoDownsamplinggetFifoDownsampling ()
 
bool setFifoDownsampling (FifoDownsampling configuration)
 
std::optional< uint16_t > getFifoWatermark ()
 
bool setFifoWatermark (uint16_t watermark)
 
std::optional< FifoConfigurationgetFifoConfiguration ()
 
bool setFifoConfiguration (FifoConfiguration configuration)
 
std::optional< uint16_t > readFifo (std::span< uint8_t > buffer)
 
bool flushFifo ()
 

Detailed Description

template<Bmi270Transport Transport>
class modm::bmi270< Transport >

Bosch BMI270 IMU

The device contains an accelerometer and a gyroscope.

Template Parameters
TransportTransport layer (use Bmi270SpiTransport or Bmi270I2cTransport)

Member Function Documentation

template<Bmi270Transport Transport>
template<typename... Args>
modm::bmi270< Transport >::Bmi270 ( Args...  transportArgs)
  • transportArgs Arguments to transport layer.
template<Bmi270Transport Transport>
bool modm::bmi270< Transport >::doCrt ( std::span< const uint8_t >  configFile = {})

Perform component retrim (CRT) for the gyroscope.

If no configuration blob is passed, the built-in BMI270 configuration is used.

template<Bmi270Transport Transport>
bool modm::bmi270< Transport >::initialize ( std::span< const uint8_t >  configFile = {})

Initialize device. Call before any other member function.

Returns
true on success, false on error
template<Bmi270Transport Transport>
std::optional<uint16_t> modm::bmi270< Transport >::readFifo ( std::span< uint8_t >  buffer)

Read all currently available FIFO bytes into buffer.

Returns
Number of bytes read on success.
template<Bmi270Transport Transport>
bool modm::bmi270< Transport >::setGyroUserGain ( GyroUserGain  gain)

Write compensated gyroscope user-gain values.

Values are encoded on 7 bits per axis.


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