19#ifndef M5_UNIT_IMU_IMU_IMU_DETECT_HPP
20#define M5_UNIT_IMU_IMU_IMU_DETECT_HPP
23#include <initializer_list>
50template <
class ReadReg>
56 if (read(
static_cast<uint8_t
>(0x68),
static_cast<uint8_t
>(0x75),
id)) {
59 return ImuKind::MPU6886;
61 return ImuKind::MPU6050;
63 return ImuKind::MPU9250;
70 for (
const uint8_t candidate : {
static_cast<uint8_t
>(0x68),
static_cast<uint8_t
>(0x69)}) {
71 if (read(candidate,
static_cast<uint8_t
>(0x00), id) &&
id == 0x24) {
72 return ImuKind::BMI270;
77 if (read(
static_cast<uint8_t
>(0x6C),
static_cast<uint8_t
>(0x30),
id) &&
id == 0x18) {
78 return ImuKind::SH200Q;
ImuKind
Which built-in accel/gyro chip a host carries.
Definition imu_detect.hpp:30
@ MPU9250
InvenSense MPU9250 at 0x68 (WHO_AM_I 0x71), with an internal AK8963 mag.
@ SH200Q
Senodia SH200Q at 0x6C (WHO_AM_I 0x18)
@ MPU6886
InvenSense MPU6886 at 0x68 (WHO_AM_I 0x19)
@ None
No accel/gyro responded (e.g. an IMU-less M5Stack Basic)
@ BMI270
Bosch BMI270 at 0x68 or 0x69 (CHIP_ID 0x24)
@ MPU6050
InvenSense MPU6050 at 0x68 (WHO_AM_I 0x68)
ImuKind detectBuiltinImu(ReadReg read)
Probe the internal bus for a built-in accel/gyro chip.
Definition imu_detect.hpp:51
Top level namespace of M5Stack.
Definition ahrs_controller.cpp:26