#ifndef ST_LSM6DSOX_H #define ST_LSM6DSOX_H #include #include #include "imu/imu_sample.h" #ifndef ST_IMU_RAW_QUEUE_CAPACITY #define ST_IMU_RAW_QUEUE_CAPACITY 256u #endif typedef struct { uint32_t odr_hz; unsigned int accel_full_scale_g; unsigned int gyro_full_scale_dps; } st_lsm6dsox_config_t; typedef struct { uint64_t timestamp_ticks; int16_t temperature_raw; int16_t accel_raw[3]; int16_t gyro_raw[3]; uint32_t sequence; } st_lsm6dsox_raw_sample_t; typedef struct { uint64_t irq_count; uint64_t sample_count; uint64_t invalid_sample_count; uint64_t spurious_irq_count; uint64_t queue_overflow_count; uint64_t estimated_missed_sample_count; uint64_t last_timestamp_ticks; uint8_t who_am_i; bool initialized; bool running; } st_lsm6dsox_diagnostics_t; void st_lsm6dsox_default_config(st_lsm6dsox_config_t* config); bool st_lsm6dsox_init(const st_lsm6dsox_config_t* config); bool st_lsm6dsox_start(void); void st_lsm6dsox_stop(void); /* Called only by the common PLIC ISR for BSP_PMOD_IRQ. */ void st_lsm6dsox_irq_handler(void); /* Retained as a no-op so every backend has the same service interface. */ void st_lsm6dsox_service(void); bool st_lsm6dsox_take_measurement( imu_sample_t* measurement_out); void st_lsm6dsox_get_diagnostics( st_lsm6dsox_diagnostics_t* diagnostics_out); #endif