|
M5Unit-IMU 0.0.2 git rev:e5b00aa
|
M5Unit-IMU specific wiring helpers (this library only; not part of M5UnitUnified's generic wiring) More...
#include <M5Unified.h>#include <M5UnitUnified.h>Go to the source code of this file.
Namespaces | |
| namespace | m5 |
| Top level namespace of M5Stack. | |
Functions | |
| bool | m5::unit::imu::wiring::i2cPortC (m5::unit::UnitUnified &units, m5::unit::Component &u, const bool bus_ready=false) |
| Route a GROVE unit to classic M5Stack Core Port C on a dedicated I2C bus. | |
M5Unit-IMU specific wiring helpers (this library only; not part of M5UnitUnified's generic wiring)
Helpers for connection cases specific to the units in this library, complementing M5UnitUnified's board-aware m5::unit::wiring (m5_unit_unified_wiring.hpp). Currently: routing a 0x68-addressed external unit to GROVE Port C on the classic M5Stack Core family, where GROVE Port A is the internal I2C bus (built-in IMU collision).
|
inline |
Route a GROVE unit to classic M5Stack Core Port C on a dedicated I2C bus.
| units | UnitUnified manager to register the unit with |
| u | Unit to connect |
| bus_ready | true: the Port C bus was already initialized by a previous call (shared-bus, multi-unit case) – only attach the unit, do NOT re-run the bus init |
On the classic Core family (board_M5Stack: Basic/Gray/Fire) GROVE Port A is the internal I2C bus, shared with Gray/Fire's built-in IMU at 0x68 – the same address as this library's external accel/gyro units. This helper opens GROVE Port C (needs the M5GO/Fire base; Grove pin1 -> SCL = port_c_pin1/RXD, pin2 -> SDA = port_c_pin2/TXD) on a bus of its own.
Why the lgfx I2C port 1: on classic Core BOTH HP I2C ports already sit with the lgfx i2c layer on the internal pins. In_I2C holds port 0 – the LIVE internal bus (M5Unified keeps polling the IP5306 power IC there, and on Arduino the Wire object is that same port 0, so using Wire here would fight In_I2C over one peripheral with different pins -> NACKs). M5GFX's autodetect probe holds port 1, which is idle afterwards (display is SPI, backlight is PWM, no touch on this family). So this rebinds port 1 to the Port C pins through the lgfx-backed m5::I2C_Class – an identical mechanism on Arduino and ESP-IDF (any IDF 5.x; the lgfx layer wraps old/new drivers).
Single-HP-I2C SoCs (ESP32-C6/H2 etc.) do not define I2C_NUM_1 and are never a classic Core, so on those this helper is compile-only and returns false.