modm API documentation
modm::Bmi270I2cTransport< I2cMaster > Class Template Reference

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

Inheritance diagram for modm::Bmi270I2cTransport< I2cMaster >:
modm::Bmi270TransportBase modm::I2cEeprom< I2cMaster, 1 > modm::I2cDevice< I2cMaster, 1, i2c_eeprom::detail::DataTransmissionAdapter< 2 > >

Public Types

enum  I2cAddress : uint8_t { SdoLow = 0x68, SdoHigh = 0x69 }
 
enum  Register : uint8_t {
  ChipId = 0x00, Error = 0x02, Status = 0x03, AccDataXLow = 0x0C,
  GyroDataXLow = 0x12, SensorTime0 = 0x18, InterruptStatus0 = 0x1C, InterruptStatus1 = 0x1D,
  InternalStatus = 0x21, Temperature0 = 0x22, FifoLength0 = 0x24, FifoData = 0x26,
  FeatPage = 0x2F, Features = 0x30, AccConf = 0x40, AccRange = 0x41,
  GyroConf = 0x42, GyroRange = 0x43, FifoDowns = 0x45, FifoWtm0 = 0x46,
  FifoConfig0 = 0x48, ErrRegMask = 0x52, Int1IoCtrl = 0x53, Int2IoCtrl = 0x54,
  IntLatch = 0x55, IntMapData = 0x58, InitControl = 0x59, InitAddress0 = 0x5B,
  InitAddress1 = 0x5C, InitData = 0x5E, InternalError = 0x5F, AuxIfTrim = 0x68,
  GyroCrtConf = 0x69, NvmConf = 0x6A, IfConf = 0x6B, Drv = 0x6C,
  NvConf = 0x70, Offset0 = 0x71, Offset3 = 0x74, Offset6 = 0x77,
  GyroUserGain0 = 0x78, PowerConf = 0x7C, PowerCtrl = 0x7D, Command = 0x7E
}
 

Public Member Functions

 Bmi270I2cTransport (I2cAddress=I2cAddress::SdoLow)
 
 Bmi270I2cTransport (const Bmi270I2cTransport &) = delete
 
Bmi270I2cTransport & operator= (const Bmi270I2cTransport &) = delete
 
void initialize ()
 
std::span< uint8_t > readRegisters (Register startReg, uint8_t count)
 
bool writeRegister (Register reg, uint8_t data)
 
bool writeRegisters (Register startReg, std::span< const uint8_t > data)
 
bool readFifoData (std::span< uint8_t > data)
 
void attachConfigurationHandler (I2c::ConfigurationHandler handler)
 
bool ping ()
 
bool read (uint32_t address, uint8_t *data, std::size_t length)
 Read block.
 
bool read (uint16_t address, T &data)
 
bool read (uint8_t *buffer, std::size_t size)
 Starts a write transaction and waits until finished.
 
bool readByte (uint32_t address, uint8_t &data)
 Read byte.
 
void setAddress (uint8_t address)
 
bool write (uint32_t address, const uint8_t *data, std::size_t length)
 
bool write (uint32_t address, const T &data)
 
bool write (const uint8_t *buffer, std::size_t size)
 Starts a write transaction and waits until finished.
 
bool writeByte (uint32_t address, uint8_t data)
 
bool writeRead (const uint8_t *writeBuffer, std::size_t writeSize, uint8_t *readBuffer, std::size_t readSize)
 Starts a write-read transaction and waits until finished.
 

Static Public Attributes

static constexpr uint8_t MaxRegisterSequence {32}
 

Protected Member Functions

bool isTransactionRunning ()
 
bool runTransaction ()
 Starts our own transaction and waits until finished.
 
bool startTransaction ()
 Starts the transaction with our own transaction object.
 
bool startTransaction (modm::I2cTransaction *transaction)
 Starts the transaction with a separate transaction object.
 
bool wasTransactionSuccessful ()
 

Protected Attributes

i2c_eeprom::detail::DataTransmissionAdapter< 2 > transaction
 

Detailed Description

template<typename I2cMaster>
class modm::Bmi270I2cTransport< I2cMaster >

BMI270 I2C transport. Pass as template parameter to Bmi270 driver class.

Template Parameters
I2cMasterI2C master the device is connected to

Member Function Documentation

void modm::I2cDevice< I2cMaster, 10 , i2c_eeprom::detail::DataTransmissionAdapter< 2 > >::attachConfigurationHandler ( I2c::ConfigurationHandler  handler)
inheritedinline

Attaches a configuration handler, which is called before a transaction, whenever the configuration has to be changed.

bool modm::I2cDevice< I2cMaster, 10 , i2c_eeprom::detail::DataTransmissionAdapter< 2 > >::isTransactionRunning ( )
inheritedinlineprotected
Returns
true when transaction is busy.
bool modm::I2cDevice< I2cMaster, 10 , i2c_eeprom::detail::DataTransmissionAdapter< 2 > >::ping ( )
inheritedinline
Return Values
truedevice responds to address
falseno device with address found
bool modm::I2cEeprom< I2cMaster, 2 >::read ( uint16_t  address,
T &  data 
)
inheritedinline

Convenience function

Shortcut for:

return read(address, static_cast<uint8_t *>(&data), sizeof(T));
void modm::I2cDevice< I2cMaster, 10 , i2c_eeprom::detail::DataTransmissionAdapter< 2 > >::setAddress ( uint8_t  address)
inheritedinline

Sets a new address of the slave device.

Parameters
addressthe slave address not yet shifted left (address < 128).
bool modm::I2cDevice< I2cMaster, 10 , i2c_eeprom::detail::DataTransmissionAdapter< 2 > >::wasTransactionSuccessful ( )
inheritedinlineprotected
Returns
true when transaction did not return an error.
bool modm::I2cEeprom< I2cMaster, 2 >::write ( uint32_t  address,
const T &  data 
)
inheritedinline

Convenience function

Shortcut for:

return write(address, static_cast<const uint8_t *>(&data), sizeof(T));
bool modm::I2cEeprom< I2cMaster, 2 >::write ( uint32_t  address,
const uint8_t *  data,
std::size_t  length 
)
inherited

Write block

Parameters
addressAddress
dataData block
lengthNumber of bytes to be written
Returns
true if the data could be written, false otherwise
bool modm::I2cEeprom< I2cMaster, 2 >::writeByte ( uint32_t  address,
uint8_t  data 
)
inheritedinline

Write byte

Parameters
addressAddress
dataData byte
Returns
true if the data could be written, false otherwise

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