#pragma once //esp-idf includes #include #include #include #include #include #include #include #include #include #include #include //standard library includes #include #include #include #include #include #include /// @brief SHTP protocol channels enum channels_t { CHANNEL_COMMAND, CHANNEL_EXECUTABLE, CHANNEL_CONTROL, CHANNEL_REPORTS, CHANNEL_WAKE_REPORTS, CHANNEL_GYRO }; /// @brief Sensor accuracy returned during sensor calibration enum class IMUAccuracy { LOW = 1, MED, HIGH }; /// @brief IMU configuration settings passed into constructor typedef struct bno08x_config_t { spi_host_device_t spi_peripheral; /// cb_fxn); uint32_t get_time_stamp(); void get_magf(float& x, float& y, float& z, uint8_t& accuracy); float get_magf_X(); float get_magf_Y(); float get_magf_Z(); uint8_t get_magf_accuracy(); void get_gravity(float& x, float& y, float& z, uint8_t& accuracy); float get_gravity_X(); float get_gravity_Y(); float get_gravity_Z(); uint8_t get_gravity_accuracy(); float get_roll(); float get_pitch(); float get_yaw(); float get_roll_deg(); float get_pitch_deg(); float get_yaw_deg(); void get_quat(float& i, float& j, float& k, float& real, float& rad_accuracy, uint8_t& accuracy); float get_quat_I(); float get_quat_J(); float get_quat_K(); float get_quat_real(); float get_quat_radian_accuracy(); uint8_t get_quat_accuracy(); void get_accel(float& x, float& y, float& z, uint8_t& accuracy); float get_accel_X(); float get_accel_Y(); float get_accel_Z(); uint8_t get_accel_accuracy(); void get_linear_accel(float& x, float& y, float& z, uint8_t& accuracy); float get_linear_accel_X(); float get_linear_accel_Y(); float get_linear_accel_Z(); uint8_t get_linear_accel_accuracy(); int16_t get_raw_accel_X(); int16_t get_raw_accel_Y(); int16_t get_raw_accel_Z(); int16_t get_raw_gyro_X(); int16_t get_raw_gyro_Y(); int16_t get_raw_gyro_Z(); int16_t get_raw_magf_X(); int16_t get_raw_magf_Y(); int16_t get_raw_magf_Z(); void get_gyro_calibrated_velocity(float& x, float& y, float& z, uint8_t& accuracy); float get_gyro_calibrated_velocity_X(); float get_gyro_calibrated_velocity_Y(); float get_gyro_calibrated_velocity_Z(); uint8_t get_gyro_accuracy(); void get_uncalibrated_gyro(float& x, float& y, float& z, float& bx, float& by, float& bz, uint8_t& accuracy); float get_uncalibrated_gyro_X(); float get_uncalibrated_gyro_Y(); float get_uncalibrated_gyro_Z(); float get_uncalibrated_gyro_bias_X(); float get_uncalibrated_gyro_bias_Y(); float get_uncalibrated_gyro_bias_Z(); uint8_t get_uncalibrated_gyro_accuracy(); void get_gyro_velocity(float& x, float& y, float& z); float get_gyro_velocity_X(); float get_gyro_velocity_Y(); float get_gyro_velocity_Z(); uint8_t get_tap_detector(); uint16_t get_step_count(); int8_t get_stability_classifier(); uint8_t get_activity_classifier(); // Metadata functions int16_t get_Q1(uint16_t record_ID); int16_t get_Q2(uint16_t record_ID); int16_t get_Q3(uint16_t record_ID); float get_resolution(uint16_t record_ID); float get_range(uint16_t record_ID); uint32_t FRS_read_word(uint16_t record_ID, uint8_t word_number); bool FRS_read_request(uint16_t record_ID, uint16_t read_offset, uint16_t block_size); bool FRS_read_data(uint16_t record_ID, uint8_t start_location, uint8_t words_to_read); // Record IDs from figure 29, page 29 reference manual // These are used to read the metadata for each sensor type static const constexpr uint16_t FRS_RECORD_ID_ACCELEROMETER = 0xE302; ///< Accelerometer record ID, to be passed in metadata functions like get_Q1() static const constexpr uint16_t FRS_RECORD_ID_GYROSCOPE_CALIBRATED = 0xE306; ///< Calirated gyroscope record ID, to be passed in metadata functions like get_Q1() static const constexpr uint16_t FRS_RECORD_ID_MAGNETIC_FIELD_CALIBRATED = 0xE309; ///< Calibrated magnetometer record ID, to be passed in metadata functions like get_Q1() static const constexpr uint16_t FRS_RECORD_ID_ROTATION_VECTOR = 0xE30B; ///< Rotation vector record ID, to be passed in metadata functions like get_Q1() static const constexpr uint8_t TARE_AXIS_ALL = 0x07; ///< Tare all axes (used with tare now command) static const constexpr uint8_t TARE_AXIS_Z = 0x04; ///< Tar yaw axis only (used with tare now command) // Which rotation vector to tare, BNO08x saves them seperately static const constexpr uint8_t TARE_ROTATION_VECTOR = 0; ///> cb_list; //Vector for storing any call-back functions added with register_cb() uint32_t meta_data[9]; ///