#include "imu_zr_hal.h"

extern I2C_HandleTypeDef hi2c1;  // CubeMX generated I2C instance
static IMU_ZR_HAL_Handle imu;

// In main() after MX_I2C1_Init():
IMU_ZR_HAL_Result start = IMU_ZR_HAL_Init(&imu, &hi2c1, 0);
if (start != IMU_ZR_HAL_OK) { /* report / handle initialization failure */ }

// Inside main loop, no faster than sensor ODR (104 Hz nominal):
IMU_ZR_HAL_Sample sample;
IMU_ZR_HAL_Result ret = IMU_ZR_HAL_Read(&imu, &sample);
if (ret == IMU_ZR_HAL_OK) {
  // sample.ax_mps2, sample.gx_rads etc. are sensor-native units/axes
} else if (ret == IMU_ZR_HAL_I2C_ERROR) {
  // I2C error handling
}
