In development. It changes without notice.
Topic
Motion Sensor Drivers
The BMI270 and MPU6886 motion sensors, and a stand-in for the boards with none.
| Sensor | Boards |
|---|---|
| Bmi270 | Core2 v1.3, M5Cardputer ADV, M5StickS3 |
| Mpu6886 | M5StickC Plus 1.1, M5StickC Plus2 |
| NullImu | CoreInk, CoreS3 SE, LILYGO T-Deck, M5StickC Plus SE |
Both drivers talk to the chip's registers directly. The BMI270 is given the configuration image its maker publishes at each start. Where the supply stays on through a sleep, the sensor is put to sleep first.
- See also
- Motion & Shake-to-Lock
Files | |
| file | src/ |
| Bosch BMI270 accelerometer/ | |
| file | src/ |
| Pure encode/decode helpers behind the BMI270 driver's register sequences. | |
| file | src/ |
| The configuration image the BMI270 driver uploads, as pinned data. | |
| file | src/ |
| BMI270 register addresses, bit masks, values and timings the driver uses. | |
| file | src/ |
| Chip-level inertial-measurement-unit (accel/gyro) driver contract. | |
| file | src/ |
| WHO_AM_I probe factory for the inertial-measurement-unit driver. | |
| file | src/ |
| Pure decision helpers + shared constants for the kleidos:: | |
| file | src/ |
| Driver for MPU6886-compatible accelerometer/ | |
| file | src/ |
| MPU-6886 register addresses, bit masks, values and timings the driver uses. | |
| file | src/ |
| No-op IMU driver for the boards without an inertial sensor. | |
Classes | |
| class | kleidos:: |
| Bosch BMI270 6-axis IMU driver (8 g accel, 2000 dps gyro). Runs the accelerometer only; the gyroscope stays off (PWR_CTRL) until setGyroEnabled powers it up. More about kleidos:: | |
| struct | kleidos:: |
| The two INIT_ADDR bytes a burst starting at one byte offset needs. More about kleidos:: | |
| struct | kleidos:: |
| What a chip that may have kept its configuration reports about itself. More about kleidos:: | |
| struct | kleidos:: |
| An any-motion configuration in physical units. More about kleidos:: | |
| struct | kleidos:: |
| One configuration image the chip can run once it is uploaded. More about kleidos:: | |
| class | kleidos:: |
| Chip-level accelerometer/ | |
| class | kleidos:: |
| MPU6886-compatible 6-axis IMU driver (also accepts MPU6050/ | |
| class | kleidos:: |
| No-op IMU used on the boards that have no inertial sensor. More about kleidos:: | |
Enumerations | |
| enum class | kleidos:: |
| IMU family selected by an identity probe. More about kleidos:: | |
Functions | |
| const ConfigImage & | kleidos:: |
| Bosch's base 8 KiB image (BMI270_ | |
| constexpr ImuFamily | kleidos:: |
| Classify an IMU from its identity-register reads (pure, no I2C). | |
| constexpr bool | kleidos:: |
Whether the probe must still read register 0x75 for the MPU6886 family once register 0x00 has been read. | |
| IImu * | kleidos:: |
| Resolve and return the fitted IMU driver. | |
| constexpr bool | kleidos:: |
| Whether a register write-readback proves the I2C WRITE path. | |
| constexpr bool | kleidos:: |
| Whether an acceleration magnitude shows gravity is present. | |
Configuration and power registers (§5.2.41 to §5.2.44, §5.2.84, §5.2.85) | |
| constexpr uint8_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| constexpr std::array< uint8_t, 4 > | kleidos:: |
| constexpr uint8_t | kleidos:: |
| ACC_CONF: output data rate, bandwidth parameter and filter mode. | |
| constexpr uint8_t | kleidos:: |
| GYR_CONF: output data rate, bandwidth and the two performance modes. | |
| constexpr uint8_t | kleidos:: |
| PWR_CTRL with the accelerometer and gyroscope enables (temperature and auxiliary off). | |
| constexpr uint8_t | kleidos:: |
| PWR_CONF with advanced power save on or off. | |
| constexpr uint32_t | kleidos:: |
| Time one register burst holds the bus, START to STOP. | |
| constexpr size_t | kleidos:: |
| Longest INIT_DATA burst the bus's clock allows. | |
Any-motion feature words (§4.8.2, FEATURES page 1) | |
| constexpr AnyMotionConfig | kleidos:: |
| The chip's own reset configuration: 83 mg (0xAA) for 100 ms (5 samples), every axis. | |
| constexpr AnyMotionConfig | kleidos:: |
| constexpr uint16_t | kleidos:: |
| Largest ANYMO_ | |
| constexpr uint16_t | kleidos:: |
| Largest ANYMO_ | |
| constexpr uint32_t | kleidos:: |
| ANYMO_ | |
| constexpr uint32_t | kleidos:: |
| ANYMO_ | |
| constexpr uint16_t | kleidos:: |
ANYMO_mg milli-g, rounded and clamped. | |
| constexpr uint16_t | kleidos:: |
ANYMO_ms milliseconds, in 20 ms samples, rounded and clamped. | |
| constexpr std::array< uint8_t, 4 > | kleidos:: |
| The four FEATURES bytes from 0x3C on (page 1): ANYMO_1 then ANYMO_2, each little-endian. | |
BMI270 register values and bit masks | |
| constexpr uint8_t | kleidos:: |
| CHIP_ID of a BMI270. | |
| constexpr uint8_t | kleidos:: |
| CMD: soft reset (§4.17). | |
| constexpr uint8_t | kleidos:: |
| INIT_CTRL: prepare the upload. | |
| constexpr uint8_t | kleidos:: |
| INIT_CTRL: complete it (once per reset). | |
| constexpr uint8_t | kleidos:: |
| PWR_ | |
| constexpr uint8_t | kleidos:: |
| PWR_ | |
| constexpr uint8_t | kleidos:: |
| PWR_ | |
| constexpr uint8_t | kleidos:: |
| PWR_ | |
| constexpr uint8_t | kleidos:: |
| INTERNAL_ | |
| constexpr uint8_t | kleidos:: |
| INTERNAL_ | |
| constexpr uint8_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| ERR_ | |
| constexpr uint8_t | kleidos:: |
| int_err_1, int_err_2, feat_ | |
| constexpr uint8_t | kleidos:: |
| EVENT.por_ | |
| constexpr uint8_t | kleidos:: |
| EVENT.error_ | |
| constexpr uint8_t | kleidos:: |
| EVENT.error_ | |
| constexpr uint8_t | kleidos:: |
| FEAT_PAGE reset value (§5.2.39). | |
| constexpr uint8_t | kleidos:: |
| FEAT_PAGE holding ANYMO_ | |
| constexpr uint8_t | kleidos:: |
| INTx_ | |
| constexpr uint8_t | kleidos:: |
| ANYMO_ | |
| constexpr uint8_t | kleidos:: |
| INT_ | |
| constexpr uint8_t | kleidos:: |
| INTx_ | |
| constexpr uint8_t | kleidos:: |
| INTx_ | |
| constexpr uint8_t | kleidos:: |
| INTx_ | |
| constexpr uint8_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| INT1 back to its reset value: output and input disabled. | |
BMI270: what a fresh bring-up leaves in the configuration registers (§5.2) | |
A chip that kept its configuration through a deep sleep is checked against these before the upload is skipped: reset values plus the sensor configuration the driver programs, so a difference in any register compared here (the any-motion interrupt left armed, a debug-console write) falls back to a full bring-up. Not compared, so a difference there lasts through a resumed wake until the next upload: the FEATURES words of every page (only FEAT_PAGE itself is checked, and must read 0), the configuration memory behind INIT_ADDR / INIT_DATA (reading it back would take as long as the upload), INIT_CTRL (0x59), which the resume does not rewrite either, the NVM-backed AUX_IF_TRIM (0x68) and DRV (0x6C), which sit outside every compared block, and the NVM-backed offset values masked out of | |
| constexpr std::array< uint8_t, 16 > | kleidos:: |
| constexpr std::array< uint8_t, 16 > | kleidos:: |
| constexpr std::array< uint8_t, 7 > | kleidos:: |
| ERR_REG_MSK (0x52) to INT_MAP_DATA (0x58): reset values, every interrupt off. | |
| constexpr std::array< uint8_t, 3 > | kleidos:: |
| constexpr std::array< uint8_t, 3 > | kleidos:: |
| constexpr std::array< uint8_t, 8 > | kleidos:: |
| constexpr std::array< uint8_t, 8 > | kleidos:: |
| constexpr size_t | kleidos:: |
| The longest block compared in one read. | |
BMI270 timings | |
| constexpr uint32_t | kleidos:: |
| constexpr uint32_t | kleidos:: |
| constexpr uint32_t | kleidos:: |
| constexpr uint32_t | kleidos:: |
| Time between two samples while the gyroscope runs (100 Hz, performance mode). | |
| constexpr uint32_t | kleidos:: |
| constexpr uint32_t | kleidos:: |
| constexpr uint32_t | kleidos:: |
| Interval between later looks. | |
| constexpr uint32_t | kleidos:: |
BMI270 configuration upload | |
| constexpr size_t | kleidos:: |
| Largest image the chip can take: INIT_ADDR is a 12-bit word address. | |
| constexpr uint32_t | kleidos:: |
| constexpr size_t | kleidos:: |
| constexpr uint32_t | kleidos:: |
| Bits one byte takes on the wire: eight of data and the acknowledge. | |
| constexpr uint32_t | kleidos:: |
MPU6886 register values and bit masks | |
| constexpr uint8_t | kleidos:: |
| PWR_ | |
| constexpr uint8_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| PWR_ | |
| constexpr uint8_t | kleidos:: |
| PWR_MGMT_1 for the accelerometer alone: cycle mode on the auto clock. | |
| constexpr uint8_t | kleidos:: |
| PWR_MGMT_1 with the gyroscope running: continuous (low-noise) sampling. | |
| constexpr uint8_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| PWR_MGMT_2 with no standby bit set: every accelerometer and gyroscope axis on. | |
| constexpr uint8_t | kleidos:: |
| ACCEL_ | |
| constexpr uint8_t | kleidos:: |
| GYRO_ | |
| constexpr uint8_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| SMPLRT_DIV for 50 Hz, the rate shake-to-lock reads at: 1 kHz / (1 + 19). | |
| constexpr uint8_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| INT_PIN_CFG while wake-on-motion is armed. | |
| constexpr uint8_t | kleidos:: |
| INT_ENABLE / INT_STATUS: wake-on-motion on X, Y and Z (bits 7..5). | |
| constexpr uint8_t | kleidos:: |
| INT_ENABLE: no source on the pin. | |
| constexpr uint8_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| constexpr uint8_t | kleidos:: |
| ACCEL_ | |
| constexpr uint8_t | kleidos:: |
| constexpr std::array< uint8_t, 3 > | kleidos:: |
| The three threshold registers' values, in register order. | |
| constexpr float | kleidos:: |
| g per LSB at ±8 g. | |
| constexpr float | kleidos:: |
| dps per LSB at ±2000 dps. | |
MPU6886 timings and the bus | |
| constexpr uint32_t | kleidos:: |
| Wait after DEVICE_RESET before the first register write. | |
| constexpr uint32_t | kleidos:: |
| constexpr uint32_t | kleidos:: |
| constexpr uint32_t | kleidos:: |
| Bus clock the driver runs the chip at: I2C fast mode, the chip's maximum. | |
Configuration upload (§4.4, §5.2.65, §5.2.66) | |
| constexpr InitAddr | kleidos:: |
INIT_ADDR for a burst that starts byteOffset bytes into the image. | |
| constexpr bool | kleidos:: |
Whether an image of bytes bytes can be uploaded at all. | |
| constexpr size_t | kleidos:: |
Number of bursts an image of imageBytes takes at chunkBytes each. | |
| constexpr size_t | kleidos:: |
Length of burst index of an image of imageBytes. | |
Keeping the configuration across a deep sleep (§4.4, §5.2.2, §5.2.27, §5.2.33, §5.2.68) | |
| constexpr const char * | kleidos:: |
| Why a chip cannot be trusted to have kept its configuration. | |
Samples (§4.6.1, §5.2.12 to §5.2.23) | |
| constexpr int16_t | kleidos:: |
| One signed 16-bit quantity from its little-endian register pair. | |
| constexpr float | kleidos:: |
| An accelerometer reading in g at the driver's ±8 g range. | |
| constexpr float | kleidos:: |
| A gyroscope reading in deg/s at the driver's ±2000 dps range. | |
Enumeration Type Documentation
ImuFamily #
InternalStatus #
INTERNAL_
Function Documentation
accConf() #
ACC_CONF: output data rate, bandwidth parameter and filter mode.
- Parameters
-
Name Direction Meaning odr in acc_odr code (bits 3..0). bwp in acc_bwp code (bits 6..4). performance in acc_ filter_ perf (bit 7): true = performance mode.
- Returns
- The register value.
accelG() #
An accelerometer reading in g at the driver's ±8 g range.
- Parameters
-
Name Direction Meaning raw in The register value.
- Returns
- Acceleration in g (4096 LSB per g).
anyMotionDurationSamples() #
ANYMO_ms milliseconds, in 20 ms samples, rounded and clamped.
- Parameters
-
Name Direction Meaning ms in Duration in ms.
- Returns
- The 13-bit field value.
anyMotionThresholdLsb() #
ANYMO_mg milli-g, rounded and clamped.
- Parameters
-
Name Direction Meaning mg in Threshold in mg.
- Returns
- The 11-bit field value.
baseConfigImage() #
Bosch's base 8 KiB image (BMI270_
Raw accelerometer and gyroscope plus the feature engine. Defined in the generated translation unit, which compiles only for a board with a BMI270.
- Returns
- The pinned image; it lives for the whole program.
burstMicros() #
Time one register burst holds the bus, START to STOP.
- Parameters
-
Name Direction Meaning dataBytes in Bytes after the register address. frequencyHz in Bus clock in Hz.
- Returns
- Microseconds for the address byte, the register byte and the data, nine bits each.
chunkCount() #
Number of bursts an image of imageBytes takes at chunkBytes each.
- Parameters
-
Name Direction Meaning imageBytes in Image length. chunkBytes in Burst length; even and non-zero.
- Returns
- The burst count; the last burst may be shorter.
chunkLength() #
Length of burst index of an image of imageBytes.
- Parameters
-
Name Direction Meaning imageBytes in Image length. chunkBytes in Burst length; even and non-zero. index in Burst number, from 0.
- Returns
chunkBytesfor every burst but the last, which takes what is left; 0 past the end.
classifyImu() #
Classify an IMU from its identity-register reads (pure, no I2C).
Register 0x00 disambiguates the BMI270 (0x24) from the QMI8658 (0x05); register 0x75 identifies the MPU6886 family. A caller reads only the register(s) relevant to the families compiled into the build and passes their success flags, so an unread register can never false-match.
- Parameters
-
Name Direction Meaning reg00Ok in Whether the register 0x00read succeeded.reg00 in Value read from register 0x00(ignored ifreg00Okis false).regMpuOk in Whether the register 0x75read succeeded.regMpu in Value read from register 0x75(ignored ifregMpuOkis false).
- Returns
- The detected ImuFamily, or ImuFamily::
None if nothing matched.
configurationLostReason() #
Why a chip cannot be trusted to have kept its configuration.
The chip must say init_ok (a soft reset or a rail cut puts it back to not_init), no power-on event and no configuration error since the last read, and no error flag raised: anything else re-runs the whole upload. A feature page left away from 0 or a self-test excitation left on are what a debug-console write could leave behind and a fresh bring-up would have cleared.
- Parameters
-
Name Direction Meaning evidence in The register values read from the chip.
- Returns
- A short lowercase reason, or nullptr when the configuration is kept.
createImu() #
Resolve and return the fitted IMU driver.
Probes address on the internal I2C bus for the IMU families compiled into this build, then returns the matching driver (constructed but not yet initialized — the caller runs IImu::init). On no match, an unsupported chip (QMI8658), a probe failure, or a board with no IMU family compiled in, returns the shared kleidos::
- Parameters
-
Name Direction Meaning address in 7-bit I2C address of the IMU (typically 0x68).
- Returns
- A driver owned by function-local
staticstorage (never delete, nevernullptr).
decodeLe16() #
One signed 16-bit quantity from its little-endian register pair.
- Parameters
-
Name Direction Meaning low in The byte at the lower address. high in The byte above it.
- Returns
- The two's-complement value.
encodeAnyMotion() #
The four FEATURES bytes from 0x3C on (page 1): ANYMO_1 then ANYMO_2, each little-endian.
A whole-word write, as the feature engine requires (§4.8.1): it starts at an even address and ends at an odd one. out_conf stays 7, so the output lands on bit 6 of INT_STATUS_0 and INTx_
- Parameters
-
Name Direction Meaning config in The configuration. enable in ANYMO_ 2.enable.
- Returns
- The bytes to write at kRegAnyMotion.
eventErrorCode() #
EVENT.error_
- Parameters
-
Name Direction Meaning raw in The register byte.
- Returns
- 0 for none, 1 ACC_CONF, 2 GYR_CONF, 3 both.
eventPorDetected() #
EVENT.por_
- Parameters
-
Name Direction Meaning raw in The register byte.
- Returns
- The flag.
gyrConf() #
GYR_CONF: output data rate, bandwidth and the two performance modes.
- Parameters
-
Name Direction Meaning odr in gyr_odr code (bits 3..0). bwp in gyr_bwp code (bits 5..4). lowNoise in gyr_ noise_ perf (bit 6). performance in gyr_ filter_ perf (bit 7).
- Returns
- The register value.
gyroDps() #
A gyroscope reading in deg/s at the driver's ±2000 dps range.
- Parameters
-
Name Direction Meaning raw in The register value.
- Returns
- Angular rate in deg/s.
imageSizeValid() #
Whether an image of bytes bytes can be uploaded at all.
- Parameters
-
Name Direction Meaning bytes in Image length.
- Return values
-
Value Meaning true Non-empty, a whole number of words, and within the 12-bit word space. false Anything else; the driver uploads nothing.
initAddrForOffset() #
INIT_ADDR for a burst that starts byteOffset bytes into the image.
The configuration memory is addressed in 16-bit words, so the address is the offset halved, split over the two registers.
- Parameters
-
Name Direction Meaning byteOffset in Even offset into the image, below kMaxImageBytes.
- Returns
- The bytes to write at INIT_ADDR_0 and INIT_ADDR_1, in that order.
internalStatusMessage() #
The message field of an INTERNAL_
- Parameters
-
Name Direction Meaning raw in The register byte.
- Returns
- Its message; a reserved code (8..15) comes back as that number.
internalStatusName() #
A name for an INTERNAL_
- Parameters
-
Name Direction Meaning status in The decoded message.
- Returns
- A short lowercase name; "reserved" for a code the datasheet leaves open.
mpuProbeNeeded() #
Whether the probe must still read register 0x75 for the MPU6886 family once register 0x00 has been read.
Not when register 0x00 already names a chip: the classification would ignore 0x75 anyway, and a BMI270 suspended through a deep sleep needs 400 µs of bus idle before a new transfer (datasheet Table 20), which a read right behind the first would not give it.
- Parameters
-
Name Direction Meaning reg00Ok in Whether the register 0x00read succeeded.reg00 in Value read from register 0x00.
- Return values
-
Value Meaning true Register 0x00named no chip; read0x75.false Register 0x00identified the chip; skip0x75.
pwrConf() #
PWR_CONF with advanced power save on or off.
fifo_
- Parameters
-
Name Direction Meaning advancedPowerSave in adv_ power_ save.
- Returns
- The register value.
pwrCtrl() #
PWR_CTRL with the accelerometer and gyroscope enables (temperature and auxiliary off).
- Parameters
-
Name Direction Meaning accel in acc_en. gyro in gyr_en.
- Returns
- The register value.
selfTestMagnitudePlausible() #
Whether an acceleration magnitude shows gravity is present.
- Parameters
-
Name Direction Meaning magG in Acceleration magnitude in g.
- Return values
-
Value Meaning true magGsits within [kSelfTestMagMinG, kSelfTestMagMaxG].false The reading is implausibly small or large (no valid sample).
selfTestWriteVerified() #
Whether a register write-readback proves the I2C WRITE path.
Compares only the writable field bits selected by mask; reserved bits (which read back as 0) are ignored, so a full-register mask of 0xFF collapses to exact equality.
- Parameters
-
Name Direction Meaning readback in Value read back after writing pattern.pattern in Test pattern written to the register. mask in Writable-field bitmask for the register.
- Return values
-
Value Meaning true The writable bits of readbackmatchpattern.false The write did not take effect on the writable bits.
uploadBurstBytes() #
Longest INIT_DATA burst the bus's clock allows.
The burst length follows the clock the chip is actually run at: a bus that grants the driver's rate takes longestBytes, and one that keeps a slower rate takes shorter bursts, so no burst holds the bus past budgetUs whatever the clock (256 bytes at 100 kHz would hold it 23 ms, longer than the 20 ms another task's transfer waits).
- Parameters
-
Name Direction Meaning frequencyHz in Clock the chip's transfers run at, Hz. budgetUs in Longest a burst may hold the bus, µs. longestBytes in Longest burst wanted; even and non-zero.
- Returns
- The largest even burst length, at most
longestBytes, that burstMicros puts withinbudgetUs; one word where no burst fits (the upload still has to be made).
Variable Documentation
kAccConfLowPower #
ACC_CONF while only the accelerometer runs: 50 Hz, two samples averaged, filter performance off, which with PWR_
kAccConfPerformance #
ACC_CONF while the gyroscope runs too: 100 Hz, normal filter, performance mode, the pair of the gyroscope's own configuration.
kAccelConfig2Average4 #
ACCEL_CONFIG2 for the low-power mode's 4-sample average: DEC2_CFG 0, ACCEL_
kAnyMotionShakeGate #
What the driver arms: a slope of 250 mg between samples on any axis, held for two samples (40 ms). A shake that reaches the gesture's 2 g crosses it in its first tens of milliseconds; a board resting on a desk someone types at does not.
kConfigDlpf #
CONFIG.DLPF_
kFirstSampleMs [1/2] #
From the accelerometer being enabled to its first sample in the data registers: the 2 ms start-up time (Table 2) and one 50 Hz period, with margin.
kFirstSampleMs [2/2] #
From the accelerometer being switched on (a reset, or leaving sleep) to its first sample in the output registers: one period, with margin.
kFreshCompensationFrom70 #
NV_CONF (0x70) to OFFSET_6 (0x77): the I2C watchdog and every offset or gain compensation off, as on a chip as shipped.
kFreshCompensationFrom70Mask #
Mask for kFreshCompensationFrom70, which keeps NV_CONF's i2c_wdt_sel, i2c_wdt_en and acc_off_en, and OFFSET_6's gyr_off_en and gyr_gain_en. The offset values themselves are NVM-backed, so a soft reset reloads them from the chip's own NVM, which the driver cannot know; with every compensation off they change no sample, so they are left out, as are the other NVM-backed registers, AUX_IF_TRIM (0x68, the unused auxiliary bus's pull-up) and DRV (0x6C, the pad drive the check's own reads have just gone through).
kFreshConfigFrom40 #
ACC_CONF (0x40) to AUX_WR_DATA (0x4F): the driver's sensor configuration, then the auxiliary-interface and FIFO reset values.
kFreshConfigFrom40Mask #
Mask for kFreshConfigFrom40, which leaves out SATURATION (0x4A), a live per-axis flag.
kFreshInterfaceFrom69 #
GYR_CRT_CONF (0x69), NVM_CONF (0x6A), IF_CONF (0x6B): reset values, so no gyroscope retrimming, no NVM programming, no OIS or auxiliary interface.
kFreshInterfaceFrom69Mask #
Mask for kFreshInterfaceFrom69, which keeps the defined fields only (crt_running and rdy_for_dl; nvm_prog_en; spi3, spi3_ois, ois_en and aux_en).
kI2cFrequencyHz #
Bus clock the driver runs the chip at: I2C fast mode (Table 20), which every other chip on the internal bus of the three BMI270 boards is rated for. The chip itself takes fast mode plus (1 MHz).
kInitStatusBudgetMs #
Nominal waits before giving up on init_ok: well past the datasheet's 20 ms, as the 140 ms other hosts allow. They make 14 looks (the first wait, then 13 polls), and each wait is asked one tick longer so it never ends early, so the real bound is about 164 ms of waiting plus the 14 reads.
kInitStatusFirstWaitMs #
First look at INTERNAL_
kInt1IoCtrlMotionWake #
INT1 as the M5StickS3's M5PM1 wakes on it (a falling edge on its GPIO4): output enabled, active low, push-pull, so the line needs no pull-up to idle high.
kIntelMotionOn #
ACCEL_
kIntelOutputLimit #
ACCEL_
kInternalStatusOdr50Hz #
INTERNAL_
kInternalStatusOdrHigh #
INTERNAL_
kIntIoInputEn #
INTx_
kIntLatchNone #
INT_
kIntPinActiveLowOpenDrain #
INT_PIN_CFG: INT_LEVEL (active low) and INT_OPEN (open drain), so the pin only ever pulls low on a line other open-drain outputs share.
kIntPinLatch #
INT_
kLowPowerSamplePeriodMs #
Time between two accelerometer samples in the low-power setup the driver programs (50 Hz, §4.6.5): reading the data registers more often returns the same sample again.
kPowerCycle #
PWR_
kPowerGyroStandby #
PWR_MGMT_2 with STBY_XG | STBY_YG | STBY_ZG set: the three gyroscope axes in standby, the three accelerometer axes running. With the gyroscope down the clock auto-select falls back to the internal oscillator (§9.8).
kPowerSaveGapUs #
Bus idle after every access while PWR_
kPowerSleep #
PWR_
kSamplePeriodMs #
Time between two samples at the kSampleRateDiv50Hz rate; reading the output registers more often returns the same sample again.
kSensorConfig #
The four bytes from ACC_CONF on that the driver programs, in register order: accelerometer 50 Hz in low-power mode, ±8 g; gyroscope 100 Hz, normal filter, low noise and performance mode, ±2000 dps (it stays off until asked for).
kSoftResetSettleMs #
Settle after a soft reset before the interface may be used: the power-on time tPO (Table 1), which §4.17 applies to a soft reset too.
kUploadBurstBudgetUs #
Longest a burst may hold the bus, in µs: half the 20 ms another task's transfer waits for it (bus::).
kUploadChunkBytes #
Bytes per INIT_DATA burst. The chip takes the whole image in one (§4.4); the bound is the bus, which a burst holds from START to STOP while every other task's transfer waits behind it for at most its own timeout: 256 bytes are 5.8 ms at 400 kHz. Each burst needs an even length (word addresses). This is the length at kI2cFrequencyHz; on a bus that keeps a slower clock the driver sends what uploadBurstBytes() fits in kUploadBurstBudgetUs.
kWomThreshold #
Wake-on-motion threshold, the same on X, Y and Z: 60 LSB. The specification gives no weight for the LSB; the family's other parts count 4 mg, which makes this 240 mg, the size of the BMI270's gate.