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

UnitBMI270 (6-axis IMU) unit component. More...

#include <M5UnitComponent.hpp>
#include <m5_utility/container/circular_buffer.hpp>
#include <memory>
#include "unit_bmi270_data.hpp"
#include "unit_bmm150_data.hpp"
#include "../imu/imu_data_source.hpp"

Go to the source code of this file.

Classes

class  m5::unit::UnitBMI270
 6-axis (accel + gyro) IMU unit. CoreS3/AtomS3R built-in More...
 
struct  m5::unit::UnitBMI270::config_t
 Settings for begin() More...
 

Namespaces

namespace  m5
 Top level namespace of M5Stack.
 

Functions

template<class ReadReg >
bool m5::unit::bmi270::detectAddress (ReadReg read, uint8_t &addr)
 Detect which I2C address a built-in BMI270 uses on a bus (0x68 or 0x69, board-dependent)
 

Variables

constexpr uint32_t m5::unit::bmi270::DEFAULT_STORED_SIZE {8}
 Default ring buffer depth (used to construct the internal buffer and as the component_config().stored_size default; see config_t)
 
constexpr uint8_t m5::unit::bmi270::CHIP_ID {0x24}
 BMI270 chip identifier (value read from command::REG_CHIP_ID)
 

Detailed Description

UnitBMI270 (6-axis IMU) unit component.

Function Documentation

◆ detectAddress()

template<class ReadReg >
bool m5::unit::bmi270::detectAddress ( ReadReg read,
uint8_t & addr )

Detect which I2C address a built-in BMI270 uses on a bus (0x68 or 0x69, board-dependent)

Probes both candidate addresses by reading CHIP_ID and reports the one where a BMI270 answers. Framework-agnostic: the caller injects the bus read, so the unit library stays free of M5Unified / Arduino Wire. Hand the detected address to the constructor:

uint8_t a{};
if (m5::unit::bmi270::detectAddress(read, a)) { m5::unit::UnitBMI270 unit{a}; }
6-axis (accel + gyro) IMU unit. CoreS3/AtomS3R built-in
Definition unit_bmi270.hpp:34
Unit-related namespace.
Template Parameters
ReadRegCallable bool(uint8_t addr, uint8_t reg, uint8_t& out) reading one register over the target bus and returning true on success (ACK)
Parameters
readThe read callable
[out]addrDetected address on success (unchanged on failure)
Returns
true if a BMI270 responded at 0x68 or 0x69