M5Unit-IMU 0.0.2 git rev:e5b00aa
Loading...
Searching...
No Matches
m5::unit::ak8963::Data Struct Reference

One AK8963 sample: an 8-byte burst from ST1 (0x02) plus the device ASA trim. More...

#include <unit_ak8963_data.hpp>

Public Member Functions

bool drdy () const
 Data ready (ST1 bit0)
 
bool dor () const
 Data overrun (ST1 bit1 DOR): a sample was read too late and one was skipped.
 
bool overflow () const
 Magnetic overflow (ST2 bit3 HOFL); sample invalid if set.
 
bool bit16 () const
 16bit output? (ST2 bit4 BITM)
 
int16_t x_raw () const
 Raw X (little-endian, signed 16bit)
 
int16_t y_raw () const
 Raw Y.
 
int16_t z_raw () const
 Raw Z.
 
int32_t adj_x () const
 ASA-adjusted X in library-wide 16 LSB/µT.
 
int32_t adj_y () const
 ASA-adjusted Y.
 
int32_t adj_z () const
 ASA-adjusted Z.
 

Public Attributes

std::array< uint8_t, 8 > raw {}
 ST1 + X/Y/Z (LE) + ST2.
 
std::array< uint8_t, 3 > asa {}
 Per-axis sensitivity adjustment (device constant)
 

Detailed Description

One AK8963 sample: an 8-byte burst from ST1 (0x02) plus the device ASA trim.

raw = {ST1, HXL, HXH, HYL, HYH, HZL, HZH, ST2}. Axes are little-endian. adj_*() apply the per-axis sensitivity adjustment and rescale to the library-wide 16 LSB/µT convention (so imu_convert_param_t::mag_res stays a uniform 1/16).

Member Function Documentation

◆ bit16()

bool m5::unit::ak8963::Data::bit16 ( ) const
inline

16bit output? (ST2 bit4 BITM)

Note
BITM mirrors CNTL1's BIT, so every sample carries the width it was taken at and adj_*() cannot disagree with the chip