/** * @file BNO08x.hpp * @author Myles Parfeniuk */ #pragma once // standard library includes #include #include #include #include #include #include // esp-idf includes #include #include #include #include #include #include #include // in-house includes #include "BNO08x_global_types.hpp" #include "BNO08xSH2HAL.hpp" /** * @class BNO08x * * @brief BNO08x IMU driver class. * */ class BNO08x { public: inline static sh2_SensorConfig default_sensor_cfg = {.changeSensitivityEnabled = false, /// cb_fxn); void print_product_ids(); private: /// @brief Holds info about which functionality has been successfully initialized (used by deconstructor during cleanup). typedef struct bno08x_init_status_t { bool gpio_outputs; ///< True if GPIO outputs have been initialized. bool gpio_inputs; ///< True if GPIO inputs have been initialized. bool isr_service; ///< True if global ISR service has been initialized. bool isr_handler; ///< True if HINT ISR handler has been initialized. bool data_proc_task; ///< True if xTaskCreate has been called successfully for data_proc_task. bool sh2_HAL_service_task; ///< True if xTaskCreate has been called successfully for sh2_HAL_service_task. bool spi_bus; ///< True if spi_bus_initialize() has been called successfully. bool spi_device; ///< True if spi_bus_add_device() has been called successfully. bool sh2_HAL; ///< True if sh2_open() has been called successfully. bno08x_init_status_t() : gpio_outputs(false) , gpio_inputs(false) , isr_service(false) , isr_handler(false) , data_proc_task(false) , spi_bus(false) , spi_device(false) { } } bno08x_init_status_t; /// @brief Holds data returned from sensor reports. typedef struct bno08x_data_t { sh2_Accelerometer_t gravity; sh2_Accelerometer_t linear_acceleration; } bno08x_data_t; typedef struct bno08x_usr_report_periods_t { uint32_t gravity; uint32_t linear_accelerometer; } bno08x_usr_report_periods_t; bno08x_data_t data; ///< Holds all data returned from enabled reports. bno08x_usr_report_periods_t user_report_periods; ///< Holds periods for reports enabled by user (0 == disabled report) // data processing task TaskHandle_t data_proc_task_hdl; ///> cb_list; // Vector for storing any call-back functions added with register_cb() bno08x_config_t imu_config{}; ///