From 05006334201b1a22d85603df19d637130d5c408d Mon Sep 17 00:00:00 2001 From: myles-parfeniuk Date: Tue, 5 Mar 2024 02:04:52 -0800 Subject: [PATCH] Disable report fxns, modified sending procedure, updated README.md --- BNO08x.cpp | 354 +++++- BNO08x.hpp | 63 +- README.md | 4 +- documentation/html/_b_n_o08x_8hpp_source.html | 1122 +++++++++-------- .../html/class_b_n_o08x-members.html | 69 +- documentation/html/class_b_n_o08x.html | 723 ++++++++--- documentation/html/functions_d.html | 18 + documentation/html/functions_e.html | 36 +- documentation/html/functions_func.html | 56 +- documentation/html/functions_q.html | 2 +- documentation/html/functions_t.html | 3 +- documentation/html/functions_vars.html | 1 - .../md_esp32___b_n_o08x_2_r_e_a_d_m_e.html | 24 +- documentation/html/search/all_3.js | 20 +- documentation/html/search/all_4.js | 36 +- documentation/html/search/all_c.js | 2 +- documentation/html/search/all_f.js | 7 +- documentation/html/search/functions_2.js | 20 +- documentation/html/search/functions_3.js | 36 +- documentation/html/search/functions_a.js | 2 +- documentation/html/search/variables_e.js | 3 +- documentation/latex/_b_n_o08x_8hpp_source.tex | 573 +++++---- documentation/latex/class_b_n_o08x.tex | 444 +++++-- .../md_esp32___b_n_o08x_2_r_e_a_d_m_e.tex | 4 +- esp32_BNO08x_receieve_flowchart.png | Bin 121554 -> 232446 bytes esp32_BNO08x_send_flowchart.png | Bin 114426 -> 199416 bytes esp32_BNO08x_wiring.png | Bin 12876 -> 24420 bytes 27 files changed, 2317 insertions(+), 1305 deletions(-) diff --git a/BNO08x.cpp b/BNO08x.cpp index 72c3977..83f8a9a 100644 --- a/BNO08x.cpp +++ b/BNO08x.cpp @@ -13,8 +13,7 @@ bno08x_config_t BNO08x::default_imu_config; * @return void, nothing to return */ BNO08x::BNO08x(bno08x_config_t imu_config) - : tx_packet_queued(0U) - , tx_semaphore(xSemaphoreCreateRecursiveMutex()) + : tx_semaphore(xSemaphoreCreateBinary()) , int_asserted_semaphore(xSemaphoreCreateBinary()) , imu_config(imu_config) , calibration_status(1) @@ -385,8 +384,6 @@ void BNO08x::queue_packet(uint8_t channel_number, uint8_t data_length) packet_length_tx = data_length + 4; // add 4 bytes for header uint8_t i = 0; - xSemaphoreTake(tx_semaphore, portMAX_DELAY); - memset(tx_buffer, 0, sizeof(tx_buffer)); tx_buffer[0] = packet_length_tx & 0xFF; // packet length LSB @@ -400,8 +397,6 @@ void BNO08x::queue_packet(uint8_t channel_number, uint8_t data_length) tx_buffer[i + 4] = commands[i]; } - tx_packet_queued = 1; - xSemaphoreGive(tx_semaphore); } @@ -423,8 +418,6 @@ void BNO08x::send_packet() spi_device_polling_transmit(spi_hdl, &spi_transaction); // send data packet gpio_set_level(imu_config.io_cs, 1); // de-assert chip select - - tx_packet_queued = 0; } /** @@ -996,10 +989,10 @@ uint16_t BNO08x::parse_command_report() /** * @brief Sends command to enable game rotation vector reports (See Ref. Manual 6.5.19) * - * @param time_between_reports Desired time between reports in miliseconds. + * @param time_between_reports Desired time between reports in microseconds. * @return void, nothing to return */ -void BNO08x::enable_game_rotation_vector(uint16_t time_between_reports) +void BNO08x::enable_game_rotation_vector(uint32_t time_between_reports) { queue_feature_command(SENSOR_REPORTID_GAME_ROTATION_VECTOR, time_between_reports); wait_for_device_int(); // wait for next interrupt such that command is sent @@ -1009,10 +1002,10 @@ void BNO08x::enable_game_rotation_vector(uint16_t time_between_reports) /** * @brief Sends command to enable rotation vector reports (See Ref. Manual 6.5.18) * - * @param time_between_reports Desired time between reports in miliseconds. + * @param time_between_reports Desired time between reports in microseconds. * @return void, nothing to return */ -void BNO08x::enable_rotation_vector(uint16_t time_between_reports) +void BNO08x::enable_rotation_vector(uint32_t time_between_reports) { queue_feature_command(SENSOR_REPORTID_ROTATION_VECTOR, time_between_reports); wait_for_device_int(); // wait for next interrupt such that command is sent @@ -1022,10 +1015,10 @@ void BNO08x::enable_rotation_vector(uint16_t time_between_reports) /** * @brief Sends command to enable ARVR stabilized rotation vector reports (See Ref. Manual 6.5.42) * - * @param time_between_reports Desired time between reports in miliseconds. + * @param time_between_reports Desired time between reports in microseconds. * @return void, nothing to return */ -void BNO08x::enable_ARVR_stabilized_rotation_vector(uint16_t time_between_reports) +void BNO08x::enable_ARVR_stabilized_rotation_vector(uint32_t time_between_reports) { queue_feature_command(SENSOR_REPORTID_AR_VR_STABILIZED_ROTATION_VECTOR, time_between_reports); wait_for_device_int(); // wait for next interrupt such that command is sent @@ -1035,10 +1028,10 @@ void BNO08x::enable_ARVR_stabilized_rotation_vector(uint16_t time_between_report /** * @brief Sends command to enable ARVR stabilized game rotation vector reports (See Ref. Manual 6.5.43) * - * @param time_between_reports Desired time between reports in miliseconds. + * @param time_between_reports Desired time between reports in microseconds. * @return void, nothing to return */ -void BNO08x::enable_ARVR_stabilized_game_rotation_vector(uint16_t time_between_reports) +void BNO08x::enable_ARVR_stabilized_game_rotation_vector(uint32_t time_between_reports) { queue_feature_command(SENSOR_REPORTID_AR_VR_STABILIZED_GAME_ROTATION_VECTOR, time_between_reports); wait_for_device_int(); // wait for next interrupt such that command is sent @@ -1048,10 +1041,10 @@ void BNO08x::enable_ARVR_stabilized_game_rotation_vector(uint16_t time_between_r /** * @brief Sends command to enable gyro integrated rotation vector reports (See Ref. Manual 6.5.44) * - * @param time_between_reports Desired time between reports in miliseconds. + * @param time_between_reports Desired time between reports in microseconds. * @return void, nothing to return */ -void BNO08x::enable_gyro_integrated_rotation_vector(uint16_t time_between_reports) +void BNO08x::enable_gyro_integrated_rotation_vector(uint32_t time_between_reports) { queue_feature_command(SENSOR_REPORTID_GYRO_INTEGRATED_ROTATION_VECTOR, time_between_reports); wait_for_device_int(); // wait for next interrupt such that command is sent @@ -1061,10 +1054,10 @@ void BNO08x::enable_gyro_integrated_rotation_vector(uint16_t time_between_report /** * @brief Sends command to enable accelerometer reports (See Ref. Manual 6.5.9) * - * @param time_between_reports Desired time between reports in miliseconds. + * @param time_between_reports Desired time between reports in microseconds. * @return void, nothing to return */ -void BNO08x::enable_accelerometer(uint16_t time_between_reports) +void BNO08x::enable_accelerometer(uint32_t time_between_reports) { queue_feature_command(SENSOR_REPORTID_ACCELEROMETER, time_between_reports); wait_for_device_int(); // wait for next interrupt such that command is sent @@ -1074,10 +1067,10 @@ void BNO08x::enable_accelerometer(uint16_t time_between_reports) /** * @brief Sends command to enable linear accelerometer reports (See Ref. Manual 6.5.10) * - * @param time_between_reports Desired time between reports in miliseconds. + * @param time_between_reports Desired time between reports in microseconds. * @return void, nothing to return */ -void BNO08x::enable_linear_accelerometer(uint16_t time_between_reports) +void BNO08x::enable_linear_accelerometer(uint32_t time_between_reports) { queue_feature_command(SENSOR_REPORTID_LINEAR_ACCELERATION, time_between_reports); wait_for_device_int(); // wait for next interrupt such that command is sent @@ -1087,10 +1080,10 @@ void BNO08x::enable_linear_accelerometer(uint16_t time_between_reports) /** * @brief Sends command to enable gravity reading reports (See Ref. Manual 6.5.11) * - * @param time_between_reports Desired time between reports in miliseconds. + * @param time_between_reports Desired time between reports in microseconds. * @return void, nothing to return */ -void BNO08x::enable_gravity(uint16_t time_between_reports) +void BNO08x::enable_gravity(uint32_t time_between_reports) { queue_feature_command(SENSOR_REPORTID_GRAVITY, time_between_reports); wait_for_device_int(); // wait for next interrupt such that command is sent @@ -1100,10 +1093,10 @@ void BNO08x::enable_gravity(uint16_t time_between_reports) /** * @brief Sends command to enable gyro reports (See Ref. Manual 6.5.13) * - * @param time_between_reports Desired time between reports in miliseconds. + * @param time_between_reports Desired time between reports in microseconds. * @return void, nothing to return */ -void BNO08x::enable_gyro(uint16_t time_between_reports) +void BNO08x::enable_gyro(uint32_t time_between_reports) { queue_feature_command(SENSOR_REPORTID_GYROSCOPE, time_between_reports); wait_for_device_int(); // wait for next interrupt such that command is sent @@ -1113,10 +1106,10 @@ void BNO08x::enable_gyro(uint16_t time_between_reports) /** * @brief Sends command to enable uncalibrated gyro reports (See Ref. Manual 6.5.14) * - * @param time_between_reports Desired time between reports in miliseconds. + * @param time_between_reports Desired time between reports in microseconds. * @return void, nothing to return */ -void BNO08x::enable_uncalibrated_gyro(uint16_t time_between_reports) +void BNO08x::enable_uncalibrated_gyro(uint32_t time_between_reports) { queue_feature_command(SENSOR_REPORTID_UNCALIBRATED_GYRO, time_between_reports); wait_for_device_int(); // wait for next interrupt such that command is sent @@ -1126,10 +1119,10 @@ void BNO08x::enable_uncalibrated_gyro(uint16_t time_between_reports) /** * @brief Sends command to enable magnetometer reports (See Ref. Manual 6.5.16) * - * @param time_between_reports Desired time between reports in miliseconds. + * @param time_between_reports Desired time between reports in microseconds. * @return void, nothing to return */ -void BNO08x::enable_magnetometer(uint16_t time_between_reports) +void BNO08x::enable_magnetometer(uint32_t time_between_reports) { queue_feature_command(SENSOR_REPORTID_MAGNETIC_FIELD, time_between_reports); wait_for_device_int(); // wait for next interrupt such that command is sent @@ -1139,10 +1132,10 @@ void BNO08x::enable_magnetometer(uint16_t time_between_reports) /** * @brief Sends command to enable tap detector reports (See Ref. Manual 6.5.27) * - * @param time_between_reports Desired time between reports in miliseconds. + * @param time_between_reports Desired time between reports in microseconds. * @return void, nothing to return */ -void BNO08x::enable_tap_detector(uint16_t time_between_reports) +void BNO08x::enable_tap_detector(uint32_t time_between_reports) { queue_feature_command(SENSOR_REPORTID_TAP_DETECTOR, time_between_reports); wait_for_device_int(); // wait for next interrupt such that command is sent @@ -1152,10 +1145,10 @@ void BNO08x::enable_tap_detector(uint16_t time_between_reports) /** * @brief Sends command to enable step counter reports (See Ref. Manual 6.5.29) * - * @param time_between_reports Desired time between reports in miliseconds. + * @param time_between_reports Desired time between reports in microseconds. * @return void, nothing to return */ -void BNO08x::enable_step_counter(uint16_t time_between_reports) +void BNO08x::enable_step_counter(uint32_t time_between_reports) { queue_feature_command(SENSOR_REPORTID_STEP_COUNTER, time_between_reports); wait_for_device_int(); // wait for next interrupt such that command is sent @@ -1165,10 +1158,10 @@ void BNO08x::enable_step_counter(uint16_t time_between_reports) /** * @brief Sends command to enable activity stability classifier reports (See Ref. Manual 6.5.31) * - * @param time_between_reports Desired time between reports in miliseconds. + * @param time_between_reports Desired time between reports in microseconds. * @return void, nothing to return */ -void BNO08x::enable_stability_classifier(uint16_t time_between_reports) +void BNO08x::enable_stability_classifier(uint32_t time_between_reports) { queue_feature_command(SENSOR_REPORTID_STABILITY_CLASSIFIER, time_between_reports); wait_for_device_int(); // wait for next interrupt such that command is sent @@ -1178,12 +1171,12 @@ void BNO08x::enable_stability_classifier(uint16_t time_between_reports) /** * @brief Sends command to enable activity classifier reports (See Ref. Manual 6.5.36) * - * @param time_between_reports Desired time between reports in miliseconds. + * @param time_between_reports Desired time between reports in microseconds. * @param activities_to_enable Desired activities to enable (0x1F enables all). * @param activity_confidence_vals Returned activity level confidences. * @return void, nothing to return */ -void BNO08x::enable_activity_classifier(uint16_t time_between_reports, uint32_t activities_to_enable, uint8_t (&activity_confidence_vals)[9]) +void BNO08x::enable_activity_classifier(uint32_t time_between_reports, uint32_t activities_to_enable, uint8_t (&activity_confidence_vals)[9]) { activity_confidences = activity_confidence_vals; // Store pointer to array queue_feature_command(SENSOR_REPORTID_PERSONAL_ACTIVITY_CLASSIFIER, time_between_reports, activities_to_enable); @@ -1194,10 +1187,10 @@ void BNO08x::enable_activity_classifier(uint16_t time_between_reports, uint32_t /** * @brief Sends command to enable raw accelerometer reports (See Ref. Manual 6.5.8) * - * @param time_between_reports Desired time between reports in miliseconds. + * @param time_between_reports Desired time between reports in microseconds. * @return void, nothing to return */ -void BNO08x::enable_raw_accelerometer(uint16_t time_between_reports) +void BNO08x::enable_raw_accelerometer(uint32_t time_between_reports) { queue_feature_command(SENSOR_REPORTID_RAW_ACCELEROMETER, time_between_reports); wait_for_device_int(); // wait for next interrupt such that command is sent @@ -1207,10 +1200,10 @@ void BNO08x::enable_raw_accelerometer(uint16_t time_between_reports) /** * @brief Sends command to enable raw gyro reports (See Ref. Manual 6.5.12) * - * @param time_between_reports Desired time between reports in miliseconds. + * @param time_between_reports Desired time between reports in microseconds. * @return void, nothing to return */ -void BNO08x::enable_raw_gyro(uint16_t time_between_reports) +void BNO08x::enable_raw_gyro(uint32_t time_between_reports) { queue_feature_command(SENSOR_REPORTID_RAW_GYROSCOPE, time_between_reports); wait_for_device_int(); // wait for next interrupt such that command is sent @@ -1220,16 +1213,232 @@ void BNO08x::enable_raw_gyro(uint16_t time_between_reports) /** * @brief Sends command to enable raw magnetometer reports (See Ref. Manual 6.5.15) * - * @param time_between_reports Desired time between reports in miliseconds. + * @param time_between_reports Desired time between reports in microseconds. * @return void, nothing to return */ -void BNO08x::enable_raw_magnetometer(uint16_t time_between_reports) +void BNO08x::enable_raw_magnetometer(uint32_t time_between_reports) { queue_feature_command(SENSOR_REPORTID_RAW_MAGNETOMETER, time_between_reports); wait_for_device_int(); // wait for next interrupt such that command is sent vTaskDelay(50 / portTICK_PERIOD_MS); // allow some time for command to be executed } +/** + * @brief Sends command to disable rotation vector reports by setting report interval to 0. + * + * @return void, nothing to return + */ +void BNO08x::disable_rotation_vector() +{ + queue_feature_command(SENSOR_REPORTID_ROTATION_VECTOR, 0); + wait_for_device_int(); // wait for next interrupt such that command is sent + vTaskDelay(50 / portTICK_PERIOD_MS); // allow some time for command to be executed +} + +/** + * @brief Sends command to disable game rotation vector reports by setting report interval to 0. + * + * @return void, nothing to return + */ +void BNO08x::disable_game_rotation_vector() +{ + queue_feature_command(SENSOR_REPORTID_GAME_ROTATION_VECTOR, 0); + wait_for_device_int(); // wait for next interrupt such that command is sent + vTaskDelay(50 / portTICK_PERIOD_MS); // allow some time for command to be executed +} + +/** + * @brief Sends command to disable ARVR stabilized rotation vector reports by setting report interval to 0. + * + * @return void, nothing to return + */ +void BNO08x::disable_ARVR_stabilized_rotation_vector() +{ + queue_feature_command(SENSOR_REPORTID_AR_VR_STABILIZED_ROTATION_VECTOR, 0); + wait_for_device_int(); // wait for next interrupt such that command is sent + vTaskDelay(50 / portTICK_PERIOD_MS); // allow some time for command to be executed +} + +/** + * @brief Sends command to disable ARVR stabilized game rotation vector reports by setting report interval to 0. + * + * @return void, nothing to return + */ +void BNO08x::disable_ARVR_stabilized_game_rotation_vector() +{ + queue_feature_command(SENSOR_REPORTID_AR_VR_STABILIZED_GAME_ROTATION_VECTOR, 0); + wait_for_device_int(); // wait for next interrupt such that command is sent + vTaskDelay(50 / portTICK_PERIOD_MS); // allow some time for command to be executed +} + +/** + * @brief Sends command to disable gyro integrated rotation vector reports by setting report interval to 0. + * + * @return void, nothing to return + */ +void BNO08x::disable_gyro_integrated_rotation_vector() +{ + queue_feature_command(SENSOR_REPORTID_ROTATION_VECTOR, 0); + wait_for_device_int(); // wait for next interrupt such that command is sent + vTaskDelay(50 / portTICK_PERIOD_MS); // allow some time for command to be executed +} + +/** + * @brief Sends command to disable accelerometer reports by setting report interval to 0. + * + * @return void, nothing to return + */ +void BNO08x::disable_accelerometer() +{ + queue_feature_command(SENSOR_REPORTID_ACCELEROMETER, 0); + wait_for_device_int(); // wait for next interrupt such that command is sent + vTaskDelay(50 / portTICK_PERIOD_MS); // allow some time for command to be executed +} + +/** + * @brief Sends command to disable linear accelerometer reports by setting report interval to 0. + * + * @return void, nothing to return + */ +void BNO08x::disable_linear_accelerometer() +{ + queue_feature_command(SENSOR_REPORTID_LINEAR_ACCELERATION, 0); + wait_for_device_int(); // wait for next interrupt such that command is sent + vTaskDelay(50 / portTICK_PERIOD_MS); // allow some time for command to be executed +} + +/** + * @brief Sends command to disable gravity reports by setting report interval to 0. + * + * @return void, nothing to return + */ +void BNO08x::disable_gravity() +{ + queue_feature_command(SENSOR_REPORTID_GRAVITY, 0); + wait_for_device_int(); // wait for next interrupt such that command is sent + vTaskDelay(50 / portTICK_PERIOD_MS); // allow some time for command to be executed +} + +/** + * @brief Sends command to disable gyro reports by setting report interval to 0. + * + * @return void, nothing to return + */ +void BNO08x::disable_gyro() +{ + queue_feature_command(SENSOR_REPORTID_GYROSCOPE, 0); + wait_for_device_int(); // wait for next interrupt such that command is sent + vTaskDelay(50 / portTICK_PERIOD_MS); // allow some time for command to be executed +} + +/** + * @brief Sends command to disable uncalibrated gyro reports by setting report interval to 0. + * + * @return void, nothing to return + */ +void BNO08x::disable_uncalibrated_gyro() +{ + queue_feature_command(SENSOR_REPORTID_UNCALIBRATED_GYRO, 0); + wait_for_device_int(); // wait for next interrupt such that command is sent + vTaskDelay(50 / portTICK_PERIOD_MS); // allow some time for command to be executed +} + +/** + * @brief Sends command to disable magnetometer reports by setting report interval to 0. + * + * @return void, nothing to return + */ +void BNO08x::disable_magnetometer() +{ + queue_feature_command(SENSOR_REPORTID_MAGNETIC_FIELD, 0); + wait_for_device_int(); // wait for next interrupt such that command is sent + vTaskDelay(50 / portTICK_PERIOD_MS); // allow some time for command to be executed +} + +/** + * @brief Sends command to disable tap detector reports by setting report interval to 0. + * + * @return void, nothing to return + */ +void BNO08x::disable_tap_detector() +{ + queue_feature_command(SENSOR_REPORTID_TAP_DETECTOR, 0); + wait_for_device_int(); // wait for next interrupt such that command is sent + vTaskDelay(50 / portTICK_PERIOD_MS); // allow some time for command to be executed +} + +/** + * @brief Sends command to disable step counter reports by setting report interval to 0. + * + * @return void, nothing to return + */ +void BNO08x::disable_step_counter() +{ + queue_feature_command(SENSOR_REPORTID_STEP_COUNTER, 0); + wait_for_device_int(); // wait for next interrupt such that command is sent + vTaskDelay(50 / portTICK_PERIOD_MS); // allow some time for command to be executed +} + +/** + * @brief Sends command to disable stability reports by setting report interval to 0. + * + * @return void, nothing to return + */ +void BNO08x::disable_stability_classifier() +{ + queue_feature_command(SENSOR_REPORTID_STABILITY_CLASSIFIER, 0); + wait_for_device_int(); // wait for next interrupt such that command is sent + vTaskDelay(50 / portTICK_PERIOD_MS); // allow some time for command to be executed +} + +/** + * @brief Sends command to disable activity classifier reports by setting report interval to 0. + * + * @return void, nothing to return + */ +void BNO08x::disable_activity_classifier() +{ + queue_feature_command(SENSOR_REPORTID_PERSONAL_ACTIVITY_CLASSIFIER, 0); + wait_for_device_int(); // wait for next interrupt such that command is sent + vTaskDelay(50 / portTICK_PERIOD_MS); // allow some time for command to be executed +} + +/** + * @brief Sends command to disable raw accelerometer reports by setting report interval to 0. + * + * @return void, nothing to return + */ +void BNO08x::disable_raw_accelerometer() +{ + queue_feature_command(SENSOR_REPORTID_RAW_ACCELEROMETER, 0); + wait_for_device_int(); // wait for next interrupt such that command is sent + vTaskDelay(50 / portTICK_PERIOD_MS); // allow some time for command to be executed +} + +/** + * @brief Sends command to disable raw gyro reports by setting report interval to 0. + * + * @return void, nothing to return + */ +void BNO08x::disable_raw_gyro() +{ + queue_feature_command(SENSOR_REPORTID_RAW_GYROSCOPE, 0); + wait_for_device_int(); // wait for next interrupt such that command is sent + vTaskDelay(50 / portTICK_PERIOD_MS); // allow some time for command to be executed +} + +/** + * @brief Sends command to disable raw magnetometer reports by setting report interval to 0. + * + * @return void, nothing to return + */ +void BNO08x::disable_raw_magnetometer() +{ + queue_feature_command(SENSOR_REPORTID_RAW_MAGNETOMETER, 0); + wait_for_device_int(); // wait for next interrupt such that command is sent + vTaskDelay(50 / portTICK_PERIOD_MS); // allow some time for command to be executed +} + /** * @brief Sends command to tare an axis (See Ref. Manual 6.4.4.1) * @@ -2335,33 +2544,32 @@ bool BNO08x::FRS_read_data(uint16_t record_ID, uint8_t start_location, uint8_t w * Manual 6.5.4) * * @param report_ID ID of sensor report to be enabled. - * @param time_between_reports Desired time between reports in miliseconds. + * @param time_between_reports Desired time between reports in microseconds. * @param specific_config Specific config word (used with personal activity classifier) * * @return void, nothing to return */ -void BNO08x::queue_feature_command(uint8_t report_ID, uint16_t time_between_reports, uint32_t specific_config) +void BNO08x::queue_feature_command(uint8_t report_ID, uint32_t time_between_reports, uint32_t specific_config) { - uint32_t us_between_reports = (uint32_t) time_between_reports * 1000UL; memset(commands, 0, sizeof(commands)); - commands[0] = SHTP_REPORT_SET_FEATURE_COMMAND; // Set feature command (See Ref. Manual 6.5.4) - commands[1] = report_ID; // Feature Report ID. 0x01 = Accelerometer, 0x05 = Rotation vector - commands[2] = 0; // Feature flags - commands[3] = 0; // Change sensitivity (LSB) - commands[4] = 0; // Change sensitivity (MSB) - commands[5] = (us_between_reports >> 0) & 0xFF; // Report interval (LSB) in microseconds. 0x7A120 = 500ms - commands[6] = (us_between_reports >> 8) & 0xFF; // Report interval - commands[7] = (us_between_reports >> 16) & 0xFF; // Report interval - commands[8] = (us_between_reports >> 24) & 0xFF; // Report interval (MSB) - commands[9] = 0; // Batch Interval (LSB) - commands[10] = 0; // Batch Interval - commands[11] = 0; // Batch Interval - commands[12] = 0; // Batch Interval (MSB) - commands[13] = (specific_config >> 0) & 0xFF; // Sensor-specific config (LSB) - commands[14] = (specific_config >> 8) & 0xFF; // Sensor-specific config - commands[15] = (specific_config >> 16) & 0xFF; // Sensor-specific config - commands[16] = (specific_config >> 24) & 0xFF; // Sensor-specific config (MSB) + commands[0] = SHTP_REPORT_SET_FEATURE_COMMAND; // Set feature command (See Ref. Manual 6.5.4) + commands[1] = report_ID; // Feature Report ID. 0x01 = Accelerometer, 0x05 = Rotation vector + commands[2] = 0; // Feature flags + commands[3] = 0; // Change sensitivity (LSB) + commands[4] = 0; // Change sensitivity (MSB) + commands[5] = (time_between_reports >> 0) & 0xFF; // Report interval (LSB) in microseconds. 0x7A120 = 500ms + commands[6] = (time_between_reports >> 8) & 0xFF; // Report interval + commands[7] = (time_between_reports >> 16) & 0xFF; // Report interval + commands[8] = (time_between_reports >> 24) & 0xFF; // Report interval (MSB) + commands[9] = 0; // Batch Interval (LSB) + commands[10] = 0; // Batch Interval + commands[11] = 0; // Batch Interval + commands[12] = 0; // Batch Interval (MSB) + commands[13] = (specific_config >> 0) & 0xFF; // Sensor-specific config (LSB) + commands[14] = (specific_config >> 8) & 0xFF; // Sensor-specific config + commands[15] = (specific_config >> 16) & 0xFF; // Sensor-specific config + commands[16] = (specific_config >> 24) & 0xFF; // Sensor-specific config (MSB) // Transmit packet on channel 2, 17 bytes queue_packet(CHANNEL_CONTROL, 17); @@ -2401,7 +2609,7 @@ void BNO08x::queue_tare_command(uint8_t command, uint8_t axis, uint8_t rotation_ * * @return void, nothing to return */ -void BNO08x::queue_feature_command(uint8_t report_ID, uint16_t time_between_reports) +void BNO08x::queue_feature_command(uint8_t report_ID, uint32_t time_between_reports) { queue_feature_command(report_ID, time_between_reports, 0); // No specific config } @@ -2426,18 +2634,24 @@ void BNO08x::spi_task_trampoline(void* arg) */ void BNO08x::spi_task() { + static uint64_t prev_time = 0; + while (1) { - ulTaskNotifyTake(pdTRUE, portMAX_DELAY); // block until notified by ISR - xSemaphoreTake(tx_semaphore, portMAX_DELAY); // wait if queue_packet is executing + ulTaskNotifyTake(pdTRUE, portMAX_DELAY); // block until notified by ISR - if (tx_packet_queued != 0) - send_packet(); // send packet + if(imu_config.debug_en) + { + ESP_LOGI(TAG, "HINT asserted, time since last assertion: %llu", (esp_timer_get_time() - prev_time)); + prev_time = esp_timer_get_time(); + } + + if (xSemaphoreTake(tx_semaphore, 0) == pdTRUE) // check for packet pending to be sent, non-blocking semaphore take + send_packet(); // send packet else receive_packet(); // receive packet xSemaphoreGive(int_asserted_semaphore); // SPI completed, give int_asserted_semaphore to notify wait_for_int() - xSemaphoreGive(tx_semaphore); // give back the semaphore such that queue packet be blocked } } diff --git a/BNO08x.hpp b/BNO08x.hpp index dd8c360..f703a5a 100644 --- a/BNO08x.hpp +++ b/BNO08x.hpp @@ -125,24 +125,43 @@ class BNO08x void end_calibration(); void save_calibration(); - void enable_rotation_vector(uint16_t time_between_reports); - void enable_game_rotation_vector(uint16_t time_between_reports); - void enable_ARVR_stabilized_rotation_vector(uint16_t time_between_reports); - void enable_ARVR_stabilized_game_rotation_vector(uint16_t time_between_reports); - void enable_gyro_integrated_rotation_vector(uint16_t timeBetweenReports); - void enable_accelerometer(uint16_t time_between_reports); - void enable_linear_accelerometer(uint16_t time_between_reports); - void enable_gravity(uint16_t time_between_reports); - void enable_gyro(uint16_t time_between_reports); - void enable_uncalibrated_gyro(uint16_t time_between_reports); - void enable_magnetometer(uint16_t time_between_reports); - void enable_tap_detector(uint16_t time_between_reports); - void enable_step_counter(uint16_t time_between_reports); - void enable_stability_classifier(uint16_t time_between_reports); - void enable_activity_classifier(uint16_t time_between_reports, uint32_t activities_to_enable, uint8_t (&activity_confidence_vals)[9]); - void enable_raw_accelerometer(uint16_t time_between_reports); - void enable_raw_gyro(uint16_t time_between_reports); - void enable_raw_magnetometer(uint16_t time_between_reports); + void enable_rotation_vector(uint32_t time_between_reports); + void enable_game_rotation_vector(uint32_t time_between_reports); + void enable_ARVR_stabilized_rotation_vector(uint32_t time_between_reports); + void enable_ARVR_stabilized_game_rotation_vector(uint32_t time_between_reports); + void enable_gyro_integrated_rotation_vector(uint32_t time_between_reports); + void enable_accelerometer(uint32_t time_between_reports); + void enable_linear_accelerometer(uint32_t time_between_reports); + void enable_gravity(uint32_t time_between_reports); + void enable_gyro(uint32_t time_between_reports); + void enable_uncalibrated_gyro(uint32_t time_between_reports); + void enable_magnetometer(uint32_t time_between_reports); + void enable_tap_detector(uint32_t time_between_reports); + void enable_step_counter(uint32_t time_between_reports); + void enable_stability_classifier(uint32_t time_between_reports); + void enable_activity_classifier(uint32_t time_between_reports, uint32_t activities_to_enable, uint8_t (&activity_confidence_vals)[9]); + void enable_raw_accelerometer(uint32_t time_between_reports); + void enable_raw_gyro(uint32_t time_between_reports); + void enable_raw_magnetometer(uint32_t time_between_reports); + + void disable_rotation_vector(); + void disable_game_rotation_vector(); + void disable_ARVR_stabilized_rotation_vector(); + void disable_ARVR_stabilized_game_rotation_vector(); + void disable_gyro_integrated_rotation_vector(); + void disable_accelerometer(); + void disable_linear_accelerometer(); + void disable_gravity(); + void disable_gyro(); + void disable_uncalibrated_gyro(); + void disable_magnetometer(); + void disable_tap_detector(); + void disable_step_counter(); + void disable_stability_classifier(); + void disable_activity_classifier(); + void disable_raw_accelerometer(); + void disable_raw_gyro(); + void disable_raw_magnetometer(); void tare_now(uint8_t axis_sel = TARE_AXIS_ALL, uint8_t rotation_vector_basis = TARE_ROTATION_VECTOR); void save_tare(); @@ -278,17 +297,15 @@ class BNO08x void send_packet(); void queue_packet(uint8_t channel_number, uint8_t data_length); void queue_command(uint8_t command); - void queue_feature_command(uint8_t report_ID, uint16_t time_between_reports); - void queue_feature_command(uint8_t report_ID, uint16_t time_between_reports, uint32_t specific_config); + void queue_feature_command(uint8_t report_ID, uint32_t time_between_reports); + void queue_feature_command(uint8_t report_ID, uint32_t time_between_reports, uint32_t specific_config); void queue_calibrate_command(uint8_t _to_calibrate); void queue_tare_command(uint8_t command, uint8_t axis = TARE_AXIS_ALL, uint8_t rotation_vector_basis = TARE_ROTATION_VECTOR); void queue_request_product_id_command(); static bno08x_config_t default_imu_config; ///< default imu config settings - volatile uint8_t - tx_packet_queued; /// 125 void end_calibration();
126 void save_calibration();
127
-
128 void enable_rotation_vector(uint16_t time_between_reports);
-
129 void enable_game_rotation_vector(uint16_t time_between_reports);
-
130 void enable_ARVR_stabilized_rotation_vector(uint16_t time_between_reports);
-
131 void enable_ARVR_stabilized_game_rotation_vector(uint16_t time_between_reports);
-
132 void enable_gyro_integrated_rotation_vector(uint16_t timeBetweenReports);
-
133 void enable_accelerometer(uint16_t time_between_reports);
-
134 void enable_linear_accelerometer(uint16_t time_between_reports);
-
135 void enable_gravity(uint16_t time_between_reports);
-
136 void enable_gyro(uint16_t time_between_reports);
-
137 void enable_uncalibrated_gyro(uint16_t time_between_reports);
-
138 void enable_magnetometer(uint16_t time_between_reports);
-
139 void enable_tap_detector(uint16_t time_between_reports);
-
140 void enable_step_counter(uint16_t time_between_reports);
-
141 void enable_stability_classifier(uint16_t time_between_reports);
-
142 void enable_activity_classifier(uint16_t time_between_reports, uint32_t activities_to_enable, uint8_t (&activity_confidence_vals)[9]);
-
143 void enable_raw_accelerometer(uint16_t time_between_reports);
-
144 void enable_raw_gyro(uint16_t time_between_reports);
-
145 void enable_raw_magnetometer(uint16_t time_between_reports);
+
128 void enable_rotation_vector(uint32_t time_between_reports);
+
129 void enable_game_rotation_vector(uint32_t time_between_reports);
+
130 void enable_ARVR_stabilized_rotation_vector(uint32_t time_between_reports);
+
131 void enable_ARVR_stabilized_game_rotation_vector(uint32_t time_between_reports);
+
132 void enable_gyro_integrated_rotation_vector(uint32_t time_between_reports);
+
133 void enable_accelerometer(uint32_t time_between_reports);
+
134 void enable_linear_accelerometer(uint32_t time_between_reports);
+
135 void enable_gravity(uint32_t time_between_reports);
+
136 void enable_gyro(uint32_t time_between_reports);
+
137 void enable_uncalibrated_gyro(uint32_t time_between_reports);
+
138 void enable_magnetometer(uint32_t time_between_reports);
+
139 void enable_tap_detector(uint32_t time_between_reports);
+
140 void enable_step_counter(uint32_t time_between_reports);
+
141 void enable_stability_classifier(uint32_t time_between_reports);
+
142 void enable_activity_classifier(uint32_t time_between_reports, uint32_t activities_to_enable, uint8_t (&activity_confidence_vals)[9]);
+
143 void enable_raw_accelerometer(uint32_t time_between_reports);
+
144 void enable_raw_gyro(uint32_t time_between_reports);
+
145 void enable_raw_magnetometer(uint32_t time_between_reports);
146
-
147 void tare_now(uint8_t axis_sel = TARE_AXIS_ALL, uint8_t rotation_vector_basis = TARE_ROTATION_VECTOR);
-
148 void save_tare();
-
149 void clear_tare();
-
150
-
151 bool data_available();
-
152 uint16_t parse_input_report();
-
153 uint16_t parse_command_report();
-
154 uint16_t get_readings();
-
155
-
156 uint32_t get_time_stamp();
-
157
-
158 void get_magf(float& x, float& y, float& z, uint8_t& accuracy);
-
159 float get_magf_X();
-
160 float get_magf_Y();
-
161 float get_magf_Z();
-
162 uint8_t get_magf_accuracy();
-
163
-
164 void get_gravity(float& x, float& y, float& z, uint8_t& accuracy);
-
165 float get_gravity_X();
-
166 float get_gravity_Y();
-
167 float get_gravity_Z();
-
168 uint8_t get_gravity_accuracy();
+ + + + + + + +
154 void disable_gravity();
+
155 void disable_gyro();
+ + + + + + + +
163 void disable_raw_gyro();
+ +
165
+
166 void tare_now(uint8_t axis_sel = TARE_AXIS_ALL, uint8_t rotation_vector_basis = TARE_ROTATION_VECTOR);
+
167 void save_tare();
+
168 void clear_tare();
169
-
170 float get_roll();
-
171 float get_pitch();
-
172 float get_yaw();
-
173
-
174 float get_roll_deg();
-
175 float get_pitch_deg();
-
176 float get_yaw_deg();
-
177
-
178 void get_quat(float& i, float& j, float& k, float& real, float& rad_accuracy, uint8_t& accuracy);
-
179 float get_quat_I();
-
180 float get_quat_J();
-
181 float get_quat_K();
-
182 float get_quat_real();
- -
184 uint8_t get_quat_accuracy();
-
185
-
186 void get_accel(float& x, float& y, float& z, uint8_t& accuracy);
-
187 float get_accel_X();
-
188 float get_accel_Y();
-
189 float get_accel_Z();
-
190 uint8_t get_accel_accuracy();
-
191
-
192 void get_linear_accel(float& x, float& y, float& z, uint8_t& accuracy);
-
193 float get_linear_accel_X();
-
194 float get_linear_accel_Y();
-
195 float get_linear_accel_Z();
- -
197
-
198 int16_t get_raw_accel_X();
-
199 int16_t get_raw_accel_Y();
-
200 int16_t get_raw_accel_Z();
-
201
-
202 int16_t get_raw_gyro_X();
-
203 int16_t get_raw_gyro_Y();
-
204 int16_t get_raw_gyro_Z();
-
205
-
206 int16_t get_raw_magf_X();
-
207 int16_t get_raw_magf_Y();
-
208 int16_t get_raw_magf_Z();
-
209
-
210 void get_gyro_calibrated_velocity(float& x, float& y, float& z, uint8_t& accuracy);
- - - -
214 uint8_t get_gyro_accuracy();
-
215
-
216 void get_uncalibrated_gyro(float& x, float& y, float& z, float& bx, float& by, float& bz, uint8_t& accuracy);
- - - - - - - +
170 bool data_available();
+
171 uint16_t parse_input_report();
+
172 uint16_t parse_command_report();
+
173 uint16_t get_readings();
+
174
+
175 uint32_t get_time_stamp();
+
176
+
177 void get_magf(float& x, float& y, float& z, uint8_t& accuracy);
+
178 float get_magf_X();
+
179 float get_magf_Y();
+
180 float get_magf_Z();
+
181 uint8_t get_magf_accuracy();
+
182
+
183 void get_gravity(float& x, float& y, float& z, uint8_t& accuracy);
+
184 float get_gravity_X();
+
185 float get_gravity_Y();
+
186 float get_gravity_Z();
+
187 uint8_t get_gravity_accuracy();
+
188
+
189 float get_roll();
+
190 float get_pitch();
+
191 float get_yaw();
+
192
+
193 float get_roll_deg();
+
194 float get_pitch_deg();
+
195 float get_yaw_deg();
+
196
+
197 void get_quat(float& i, float& j, float& k, float& real, float& rad_accuracy, uint8_t& accuracy);
+
198 float get_quat_I();
+
199 float get_quat_J();
+
200 float get_quat_K();
+
201 float get_quat_real();
+ +
203 uint8_t get_quat_accuracy();
+
204
+
205 void get_accel(float& x, float& y, float& z, uint8_t& accuracy);
+
206 float get_accel_X();
+
207 float get_accel_Y();
+
208 float get_accel_Z();
+
209 uint8_t get_accel_accuracy();
+
210
+
211 void get_linear_accel(float& x, float& y, float& z, uint8_t& accuracy);
+
212 float get_linear_accel_X();
+
213 float get_linear_accel_Y();
+
214 float get_linear_accel_Z();
+ +
216
+
217 int16_t get_raw_accel_X();
+
218 int16_t get_raw_accel_Y();
+
219 int16_t get_raw_accel_Z();
+
220
+
221 int16_t get_raw_gyro_X();
+
222 int16_t get_raw_gyro_Y();
+
223 int16_t get_raw_gyro_Z();
224
-
225 void get_gyro_velocity(float& x, float& y, float& z);
-
226 float get_gyro_velocity_X();
-
227 float get_gyro_velocity_Y();
-
228 float get_gyro_velocity_Z();
-
229
-
230 uint8_t get_tap_detector();
-
231 uint16_t get_step_count();
- -
233 uint8_t get_activity_classifier();
+
225 int16_t get_raw_magf_X();
+
226 int16_t get_raw_magf_Y();
+
227 int16_t get_raw_magf_Z();
+
228
+
229 void get_gyro_calibrated_velocity(float& x, float& y, float& z, uint8_t& accuracy);
+ + + +
233 uint8_t get_gyro_accuracy();
234
-
235 void print_header();
-
236 void print_packet();
-
237
-
238 // Metadata functions
-
239 int16_t get_Q1(uint16_t record_ID);
-
240 int16_t get_Q2(uint16_t record_ID);
-
241 int16_t get_Q3(uint16_t record_ID);
-
242 float get_resolution(uint16_t record_ID);
-
243 float get_range(uint16_t record_ID);
-
244 uint32_t FRS_read_word(uint16_t record_ID, uint8_t word_number);
-
245 bool FRS_read_request(uint16_t record_ID, uint16_t read_offset, uint16_t block_size);
-
246 bool FRS_read_data(uint16_t record_ID, uint8_t start_location, uint8_t words_to_read);
-
247
-
248 // Record IDs from figure 29, page 29 reference manual
-
249 // These are used to read the metadata for each sensor type
-
250 static const constexpr uint16_t FRS_RECORDID_ACCELEROMETER = 0xE302;
-
251 static const constexpr uint16_t FRS_RECORDID_GYROSCOPE_CALIBRATED = 0xE306;
-
252 static const constexpr uint16_t FRS_RECORDID_MAGNETIC_FIELD_CALIBRATED = 0xE309;
-
253 static const constexpr uint16_t FRS_RECORDID_ROTATION_VECTOR = 0xE30B;
-
254
-
255 static const constexpr uint8_t TARE_AXIS_ALL = 0x07;
-
256 static const constexpr uint8_t TARE_AXIS_Z = 0x04;
-
257
-
258 // Which rotation vector to tare, BNO08x saves them seperately
-
259 static const constexpr uint8_t TARE_ROTATION_VECTOR = 0;
-
260 static const constexpr uint8_t TARE_GAME_ROTATION_VECTOR = 1;
-
261 static const constexpr uint8_t TARE_GEOMAGNETIC_ROTATION_VECTOR = 2;
-
262 static const constexpr uint8_t TARE_GYRO_INTEGRATED_ROTATION_VECTOR = 3;
-
263 static const constexpr uint8_t TARE_AR_VR_STABILIZED_ROTATION_VECTOR = 4;
-
264 static const constexpr uint8_t TARE_AR_VR_STABILIZED_GAME_ROTATION_VECTOR = 5;
-
265
-
266 static const constexpr int16_t ROTATION_VECTOR_Q1 = 14;
-
267 static const constexpr int16_t ROTATION_VECTOR_ACCURACY_Q1 = 12;
-
268 static const constexpr int16_t ACCELEROMETER_Q1 = 8;
-
269 static const constexpr int16_t LINEAR_ACCELEROMETER_Q1 = 8;
-
270 static const constexpr int16_t GYRO_Q1 = 9;
-
271 static const constexpr int16_t MAGNETOMETER_Q1 = 4;
-
272 static const constexpr int16_t ANGULAR_VELOCITY_Q1 = 10;
-
273 static const constexpr int16_t GRAVITY_Q1 = 8;
-
274
-
275 private:
-
276 bool wait_for_device_int();
-
277 bool receive_packet();
-
278 void send_packet();
-
279 void queue_packet(uint8_t channel_number, uint8_t data_length);
-
280 void queue_command(uint8_t command);
-
281 void queue_feature_command(uint8_t report_ID, uint16_t time_between_reports);
-
282 void queue_feature_command(uint8_t report_ID, uint16_t time_between_reports, uint32_t specific_config);
-
283 void queue_calibrate_command(uint8_t _to_calibrate);
-
284 void queue_tare_command(uint8_t command, uint8_t axis = TARE_AXIS_ALL, uint8_t rotation_vector_basis = TARE_ROTATION_VECTOR);
- -
286
- -
288
-
289 volatile uint8_t
- -
291 SemaphoreHandle_t tx_semaphore;
-
292 SemaphoreHandle_t
- -
294 uint8_t rx_buffer[300];
-
295 uint8_t tx_buffer[50];
-
296 uint8_t packet_header_rx[4];
-
297 uint8_t commands[20];
-
298 uint8_t sequence_number[6];
-
299 uint32_t meta_data[9];
- -
301 uint16_t packet_length_tx = 0;
-
302 uint16_t packet_length_rx = 0;
-
303
- -
305 spi_bus_config_t bus_config{};
-
306 spi_device_interface_config_t imu_spi_config{};
-
307 spi_device_handle_t spi_hdl{};
-
308 spi_transaction_t spi_transaction{};
-
309
-
310 // These are the raw sensor values (without Q applied) pulled from the user requested Input Report
-
311 uint32_t time_stamp;
- - - - - - - - - - - - - - - -
327 uint8_t tap_detector;
-
328 uint16_t step_count;
- - - - - - - - - - -
339
-
340 // spi task
-
341 TaskHandle_t spi_task_hdl;
-
342 static void spi_task_trampoline(void* arg);
-
343 void spi_task();
-
344
-
345 static void IRAM_ATTR hint_handler(void* arg);
-
346 static bool
- -
348
-
349 static const constexpr uint64_t HOST_INT_TIMEOUT_MS =
-
350 150ULL;
-
351
-
352 // Higher level calibration commands, used by queue_calibrate_command
-
353 static const constexpr uint8_t CALIBRATE_ACCEL = 0;
-
354 static const constexpr uint8_t CALIBRATE_GYRO = 1;
-
355 static const constexpr uint8_t CALIBRATE_MAG = 2;
-
356 static const constexpr uint8_t CALIBRATE_PLANAR_ACCEL = 3;
-
357 static const constexpr uint8_t CALIBRATE_ACCEL_GYRO_MAG =
-
358 4;
-
359 static const constexpr uint8_t CALIBRATE_STOP = 5;
-
360
-
361 // Command IDs (see Ref. Manual 6.4)
-
362 static const constexpr uint8_t COMMAND_ERRORS = 1;
-
363 static const constexpr uint8_t COMMAND_COUNTER = 2;
-
364 static const constexpr uint8_t COMMAND_TARE = 3;
-
365 static const constexpr uint8_t COMMAND_INITIALIZE = 4;
-
366 static const constexpr uint8_t COMMAND_DCD = 6;
-
367 static const constexpr uint8_t COMMAND_ME_CALIBRATE = 7;
-
368 static const constexpr uint8_t COMMAND_DCD_PERIOD_SAVE = 9;
-
369 static const constexpr uint8_t COMMAND_OSCILLATOR = 10;
-
370 static const constexpr uint8_t COMMAND_CLEAR_DCD = 11;
-
371
-
372 // SHTP channel 2 control report IDs, used in communication with sensor (See Ref. Manual 6.2)
-
373 static const constexpr uint8_t SHTP_REPORT_COMMAND_RESPONSE = 0xF1;
-
374 static const constexpr uint8_t SHTP_REPORT_COMMAND_REQUEST = 0xF2;
-
375 static const constexpr uint8_t SHTP_REPORT_FRS_READ_RESPONSE = 0xF3;
-
376 static const constexpr uint8_t SHTP_REPORT_FRS_READ_REQUEST = 0xF4;
-
377 static const constexpr uint8_t SHTP_REPORT_PRODUCT_ID_RESPONSE = 0xF8;
-
378 static const constexpr uint8_t SHTP_REPORT_PRODUCT_ID_REQUEST = 0xF9;
-
379 static const constexpr uint8_t SHTP_REPORT_BASE_TIMESTAMP = 0xFB;
-
380 static const constexpr uint8_t SHTP_REPORT_SET_FEATURE_COMMAND = 0xFD;
-
381
-
382 // Sensor report IDs, used when enabling and reading BNO08x reports
-
383 static const constexpr uint8_t SENSOR_REPORTID_ACCELEROMETER = 0x01;
-
384 static const constexpr uint8_t SENSOR_REPORTID_GYROSCOPE = 0x02;
-
385 static const constexpr uint8_t SENSOR_REPORTID_MAGNETIC_FIELD = 0x03;
-
386 static const constexpr uint8_t SENSOR_REPORTID_LINEAR_ACCELERATION = 0x04;
-
387 static const constexpr uint8_t SENSOR_REPORTID_ROTATION_VECTOR = 0x05;
-
388 static const constexpr uint8_t SENSOR_REPORTID_GRAVITY = 0x06;
-
389 static const constexpr uint8_t SENSOR_REPORTID_UNCALIBRATED_GYRO = 0x07;
-
390 static const constexpr uint8_t SENSOR_REPORTID_GAME_ROTATION_VECTOR = 0x08;
-
391 static const constexpr uint8_t SENSOR_REPORTID_GEOMAGNETIC_ROTATION_VECTOR = 0x09;
-
392 static const constexpr uint8_t SENSOR_REPORTID_GYRO_INTEGRATED_ROTATION_VECTOR = 0x2A;
-
393 static const constexpr uint8_t SENSOR_REPORTID_TAP_DETECTOR = 0x10;
-
394 static const constexpr uint8_t SENSOR_REPORTID_STEP_COUNTER = 0x11;
-
395 static const constexpr uint8_t SENSOR_REPORTID_STABILITY_CLASSIFIER = 0x13;
-
396 static const constexpr uint8_t SENSOR_REPORTID_RAW_ACCELEROMETER = 0x14;
-
397 static const constexpr uint8_t SENSOR_REPORTID_RAW_GYROSCOPE = 0x15;
-
398 static const constexpr uint8_t SENSOR_REPORTID_RAW_MAGNETOMETER = 0x16;
-
399 static const constexpr uint8_t SENSOR_REPORTID_PERSONAL_ACTIVITY_CLASSIFIER = 0x1E;
-
400 static const constexpr uint8_t SENSOR_REPORTID_AR_VR_STABILIZED_ROTATION_VECTOR = 0x28;
-
401 static const constexpr uint8_t SENSOR_REPORTID_AR_VR_STABILIZED_GAME_ROTATION_VECTOR = 0x29;
-
402
-
403 // Tare commands used by queue_tare_command
-
404 static const constexpr uint8_t TARE_NOW = 0;
-
405 static const constexpr uint8_t TARE_PERSIST = 1;
-
406 static const constexpr uint8_t TARE_SET_REORIENTATION = 2;
-
407
-
408 static const constexpr char* TAG = "BNO08x";
-
409};
+
235 void get_uncalibrated_gyro(float& x, float& y, float& z, float& bx, float& by, float& bz, uint8_t& accuracy);
+ + + + + + + +
243
+
244 void get_gyro_velocity(float& x, float& y, float& z);
+
245 float get_gyro_velocity_X();
+
246 float get_gyro_velocity_Y();
+
247 float get_gyro_velocity_Z();
+
248
+
249 uint8_t get_tap_detector();
+
250 uint16_t get_step_count();
+ +
252 uint8_t get_activity_classifier();
+
253
+
254 void print_header();
+
255 void print_packet();
+
256
+
257 // Metadata functions
+
258 int16_t get_Q1(uint16_t record_ID);
+
259 int16_t get_Q2(uint16_t record_ID);
+
260 int16_t get_Q3(uint16_t record_ID);
+
261 float get_resolution(uint16_t record_ID);
+
262 float get_range(uint16_t record_ID);
+
263 uint32_t FRS_read_word(uint16_t record_ID, uint8_t word_number);
+
264 bool FRS_read_request(uint16_t record_ID, uint16_t read_offset, uint16_t block_size);
+
265 bool FRS_read_data(uint16_t record_ID, uint8_t start_location, uint8_t words_to_read);
+
266
+
267 // Record IDs from figure 29, page 29 reference manual
+
268 // These are used to read the metadata for each sensor type
+
269 static const constexpr uint16_t FRS_RECORDID_ACCELEROMETER = 0xE302;
+
270 static const constexpr uint16_t FRS_RECORDID_GYROSCOPE_CALIBRATED = 0xE306;
+
271 static const constexpr uint16_t FRS_RECORDID_MAGNETIC_FIELD_CALIBRATED = 0xE309;
+
272 static const constexpr uint16_t FRS_RECORDID_ROTATION_VECTOR = 0xE30B;
+
273
+
274 static const constexpr uint8_t TARE_AXIS_ALL = 0x07;
+
275 static const constexpr uint8_t TARE_AXIS_Z = 0x04;
+
276
+
277 // Which rotation vector to tare, BNO08x saves them seperately
+
278 static const constexpr uint8_t TARE_ROTATION_VECTOR = 0;
+
279 static const constexpr uint8_t TARE_GAME_ROTATION_VECTOR = 1;
+
280 static const constexpr uint8_t TARE_GEOMAGNETIC_ROTATION_VECTOR = 2;
+
281 static const constexpr uint8_t TARE_GYRO_INTEGRATED_ROTATION_VECTOR = 3;
+
282 static const constexpr uint8_t TARE_AR_VR_STABILIZED_ROTATION_VECTOR = 4;
+
283 static const constexpr uint8_t TARE_AR_VR_STABILIZED_GAME_ROTATION_VECTOR = 5;
+
284
+
285 static const constexpr int16_t ROTATION_VECTOR_Q1 = 14;
+
286 static const constexpr int16_t ROTATION_VECTOR_ACCURACY_Q1 = 12;
+
287 static const constexpr int16_t ACCELEROMETER_Q1 = 8;
+
288 static const constexpr int16_t LINEAR_ACCELEROMETER_Q1 = 8;
+
289 static const constexpr int16_t GYRO_Q1 = 9;
+
290 static const constexpr int16_t MAGNETOMETER_Q1 = 4;
+
291 static const constexpr int16_t ANGULAR_VELOCITY_Q1 = 10;
+
292 static const constexpr int16_t GRAVITY_Q1 = 8;
+
293
+
294 private:
+
295 bool wait_for_device_int();
+
296 bool receive_packet();
+
297 void send_packet();
+
298 void queue_packet(uint8_t channel_number, uint8_t data_length);
+
299 void queue_command(uint8_t command);
+
300 void queue_feature_command(uint8_t report_ID, uint32_t time_between_reports);
+
301 void queue_feature_command(uint8_t report_ID, uint32_t time_between_reports, uint32_t specific_config);
+
302 void queue_calibrate_command(uint8_t _to_calibrate);
+
303 void queue_tare_command(uint8_t command, uint8_t axis = TARE_AXIS_ALL, uint8_t rotation_vector_basis = TARE_ROTATION_VECTOR);
+ +
305
+ +
307
+
308 SemaphoreHandle_t tx_semaphore;
+
309 SemaphoreHandle_t
+ +
311 uint8_t rx_buffer[300];
+
312 uint8_t tx_buffer[50];
+
313 uint8_t packet_header_rx[4];
+
314 uint8_t commands[20];
+
315 uint8_t sequence_number[6];
+
316 uint32_t meta_data[9];
+ +
318 uint16_t packet_length_tx = 0;
+
319 uint16_t packet_length_rx = 0;
+
320
+ +
322 spi_bus_config_t bus_config{};
+
323 spi_device_interface_config_t imu_spi_config{};
+
324 spi_device_handle_t spi_hdl{};
+
325 spi_transaction_t spi_transaction{};
+
326
+
327 // These are the raw sensor values (without Q applied) pulled from the user requested Input Report
+
328 uint32_t time_stamp;
+ + + + + + + + + + + + + + + +
344 uint8_t tap_detector;
+
345 uint16_t step_count;
+ + + + + + + + + + +
356
+
357 // spi task
+
358 TaskHandle_t spi_task_hdl;
+
359 static void spi_task_trampoline(void* arg);
+
360 void spi_task();
+
361
+
362 static void IRAM_ATTR hint_handler(void* arg);
+
363 static bool
+ +
365
+
366 static const constexpr uint64_t HOST_INT_TIMEOUT_MS =
+
367 150ULL;
+
368
+
369 // Higher level calibration commands, used by queue_calibrate_command
+
370 static const constexpr uint8_t CALIBRATE_ACCEL = 0;
+
371 static const constexpr uint8_t CALIBRATE_GYRO = 1;
+
372 static const constexpr uint8_t CALIBRATE_MAG = 2;
+
373 static const constexpr uint8_t CALIBRATE_PLANAR_ACCEL = 3;
+
374 static const constexpr uint8_t CALIBRATE_ACCEL_GYRO_MAG =
+
375 4;
+
376 static const constexpr uint8_t CALIBRATE_STOP = 5;
+
377
+
378 // Command IDs (see Ref. Manual 6.4)
+
379 static const constexpr uint8_t COMMAND_ERRORS = 1;
+
380 static const constexpr uint8_t COMMAND_COUNTER = 2;
+
381 static const constexpr uint8_t COMMAND_TARE = 3;
+
382 static const constexpr uint8_t COMMAND_INITIALIZE = 4;
+
383 static const constexpr uint8_t COMMAND_DCD = 6;
+
384 static const constexpr uint8_t COMMAND_ME_CALIBRATE = 7;
+
385 static const constexpr uint8_t COMMAND_DCD_PERIOD_SAVE = 9;
+
386 static const constexpr uint8_t COMMAND_OSCILLATOR = 10;
+
387 static const constexpr uint8_t COMMAND_CLEAR_DCD = 11;
+
388
+
389 // SHTP channel 2 control report IDs, used in communication with sensor (See Ref. Manual 6.2)
+
390 static const constexpr uint8_t SHTP_REPORT_COMMAND_RESPONSE = 0xF1;
+
391 static const constexpr uint8_t SHTP_REPORT_COMMAND_REQUEST = 0xF2;
+
392 static const constexpr uint8_t SHTP_REPORT_FRS_READ_RESPONSE = 0xF3;
+
393 static const constexpr uint8_t SHTP_REPORT_FRS_READ_REQUEST = 0xF4;
+
394 static const constexpr uint8_t SHTP_REPORT_PRODUCT_ID_RESPONSE = 0xF8;
+
395 static const constexpr uint8_t SHTP_REPORT_PRODUCT_ID_REQUEST = 0xF9;
+
396 static const constexpr uint8_t SHTP_REPORT_BASE_TIMESTAMP = 0xFB;
+
397 static const constexpr uint8_t SHTP_REPORT_SET_FEATURE_COMMAND = 0xFD;
+
398
+
399 // Sensor report IDs, used when enabling and reading BNO08x reports
+
400 static const constexpr uint8_t SENSOR_REPORTID_ACCELEROMETER = 0x01;
+
401 static const constexpr uint8_t SENSOR_REPORTID_GYROSCOPE = 0x02;
+
402 static const constexpr uint8_t SENSOR_REPORTID_MAGNETIC_FIELD = 0x03;
+
403 static const constexpr uint8_t SENSOR_REPORTID_LINEAR_ACCELERATION = 0x04;
+
404 static const constexpr uint8_t SENSOR_REPORTID_ROTATION_VECTOR = 0x05;
+
405 static const constexpr uint8_t SENSOR_REPORTID_GRAVITY = 0x06;
+
406 static const constexpr uint8_t SENSOR_REPORTID_UNCALIBRATED_GYRO = 0x07;
+
407 static const constexpr uint8_t SENSOR_REPORTID_GAME_ROTATION_VECTOR = 0x08;
+
408 static const constexpr uint8_t SENSOR_REPORTID_GEOMAGNETIC_ROTATION_VECTOR = 0x09;
+
409 static const constexpr uint8_t SENSOR_REPORTID_GYRO_INTEGRATED_ROTATION_VECTOR = 0x2A;
+
410 static const constexpr uint8_t SENSOR_REPORTID_TAP_DETECTOR = 0x10;
+
411 static const constexpr uint8_t SENSOR_REPORTID_STEP_COUNTER = 0x11;
+
412 static const constexpr uint8_t SENSOR_REPORTID_STABILITY_CLASSIFIER = 0x13;
+
413 static const constexpr uint8_t SENSOR_REPORTID_RAW_ACCELEROMETER = 0x14;
+
414 static const constexpr uint8_t SENSOR_REPORTID_RAW_GYROSCOPE = 0x15;
+
415 static const constexpr uint8_t SENSOR_REPORTID_RAW_MAGNETOMETER = 0x16;
+
416 static const constexpr uint8_t SENSOR_REPORTID_PERSONAL_ACTIVITY_CLASSIFIER = 0x1E;
+
417 static const constexpr uint8_t SENSOR_REPORTID_AR_VR_STABILIZED_ROTATION_VECTOR = 0x28;
+
418 static const constexpr uint8_t SENSOR_REPORTID_AR_VR_STABILIZED_GAME_ROTATION_VECTOR = 0x29;
+
419
+
420 // Tare commands used by queue_tare_command
+
421 static const constexpr uint8_t TARE_NOW = 0;
+
422 static const constexpr uint8_t TARE_PERSIST = 1;
+
423 static const constexpr uint8_t TARE_SET_REORIENTATION = 2;
+
424
+
425 static const constexpr char* TAG = "BNO08x";
+
426};
struct bno08x_config_t bno08x_config_t
IMU configuration settings passed into constructor.
channels_t
SHTP protocol channels.
Definition BNO08x.hpp:20
@@ -511,274 +528,291 @@ $(function() { codefold.init(0); });
Definition BNO08x.hpp:104
-
static const constexpr uint8_t SENSOR_REPORTID_PERSONAL_ACTIVITY_CLASSIFIER
See SH2 Ref. Manual 6.5.36.
Definition BNO08x.hpp:399
-
static const constexpr uint8_t SHTP_REPORT_PRODUCT_ID_RESPONSE
See SH2 Ref. Manual 6.3.2.
Definition BNO08x.hpp:377
-
uint16_t raw_quat_radian_accuracy
Definition BNO08x.hpp:317
-
uint16_t raw_gyro_Z
Definition BNO08x.hpp:316
-
void enable_ARVR_stabilized_rotation_vector(uint16_t time_between_reports)
Sends command to enable ARVR stabilized rotation vector reports (See Ref. Manual 6....
Definition BNO08x.cpp:1028
-
static const constexpr int16_t ACCELEROMETER_Q1
Acceleration Q point (See SH-2 Ref. Manual 6.5.9)
Definition BNO08x.hpp:268
-
uint16_t uncalib_gyro_accuracy
Uncalibrated gyro reading (See SH-2 Ref. Manual 6.5.14)
Definition BNO08x.hpp:324
-
void print_header()
Prints the most recently received SHTP header to serial console with ESP_LOG statement.
Definition BNO08x.cpp:2078
-
void enable_activity_classifier(uint16_t time_between_reports, uint32_t activities_to_enable, uint8_t(&activity_confidence_vals)[9])
Sends command to enable activity classifier reports (See Ref. Manual 6.5.36)
Definition BNO08x.cpp:1186
-
uint16_t raw_bias_Z
Definition BNO08x.hpp:323
-
void enable_gyro_integrated_rotation_vector(uint16_t timeBetweenReports)
Sends command to enable gyro integrated rotation vector reports (See Ref. Manual 6....
Definition BNO08x.cpp:1054
-
static const constexpr uint8_t SENSOR_REPORTID_AR_VR_STABILIZED_GAME_ROTATION_VECTOR
See SH2 Ref. Manual 6.5.43.
Definition BNO08x.hpp:401
-
static const constexpr uint8_t COMMAND_TARE
Command and response to tare command (See Sh2 Ref. Manual 6.4.4)
Definition BNO08x.hpp:364
-
float get_accel_Z()
Get z axis acceleration (total acceleration of device, units in m/s^2).
Definition BNO08x.cpp:1660
-
float get_uncalibrated_gyro_Z()
Get uncalibrated gyro Z axis angular velocity measurement.
Definition BNO08x.cpp:1931
-
static const constexpr int16_t ROTATION_VECTOR_Q1
Rotation vector Q point (See SH-2 Ref. Manual 6.5.18)
Definition BNO08x.hpp:266
-
static void spi_task_trampoline(void *arg)
Static function used to launch spi task.
Definition BNO08x.cpp:2416
-
int8_t get_stability_classifier()
Get the current stability classifier (Seee Ref. Manual 6.5.31)
Definition BNO08x.cpp:2049
-
void send_packet()
Sends a queued SHTP packet via SPI.
Definition BNO08x.cpp:413
-
void print_packet()
Definition BNO08x.cpp:2099
-
float get_range(uint16_t record_ID)
Gets range from BNO08x FRS (flash record system).
Definition BNO08x.cpp:2210
-
float get_linear_accel_Y()
Get y axis linear acceleration (acceleration of device minus gravity, units in m/s^2)
Definition BNO08x.cpp:1708
-
float get_magf_X()
Get X component of magnetic field vector.
Definition BNO08x.cpp:1321
-
static const constexpr uint8_t TARE_PERSIST
See SH2 Ref. Manual 6.4.4.2.
Definition BNO08x.hpp:405
-
uint8_t tap_detector
Tap detector reading (See SH-2 Ref. Manual 6.5.27)
Definition BNO08x.hpp:327
-
uint8_t get_reset_reason()
Get the reason for the most recent reset.
Definition BNO08x.cpp:264
-
float get_quat_I()
Get I component of reported quaternion.
Definition BNO08x.cpp:1557
-
int16_t get_Q3(uint16_t record_ID)
Gets Q3 point from BNO08x FRS (flash record system).
Definition BNO08x.cpp:2180
-
float get_gyro_calibrated_velocity_Z()
Get calibrated gyro z axis angular velocity measurement.
Definition BNO08x.cpp:1866
-
void queue_command(uint8_t command)
Queues a packet containing a command.
Definition BNO08x.cpp:436
-
bool mode_sleep()
Puts BNO08x sensor into sleep/low power mode using executable channel.
Definition BNO08x.cpp:310
-
float get_uncalibrated_gyro_Y()
Get uncalibrated gyro Y axis angular velocity measurement.
Definition BNO08x.cpp:1921
-
uint16_t raw_gyro_X
Definition BNO08x.hpp:316
-
uint8_t stability_classifier
Stability status reading (See SH-2 Ref. Manual 6.5.31)
Definition BNO08x.hpp:329
-
float get_pitch()
Get the reported rotation about y axis.
Definition BNO08x.cpp:1449
-
void get_uncalibrated_gyro(float &x, float &y, float &z, float &bx, float &by, float &bz, uint8_t &accuracy)
Get full rotational velocity without drift compensation (units in Rad/s). An estimate of drift is giv...
Definition BNO08x.cpp:1895
-
void calibrate_planar_accelerometer()
Sends command to calibrate planar accelerometer.
Definition BNO08x.cpp:510
-
static const constexpr uint8_t SHTP_REPORT_SET_FEATURE_COMMAND
See SH2 Ref. Manual 6.5.4.
Definition BNO08x.hpp:380
-
void enable_accelerometer(uint16_t time_between_reports)
Sends command to enable accelerometer reports (See Ref. Manual 6.5.9)
Definition BNO08x.cpp:1067
-
float get_resolution(uint16_t record_ID)
Gets resolution from BNO08x FRS (flash record system).
Definition BNO08x.cpp:2193
-
int16_t get_raw_accel_X()
Get raw accelerometer x axis reading from physical accelerometer MEMs sensor (See Ref....
Definition BNO08x.cpp:1738
-
static const constexpr uint8_t SHTP_REPORT_COMMAND_RESPONSE
See SH2 Ref. Manual 6.3.9.
Definition BNO08x.hpp:373
-
static const constexpr uint8_t TARE_AXIS_ALL
Tare all axes (used with tare now command)
Definition BNO08x.hpp:255
-
static const constexpr uint8_t TARE_GEOMAGNETIC_ROTATION_VECTOR
tare geomagnetic rotation vector
Definition BNO08x.hpp:261
-
uint8_t get_quat_accuracy()
Get accuracy of reported quaternion.
Definition BNO08x.cpp:1612
-
static const constexpr uint8_t SENSOR_REPORTID_AR_VR_STABILIZED_ROTATION_VECTOR
See SH2 Ref. Manual 6.5.42.
Definition BNO08x.hpp:400
-
static const constexpr uint8_t TARE_NOW
See SH2 Ref. Manual 6.4.4.1.
Definition BNO08x.hpp:404
-
uint32_t FRS_read_word(uint16_t record_ID, uint8_t word_number)
Reads meta data word from BNO08x FRS (flash record system) given the record ID and word number....
Definition BNO08x.cpp:2231
-
float q_to_float(int16_t fixed_point_value, uint8_t q_point)
Converts a register value to a float using its associated Q point. (See https://en....
Definition BNO08x.cpp:1281
-
float get_uncalibrated_gyro_X()
Get uncalibrated gyro x axis angular velocity measurement.
Definition BNO08x.cpp:1911
-
bool hard_reset()
Hard resets BNO08x sensor.
Definition BNO08x.cpp:216
-
static const constexpr uint8_t SENSOR_REPORTID_GYROSCOPE
See SH2 Ref. Manual 6.5.13.
Definition BNO08x.hpp:384
-
int16_t get_raw_magf_Y()
Get raw magnetometer y axis reading from physical magnetometer sensor (See Ref. Manual 6....
Definition BNO08x.cpp:1808
-
static const constexpr char * TAG
Class tag used for serial print statements.
Definition BNO08x.hpp:408
-
void enable_gravity(uint16_t time_between_reports)
Sends command to enable gravity reading reports (See Ref. Manual 6.5.11)
Definition BNO08x.cpp:1093
-
int16_t get_raw_gyro_Z()
Get raw gyroscope z axis reading from physical gyroscope MEMs sensor (See Ref. Manual 6....
Definition BNO08x.cpp:1788
-
void spi_task()
Task responsible for SPI transactions. Executed when HINT in is asserted by BNO08x.
Definition BNO08x.cpp:2427
-
static const constexpr uint8_t COMMAND_OSCILLATOR
Retrieve oscillator type command (See SH2 Ref. Manual 6.4)
Definition BNO08x.hpp:369
-
static const constexpr uint8_t COMMAND_INITIALIZE
Reinitialize sensor hub components See (SH2 Ref. Manual 6.4.5)
Definition BNO08x.hpp:365
-
static const constexpr uint8_t TARE_AR_VR_STABILIZED_ROTATION_VECTOR
Tare ARVR stabilized rotation vector.
Definition BNO08x.hpp:263
-
uint8_t get_uncalibrated_gyro_accuracy()
Get uncalibrated gyro accuracy.
Definition BNO08x.cpp:1971
-
uint16_t accel_accuracy
Raw acceleration readings (See SH-2 Ref. Manual 6.5.8)
Definition BNO08x.hpp:313
-
SemaphoreHandle_t int_asserted_semaphore
Binary semaphore used to synchronize spi_task() calling wait_for_device_int(), given after hint_handl...
Definition BNO08x.hpp:293
-
uint8_t get_linear_accel_accuracy()
Get accuracy of linear acceleration.
Definition BNO08x.cpp:1728
-
void get_magf(float &x, float &y, float &z, uint8_t &accuracy)
Get the full magnetic field vector.
Definition BNO08x.cpp:1308
-
uint16_t accel_lin_accuracy
Raw linear acceleration (See SH-2 Ref. Manual 6.5.10)
Definition BNO08x.hpp:315
-
uint16_t quat_accuracy
Raw quaternion reading (See SH-2 Ref. Manual 6.5.44)
Definition BNO08x.hpp:318
-
bool data_available()
Checks if BNO08x has asserted interrupt and sent data.
Definition BNO08x.cpp:725
-
uint16_t parse_command_report()
Parses received command report sent by BNO08x (See Ref. Manual 6.3.9)
Definition BNO08x.cpp:972
-
static const constexpr uint8_t COMMAND_ERRORS
Definition BNO08x.hpp:362
-
void get_gravity(float &x, float &y, float &z, uint8_t &accuracy)
Get full reported gravity vector, units in m/s^2.
Definition BNO08x.cpp:1369
-
uint16_t mems_raw_gyro_X
Definition BNO08x.hpp:335
-
uint8_t get_accel_accuracy()
Get accuracy of linear acceleration.
Definition BNO08x.cpp:1670
-
bool FRS_read_data(uint16_t record_ID, uint8_t start_location, uint8_t words_to_read)
Read meta data from BNO08x FRS (flash record system) given the record ID. Contains Q points and other...
Definition BNO08x.cpp:2281
+
static const constexpr uint8_t SENSOR_REPORTID_PERSONAL_ACTIVITY_CLASSIFIER
See SH2 Ref. Manual 6.5.36.
Definition BNO08x.hpp:416
+
static const constexpr uint8_t SHTP_REPORT_PRODUCT_ID_RESPONSE
See SH2 Ref. Manual 6.3.2.
Definition BNO08x.hpp:394
+
void enable_gravity(uint32_t time_between_reports)
Sends command to enable gravity reading reports (See Ref. Manual 6.5.11)
Definition BNO08x.cpp:1086
+
uint16_t raw_quat_radian_accuracy
Definition BNO08x.hpp:334
+
uint16_t raw_gyro_Z
Definition BNO08x.hpp:333
+
static const constexpr int16_t ACCELEROMETER_Q1
Acceleration Q point (See SH-2 Ref. Manual 6.5.9)
Definition BNO08x.hpp:287
+
uint16_t uncalib_gyro_accuracy
Uncalibrated gyro reading (See SH-2 Ref. Manual 6.5.14)
Definition BNO08x.hpp:341
+
void print_header()
Prints the most recently received SHTP header to serial console with ESP_LOG statement.
Definition BNO08x.cpp:2287
+
uint16_t raw_bias_Z
Definition BNO08x.hpp:340
+
static const constexpr uint8_t SENSOR_REPORTID_AR_VR_STABILIZED_GAME_ROTATION_VECTOR
See SH2 Ref. Manual 6.5.43.
Definition BNO08x.hpp:418
+
static const constexpr uint8_t COMMAND_TARE
Command and response to tare command (See Sh2 Ref. Manual 6.4.4)
Definition BNO08x.hpp:381
+
float get_accel_Z()
Get z axis acceleration (total acceleration of device, units in m/s^2).
Definition BNO08x.cpp:1869
+
float get_uncalibrated_gyro_Z()
Get uncalibrated gyro Z axis angular velocity measurement.
Definition BNO08x.cpp:2140
+
static const constexpr int16_t ROTATION_VECTOR_Q1
Rotation vector Q point (See SH-2 Ref. Manual 6.5.18)
Definition BNO08x.hpp:285
+
static void spi_task_trampoline(void *arg)
Static function used to launch spi task.
Definition BNO08x.cpp:2624
+
int8_t get_stability_classifier()
Get the current stability classifier (Seee Ref. Manual 6.5.31)
Definition BNO08x.cpp:2258
+
void send_packet()
Sends a queued SHTP packet via SPI.
Definition BNO08x.cpp:408
+
void print_packet()
Definition BNO08x.cpp:2308
+
float get_range(uint16_t record_ID)
Gets range from BNO08x FRS (flash record system).
Definition BNO08x.cpp:2419
+
float get_linear_accel_Y()
Get y axis linear acceleration (acceleration of device minus gravity, units in m/s^2)
Definition BNO08x.cpp:1917
+
float get_magf_X()
Get X component of magnetic field vector.
Definition BNO08x.cpp:1530
+
static const constexpr uint8_t TARE_PERSIST
See SH2 Ref. Manual 6.4.4.2.
Definition BNO08x.hpp:422
+
uint8_t tap_detector
Tap detector reading (See SH-2 Ref. Manual 6.5.27)
Definition BNO08x.hpp:344
+
uint8_t get_reset_reason()
Get the reason for the most recent reset.
Definition BNO08x.cpp:263
+
float get_quat_I()
Get I component of reported quaternion.
Definition BNO08x.cpp:1766
+
void enable_raw_magnetometer(uint32_t time_between_reports)
Sends command to enable raw magnetometer reports (See Ref. Manual 6.5.15)
Definition BNO08x.cpp:1219
+
int16_t get_Q3(uint16_t record_ID)
Gets Q3 point from BNO08x FRS (flash record system).
Definition BNO08x.cpp:2389
+
float get_gyro_calibrated_velocity_Z()
Get calibrated gyro z axis angular velocity measurement.
Definition BNO08x.cpp:2075
+
void disable_tap_detector()
Sends command to disable tap detector reports by setting report interval to 0.
Definition BNO08x.cpp:1363
+
void disable_raw_accelerometer()
Sends command to disable raw accelerometer reports by setting report interval to 0.
Definition BNO08x.cpp:1411
+
void queue_command(uint8_t command)
Queues a packet containing a command.
Definition BNO08x.cpp:429
+
bool mode_sleep()
Puts BNO08x sensor into sleep/low power mode using executable channel.
Definition BNO08x.cpp:309
+
float get_uncalibrated_gyro_Y()
Get uncalibrated gyro Y axis angular velocity measurement.
Definition BNO08x.cpp:2130
+
uint16_t raw_gyro_X
Definition BNO08x.hpp:333
+
uint8_t stability_classifier
Stability status reading (See SH-2 Ref. Manual 6.5.31)
Definition BNO08x.hpp:346
+
float get_pitch()
Get the reported rotation about y axis.
Definition BNO08x.cpp:1658
+
void get_uncalibrated_gyro(float &x, float &y, float &z, float &bx, float &by, float &bz, uint8_t &accuracy)
Get full rotational velocity without drift compensation (units in Rad/s). An estimate of drift is giv...
Definition BNO08x.cpp:2104
+
void calibrate_planar_accelerometer()
Sends command to calibrate planar accelerometer.
Definition BNO08x.cpp:503
+
static const constexpr uint8_t SHTP_REPORT_SET_FEATURE_COMMAND
See SH2 Ref. Manual 6.5.4.
Definition BNO08x.hpp:397
+
float get_resolution(uint16_t record_ID)
Gets resolution from BNO08x FRS (flash record system).
Definition BNO08x.cpp:2402
+
int16_t get_raw_accel_X()
Get raw accelerometer x axis reading from physical accelerometer MEMs sensor (See Ref....
Definition BNO08x.cpp:1947
+
static const constexpr uint8_t SHTP_REPORT_COMMAND_RESPONSE
See SH2 Ref. Manual 6.3.9.
Definition BNO08x.hpp:390
+
void disable_rotation_vector()
Sends command to disable rotation vector reports by setting report interval to 0.
Definition BNO08x.cpp:1231
+
static const constexpr uint8_t TARE_AXIS_ALL
Tare all axes (used with tare now command)
Definition BNO08x.hpp:274
+
static const constexpr uint8_t TARE_GEOMAGNETIC_ROTATION_VECTOR
tare geomagnetic rotation vector
Definition BNO08x.hpp:280
+
uint8_t get_quat_accuracy()
Get accuracy of reported quaternion.
Definition BNO08x.cpp:1821
+
static const constexpr uint8_t SENSOR_REPORTID_AR_VR_STABILIZED_ROTATION_VECTOR
See SH2 Ref. Manual 6.5.42.
Definition BNO08x.hpp:417
+
void enable_accelerometer(uint32_t time_between_reports)
Sends command to enable accelerometer reports (See Ref. Manual 6.5.9)
Definition BNO08x.cpp:1060
+
static const constexpr uint8_t TARE_NOW
See SH2 Ref. Manual 6.4.4.1.
Definition BNO08x.hpp:421
+
uint32_t FRS_read_word(uint16_t record_ID, uint8_t word_number)
Reads meta data word from BNO08x FRS (flash record system) given the record ID and word number....
Definition BNO08x.cpp:2440
+
float q_to_float(int16_t fixed_point_value, uint8_t q_point)
Converts a register value to a float using its associated Q point. (See https://en....
Definition BNO08x.cpp:1490
+
float get_uncalibrated_gyro_X()
Get uncalibrated gyro x axis angular velocity measurement.
Definition BNO08x.cpp:2120
+
bool hard_reset()
Hard resets BNO08x sensor.
Definition BNO08x.cpp:215
+
static const constexpr uint8_t SENSOR_REPORTID_GYROSCOPE
See SH2 Ref. Manual 6.5.13.
Definition BNO08x.hpp:401
+
int16_t get_raw_magf_Y()
Get raw magnetometer y axis reading from physical magnetometer sensor (See Ref. Manual 6....
Definition BNO08x.cpp:2017
+
static const constexpr char * TAG
Class tag used for serial print statements.
Definition BNO08x.hpp:425
+
int16_t get_raw_gyro_Z()
Get raw gyroscope z axis reading from physical gyroscope MEMs sensor (See Ref. Manual 6....
Definition BNO08x.cpp:1997
+
void spi_task()
Task responsible for SPI transactions. Executed when HINT in is asserted by BNO08x.
Definition BNO08x.cpp:2635
+
void enable_raw_accelerometer(uint32_t time_between_reports)
Sends command to enable raw accelerometer reports (See Ref. Manual 6.5.8)
Definition BNO08x.cpp:1193
+
static const constexpr uint8_t COMMAND_OSCILLATOR
Retrieve oscillator type command (See SH2 Ref. Manual 6.4)
Definition BNO08x.hpp:386
+
static const constexpr uint8_t COMMAND_INITIALIZE
Reinitialize sensor hub components See (SH2 Ref. Manual 6.4.5)
Definition BNO08x.hpp:382
+
static const constexpr uint8_t TARE_AR_VR_STABILIZED_ROTATION_VECTOR
Tare ARVR stabilized rotation vector.
Definition BNO08x.hpp:282
+
uint8_t get_uncalibrated_gyro_accuracy()
Get uncalibrated gyro accuracy.
Definition BNO08x.cpp:2180
+
uint16_t accel_accuracy
Raw acceleration readings (See SH-2 Ref. Manual 6.5.8)
Definition BNO08x.hpp:330
+
SemaphoreHandle_t int_asserted_semaphore
Binary semaphore used to synchronize spi_task() calling wait_for_device_int(), given after hint_handl...
Definition BNO08x.hpp:310
+
uint8_t get_linear_accel_accuracy()
Get accuracy of linear acceleration.
Definition BNO08x.cpp:1937
+
void get_magf(float &x, float &y, float &z, uint8_t &accuracy)
Get the full magnetic field vector.
Definition BNO08x.cpp:1517
+
uint16_t accel_lin_accuracy
Raw linear acceleration (See SH-2 Ref. Manual 6.5.10)
Definition BNO08x.hpp:332
+
uint16_t quat_accuracy
Raw quaternion reading (See SH-2 Ref. Manual 6.5.44)
Definition BNO08x.hpp:335
+
bool data_available()
Checks if BNO08x has asserted interrupt and sent data.
Definition BNO08x.cpp:718
+
uint16_t parse_command_report()
Parses received command report sent by BNO08x (See Ref. Manual 6.3.9)
Definition BNO08x.cpp:965
+
static const constexpr uint8_t COMMAND_ERRORS
Definition BNO08x.hpp:379
+
void get_gravity(float &x, float &y, float &z, uint8_t &accuracy)
Get full reported gravity vector, units in m/s^2.
Definition BNO08x.cpp:1578
+
void enable_magnetometer(uint32_t time_between_reports)
Sends command to enable magnetometer reports (See Ref. Manual 6.5.16)
Definition BNO08x.cpp:1125
+
uint16_t mems_raw_gyro_X
Definition BNO08x.hpp:352
+
uint8_t get_accel_accuracy()
Get accuracy of linear acceleration.
Definition BNO08x.cpp:1879
+
bool FRS_read_data(uint16_t record_ID, uint8_t start_location, uint8_t words_to_read)
Read meta data from BNO08x FRS (flash record system) given the record ID. Contains Q points and other...
Definition BNO08x.cpp:2490
BNO08x(bno08x_config_t imu_config=default_imu_config)
BNO08x imu constructor.
Definition BNO08x.cpp:15
-
spi_device_interface_config_t imu_spi_config
SPI slave device settings.
Definition BNO08x.hpp:306
-
static const constexpr uint8_t SENSOR_REPORTID_TAP_DETECTOR
See SH2 Ref. Manual 6.5.27.
Definition BNO08x.hpp:393
-
int16_t get_Q1(uint16_t record_ID)
Gets Q1 point from BNO08x FRS (flash record system).
Definition BNO08x.cpp:2150
-
void tare_now(uint8_t axis_sel=TARE_AXIS_ALL, uint8_t rotation_vector_basis=TARE_ROTATION_VECTOR)
Sends command to tare an axis (See Ref. Manual 6.4.4.1)
Definition BNO08x.cpp:1241
-
static const constexpr uint8_t SENSOR_REPORTID_ACCELEROMETER
See SH2 Ref. Manual 6.5.9.
Definition BNO08x.hpp:383
-
uint8_t get_tap_detector()
Get if tap has occured.
Definition BNO08x.cpp:2027
-
uint8_t get_magf_accuracy()
Get accuracy of reported magnetic field vector.
Definition BNO08x.cpp:1354
+
spi_device_interface_config_t imu_spi_config
SPI slave device settings.
Definition BNO08x.hpp:323
+
void disable_step_counter()
Sends command to disable step counter reports by setting report interval to 0.
Definition BNO08x.cpp:1375
+
static const constexpr uint8_t SENSOR_REPORTID_TAP_DETECTOR
See SH2 Ref. Manual 6.5.27.
Definition BNO08x.hpp:410
+
int16_t get_Q1(uint16_t record_ID)
Gets Q1 point from BNO08x FRS (flash record system).
Definition BNO08x.cpp:2359
+
void tare_now(uint8_t axis_sel=TARE_AXIS_ALL, uint8_t rotation_vector_basis=TARE_ROTATION_VECTOR)
Sends command to tare an axis (See Ref. Manual 6.4.4.1)
Definition BNO08x.cpp:1450
+
static const constexpr uint8_t SENSOR_REPORTID_ACCELEROMETER
See SH2 Ref. Manual 6.5.9.
Definition BNO08x.hpp:400
+
uint8_t get_tap_detector()
Get if tap has occured.
Definition BNO08x.cpp:2236
+
uint8_t get_magf_accuracy()
Get accuracy of reported magnetic field vector.
Definition BNO08x.cpp:1563
static bool isr_service_installed
true of the isr service has been installed, only has to be done once regardless of how many devices a...
Definition BNO08x.hpp:3
-
void queue_tare_command(uint8_t command, uint8_t axis=TARE_AXIS_ALL, uint8_t rotation_vector_basis=TARE_ROTATION_VECTOR)
Queues a packet containing a command related to zeroing sensor's axes. (See Ref. Manual 6....
Definition BNO08x.cpp:2380
-
void get_gyro_calibrated_velocity(float &x, float &y, float &z, uint8_t &accuracy)
Get full rotational velocity with drift compensation (units in Rad/s).
Definition BNO08x.cpp:1833
-
uint16_t raw_velocity_gyro_Y
Definition BNO08x.hpp:319
-
static const constexpr uint8_t COMMAND_CLEAR_DCD
Clear DCD & Reset command (See SH2 Ref. Manual 6.4)
Definition BNO08x.hpp:370
-
uint8_t get_activity_classifier()
Get the current activity classifier (Seee Ref. Manual 6.5.36)
Definition BNO08x.cpp:2068
-
float get_uncalibrated_gyro_bias_Z()
Get uncalibrated gyro Z axis drift estimate.
Definition BNO08x.cpp:1961
-
void get_quat(float &i, float &j, float &k, float &real, float &rad_accuracy, uint8_t &accuracy)
Get the full quaternion reading.
Definition BNO08x.cpp:1542
-
void enable_stability_classifier(uint16_t time_between_reports)
Sends command to enable activity stability classifier reports (See Ref. Manual 6.5....
Definition BNO08x.cpp:1171
-
static const constexpr uint8_t SENSOR_REPORTID_LINEAR_ACCELERATION
See SH2 Ref. Manual 6.5.10.
Definition BNO08x.hpp:386
-
static const constexpr uint8_t SHTP_REPORT_PRODUCT_ID_REQUEST
See SH2 Ref. Manual 6.3.1.
Definition BNO08x.hpp:378
-
float get_gravity_Z()
Get the reported z axis gravity.
Definition BNO08x.cpp:1402
-
static const constexpr uint8_t CALIBRATE_STOP
Stop calibration command used by queue_calibrate_command.
Definition BNO08x.hpp:359
-
static const constexpr uint16_t FRS_RECORDID_ROTATION_VECTOR
Definition BNO08x.hpp:253
-
uint16_t mems_raw_accel_Z
Raw accelerometer readings from MEMS sensor (See SH2 Ref. Manual 6.5.8)
Definition BNO08x.hpp:334
-
static const constexpr uint8_t TARE_SET_REORIENTATION
See SH2 Ref. Manual 6.4.4.3.
Definition BNO08x.hpp:406
-
float get_quat_real()
Get real component of reported quaternion.
Definition BNO08x.cpp:1590
-
volatile uint8_t tx_packet_queued
Whether or not a packet is currently waiting to be sent, a queued packet is sent on assertion of BNO0...
Definition BNO08x.hpp:290
-
TaskHandle_t spi_task_hdl
SPI task handle.
Definition BNO08x.hpp:341
-
uint16_t raw_quat_J
Definition BNO08x.hpp:317
-
float get_quat_radian_accuracy()
Get radian accuracy of reported quaternion.
Definition BNO08x.cpp:1601
-
uint16_t raw_gyro_Y
Definition BNO08x.hpp:316
-
static bno08x_config_t default_imu_config
default imu config settings
Definition BNO08x.hpp:287
-
void enable_game_rotation_vector(uint16_t time_between_reports)
Sends command to enable game rotation vector reports (See Ref. Manual 6.5.19)
Definition BNO08x.cpp:1002
-
float get_yaw()
Get the reported rotation about z axis.
Definition BNO08x.cpp:1478
-
void queue_packet(uint8_t channel_number, uint8_t data_length)
Queues an SHTP packet to be sent via SPI.
Definition BNO08x.cpp:383
-
uint16_t raw_quat_I
Definition BNO08x.hpp:317
-
void queue_feature_command(uint8_t report_ID, uint16_t time_between_reports)
Queues a packet containing a command with a request for sensor reports, reported periodically....
Definition BNO08x.cpp:2404
-
static const constexpr uint16_t FRS_RECORDID_GYROSCOPE_CALIBRATED
Definition BNO08x.hpp:251
-
static const constexpr uint8_t SENSOR_REPORTID_MAGNETIC_FIELD
See SH2 Ref. Manual 6.5.16.
Definition BNO08x.hpp:385
-
uint16_t packet_length_tx
Packet length to be sent with send_packet()
Definition BNO08x.hpp:301
-
float get_roll_deg()
Get the reported rotation about x axis.
Definition BNO08x.cpp:1505
-
int16_t get_raw_accel_Z()
Get raw accelerometer z axis reading from physical accelerometer MEMs sensor (See Ref....
Definition BNO08x.cpp:1758
-
bool calibration_complete()
Returns true if calibration has completed.
Definition BNO08x.cpp:587
-
static const constexpr uint16_t FRS_RECORDID_ACCELEROMETER
Definition BNO08x.hpp:250
-
float get_uncalibrated_gyro_bias_Y()
Get uncalibrated gyro Y axis drift estimate.
Definition BNO08x.cpp:1951
-
static const constexpr uint8_t SHTP_REPORT_FRS_READ_REQUEST
See SH2 Ref. Manual 6.3.6.
Definition BNO08x.hpp:376
-
uint8_t tx_buffer[50]
buffer used for sending packet with send_packet()
Definition BNO08x.hpp:295
-
uint8_t activity_classifier
Activity status reading (See SH-2 Ref. Manual 6.5.36)
Definition BNO08x.hpp:330
-
uint16_t raw_accel_X
Definition BNO08x.hpp:312
-
void enable_gyro(uint16_t time_between_reports)
Sends command to enable gyro reports (See Ref. Manual 6.5.13)
Definition BNO08x.cpp:1106
-
float get_linear_accel_X()
Get x axis linear acceleration (acceleration of device minus gravity, units in m/s^2)
Definition BNO08x.cpp:1698
-
uint16_t raw_quat_K
Definition BNO08x.hpp:317
-
static const constexpr uint8_t COMMAND_DCD_PERIOD_SAVE
Configure DCD periodic saving (See SH2 Ref. Manual 6.4)
Definition BNO08x.hpp:368
-
uint8_t rx_buffer[300]
buffer used to receive packet with receive_packet()
Definition BNO08x.hpp:294
-
uint16_t parse_input_report()
Parses received input report sent by BNO08x.
Definition BNO08x.cpp:791
-
uint32_t meta_data[9]
First 9 bytes of meta data returned from FRS read operation (we don't really need the rest) (See Ref....
Definition BNO08x.hpp:299
-
static void IRAM_ATTR hint_handler(void *arg)
HINT interrupt service routine, handles falling edge of BNO08x HINT pin.
Definition BNO08x.cpp:2451
-
uint8_t get_gyro_accuracy()
Get calibrated gyro accuracy.
Definition BNO08x.cpp:1876
-
float get_magf_Y()
Get Y component of magnetic field vector.
Definition BNO08x.cpp:1332
-
static const constexpr uint8_t COMMAND_ME_CALIBRATE
Command and response to configure ME calibration (See SH2 Ref. Manual 6.4.7)
Definition BNO08x.hpp:367
-
uint16_t raw_quat_real
Definition BNO08x.hpp:317
-
float get_gravity_X()
Get the reported x axis gravity.
Definition BNO08x.cpp:1382
-
float get_roll()
Get the reported rotation about x axis.
Definition BNO08x.cpp:1422
-
uint16_t raw_bias_X
Definition BNO08x.hpp:323
-
float get_gravity_Y()
Get the reported y axis gravity.
Definition BNO08x.cpp:1392
-
static const constexpr uint8_t SENSOR_REPORTID_GYRO_INTEGRATED_ROTATION_VECTOR
See SH2 Ref. Manual 6.5.44.
Definition BNO08x.hpp:392
-
static const constexpr uint8_t TARE_ROTATION_VECTOR
Tare rotation vector.
Definition BNO08x.hpp:259
-
uint8_t packet_header_rx[4]
SHTP header received with receive_packet()
Definition BNO08x.hpp:296
-
uint16_t mems_raw_magf_Z
Raw magnetometer (compass) readings from MEMS sensor (See SH-2 Ref. Manual 6.5.15)
Definition BNO08x.hpp:338
-
void enable_tap_detector(uint16_t time_between_reports)
Sends command to enable tap detector reports (See Ref. Manual 6.5.27)
Definition BNO08x.cpp:1145
-
static const constexpr int16_t ROTATION_VECTOR_ACCURACY_Q1
Rotation vector accuracy estimate Q point (See SH-2 Ref. Manual 6.5.18)
Definition BNO08x.hpp:267
-
void get_accel(float &x, float &y, float &z, uint8_t &accuracy)
Get full acceleration (total acceleration of device, units in m/s^2).
Definition BNO08x.cpp:1627
-
uint16_t mems_raw_accel_X
Definition BNO08x.hpp:333
-
static const constexpr uint8_t COMMAND_COUNTER
Definition BNO08x.hpp:363
-
int16_t get_Q2(uint16_t record_ID)
Gets Q2 point from BNO08x FRS (flash record system).
Definition BNO08x.cpp:2165
-
static const constexpr uint8_t CALIBRATE_PLANAR_ACCEL
Calibrate planar acceleration command used by queue_calibrate_command.
Definition BNO08x.hpp:356
-
int16_t get_raw_accel_Y()
Get raw accelerometer y axis reading from physical accelerometer MEMs sensor (See Ref....
Definition BNO08x.cpp:1748
-
bool soft_reset()
Soft resets BNO08x sensor using executable channel.
Definition BNO08x.cpp:241
-
spi_bus_config_t bus_config
SPI bus GPIO configuration settings.
Definition BNO08x.hpp:305
-
bool wait_for_device_int()
Re-enables interrupts and waits for BNO08x to assert HINT pin.
Definition BNO08x.cpp:192
-
uint16_t gyro_accuracy
Raw gyro reading (See SH-2 Ref. Manual 6.5.13)
Definition BNO08x.hpp:316
-
int16_t get_raw_magf_Z()
Get raw magnetometer z axis reading from physical magnetometer sensor (See Ref. Manual 6....
Definition BNO08x.cpp:1818
-
void calibrate_gyro()
Sends command to calibrate gyro.
Definition BNO08x.cpp:486
-
uint16_t get_readings()
Waits for BNO08x HINT pin to assert, and parses the received data.
Definition BNO08x.cpp:735
-
static const constexpr uint8_t TARE_GYRO_INTEGRATED_ROTATION_VECTOR
Tare gyro integrated rotation vector.
Definition BNO08x.hpp:262
-
float get_quat_K()
Get K component of reported quaternion.
Definition BNO08x.cpp:1579
-
float get_quat_J()
Get J component of reported quaternion.
Definition BNO08x.cpp:1568
-
static const constexpr int16_t MAGNETOMETER_Q1
Magnetometer Q point (See SH-2 Ref. Manual 6.5.16)
Definition BNO08x.hpp:271
-
void save_calibration()
Sends command to save internal calibration data (See Ref. Manual 6.4.7).
Definition BNO08x.cpp:612
-
static const constexpr int16_t GYRO_Q1
Gyro Q point (See SH-2 Ref. Manual 6.5.13)
Definition BNO08x.hpp:270
-
uint16_t raw_velocity_gyro_X
Definition BNO08x.hpp:319
-
uint16_t raw_magf_X
Definition BNO08x.hpp:325
-
uint8_t sequence_number[6]
Sequence num of each com channel, 6 in total.
Definition BNO08x.hpp:298
-
static const constexpr uint8_t SENSOR_REPORTID_RAW_ACCELEROMETER
See SH2 Ref. Manual 6.5.8.
Definition BNO08x.hpp:396
-
uint16_t mems_raw_magf_Y
Definition BNO08x.hpp:337
-
static const constexpr uint8_t SENSOR_REPORTID_RAW_GYROSCOPE
See SH2 Ref. Manual 6.5.12.
Definition BNO08x.hpp:397
-
static const constexpr int16_t ANGULAR_VELOCITY_Q1
Angular velocity Q point (See SH-2 Ref. Manual 6.5.44)
Definition BNO08x.hpp:272
-
static const constexpr uint8_t SENSOR_REPORTID_STEP_COUNTER
See SH2 Ref. Manual 6.5.29.
Definition BNO08x.hpp:394
-
static const constexpr uint8_t SENSOR_REPORTID_ROTATION_VECTOR
See SH2 Ref. Manual 6.5.18.
Definition BNO08x.hpp:387
-
static const constexpr uint8_t SHTP_REPORT_COMMAND_REQUEST
See SH2 Ref. Manual 6.3.8.
Definition BNO08x.hpp:374
-
static const constexpr uint8_t SENSOR_REPORTID_GAME_ROTATION_VECTOR
See SH2 Ref. Manual 6.5.19.
Definition BNO08x.hpp:390
-
uint16_t raw_magf_Z
Definition BNO08x.hpp:325
-
uint16_t raw_velocity_gyro_Z
Raw gyro angular velocity reading (See SH-2 Ref. Manual 6.5.44)
Definition BNO08x.hpp:320
-
float get_magf_Z()
Get Z component of magnetic field vector.
Definition BNO08x.cpp:1343
-
uint16_t raw_accel_Y
Definition BNO08x.hpp:312
-
uint16_t mems_raw_magf_X
Definition BNO08x.hpp:337
-
void queue_request_product_id_command()
Queues a packet containing the request product ID command.
Definition BNO08x.cpp:450
-
uint16_t mems_raw_gyro_Y
Definition BNO08x.hpp:335
-
float get_gyro_calibrated_velocity_X()
Get calibrated gyro x axis angular velocity measurement.
Definition BNO08x.cpp:1846
-
static const constexpr uint8_t SENSOR_REPORTID_UNCALIBRATED_GYRO
See SH2 Ref. Manual 6.5.14.
Definition BNO08x.hpp:389
-
static const constexpr uint16_t FRS_RECORDID_MAGNETIC_FIELD_CALIBRATED
Definition BNO08x.hpp:252
-
static const constexpr uint8_t TARE_GAME_ROTATION_VECTOR
Tare game rotation vector.
Definition BNO08x.hpp:260
-
uint16_t raw_lin_accel_Z
Definition BNO08x.hpp:314
-
uint32_t time_stamp
Report timestamp (see datasheet 1.3.5.3)
Definition BNO08x.hpp:311
-
float get_accel_X()
Get x axis acceleration (total acceleration of device, units in m/s^2).
Definition BNO08x.cpp:1640
-
void enable_rotation_vector(uint16_t time_between_reports)
Sends command to enable rotation vector reports (See Ref. Manual 6.5.18)
Definition BNO08x.cpp:1015
-
static const constexpr uint8_t CALIBRATE_MAG
Calibrate magnetometer command used by queue_calibrate_command.
Definition BNO08x.hpp:355
-
spi_transaction_t spi_transaction
SPI transaction handle.
Definition BNO08x.hpp:308
-
bool mode_on()
Turns on/ brings BNO08x sensor out of sleep mode using executable channel.
Definition BNO08x.cpp:288
-
uint8_t command_sequence_number
Sequence num of command, sent within command packet.
Definition BNO08x.hpp:300
-
void calibrate_magnetometer()
Sends command to calibrate magnetometer.
Definition BNO08x.cpp:498
-
uint16_t mems_raw_gyro_Z
Raw gyro readings from MEMS sensor (See SH-2 Ref. Manual 6.5.12)
Definition BNO08x.hpp:336
-
uint16_t raw_bias_Y
Definition BNO08x.hpp:323
-
uint16_t magf_accuracy
Calibrated magnetic field reading in uTesla (See SH-2 Ref. Manual 6.5.16)
Definition BNO08x.hpp:326
-
static const constexpr uint8_t SENSOR_REPORTID_RAW_MAGNETOMETER
See SH2 Ref. Manual 6.5.15.
Definition BNO08x.hpp:398
-
void enable_uncalibrated_gyro(uint16_t time_between_reports)
Sends command to enable uncalibrated gyro reports (See Ref. Manual 6.5.14)
Definition BNO08x.cpp:1119
-
void end_calibration()
Sends command to end calibration procedure.
Definition BNO08x.cpp:600
-
uint8_t commands[20]
Command to be sent with send_packet()
Definition BNO08x.hpp:297
-
spi_device_handle_t spi_hdl
SPI device handle.
Definition BNO08x.hpp:307
-
uint16_t raw_uncalib_gyro_Y
Definition BNO08x.hpp:323
-
uint8_t get_gravity_accuracy()
Get the reported gravity accuracy.
Definition BNO08x.cpp:1412
-
float get_gyro_velocity_Y()
Get y axis angular velocity from gyro-integrated rotation vector. (See Ref. Manual 6....
Definition BNO08x.cpp:2007
-
uint16_t raw_magf_Y
Definition BNO08x.hpp:325
-
float get_gyro_velocity_X()
Get x axis angular velocity from gyro-integrated rotation vector. (See Ref. Manual 6....
Definition BNO08x.cpp:1997
-
static const constexpr uint8_t CALIBRATE_ACCEL
Calibrate accelerometer command used by queue_calibrate_command.
Definition BNO08x.hpp:353
-
void enable_magnetometer(uint16_t time_between_reports)
Sends command to enable magnetometer reports (See Ref. Manual 6.5.16)
Definition BNO08x.cpp:1132
-
void queue_calibrate_command(uint8_t _to_calibrate)
Queues a packet containing a command to calibrate the specified sensor.
Definition BNO08x.cpp:523
-
static const constexpr int16_t LINEAR_ACCELEROMETER_Q1
Linear acceleration Q point (See SH-2 Ref. Manual 6.5.10)
Definition BNO08x.hpp:269
-
void enable_raw_magnetometer(uint16_t time_between_reports)
Sends command to enable raw magnetometer reports (See Ref. Manual 6.5.15)
Definition BNO08x.cpp:1226
-
uint8_t calibration_status
Calibration status of device (See SH-2 Ref. Manual 6.4.7.1 & 6.4.7.2)
Definition BNO08x.hpp:332
-
float get_uncalibrated_gyro_bias_X()
Get uncalibrated gyro x axis drift estimate.
Definition BNO08x.cpp:1941
-
void enable_linear_accelerometer(uint16_t time_between_reports)
Sends command to enable linear accelerometer reports (See Ref. Manual 6.5.10)
Definition BNO08x.cpp:1080
-
float get_gyro_calibrated_velocity_Y()
Get calibrated gyro y axis angular velocity measurement.
Definition BNO08x.cpp:1856
-
void enable_step_counter(uint16_t time_between_reports)
Sends command to enable step counter reports (See Ref. Manual 6.5.29)
Definition BNO08x.cpp:1158
-
void get_linear_accel(float &x, float &y, float &z, uint8_t &accuracy)
Get full linear acceleration (acceleration of the device minus gravity, units in m/s^2).
Definition BNO08x.cpp:1685
-
void enable_raw_accelerometer(uint16_t time_between_reports)
Sends command to enable raw accelerometer reports (See Ref. Manual 6.5.8)
Definition BNO08x.cpp:1200
-
uint16_t step_count
Step counter reading (See SH-2 Ref. Manual 6.5.29)
Definition BNO08x.hpp:328
-
uint16_t mems_raw_accel_Y
Definition BNO08x.hpp:333
-
uint32_t get_time_stamp()
Return timestamp of most recent report.
Definition BNO08x.cpp:1293
-
void enable_ARVR_stabilized_game_rotation_vector(uint16_t time_between_reports)
Sends command to enable ARVR stabilized game rotation vector reports (See Ref. Manual 6....
Definition BNO08x.cpp:1041
-
uint16_t get_step_count()
Get the counted amount of steps.
Definition BNO08x.cpp:2039
-
int16_t get_raw_magf_X()
Get raw magnetometer x axis reading from physical magnetometer sensor (See Ref. Manual 6....
Definition BNO08x.cpp:1798
-
bool FRS_read_request(uint16_t record_ID, uint16_t read_offset, uint16_t block_size)
Requests meta data from BNO08x FRS (flash record system) given the record ID. Contains Q points and o...
Definition BNO08x.cpp:2251
-
uint16_t gravity_accuracy
Gravity reading in m/s^2 (See SH-2 Ref. Manual 6.5.11)
Definition BNO08x.hpp:322
-
static const constexpr int16_t GRAVITY_Q1
Gravity Q point (See SH-2 Ref. Manual 6.5.11)
Definition BNO08x.hpp:273
-
uint16_t raw_lin_accel_X
Definition BNO08x.hpp:314
-
float get_gyro_velocity_Z()
Get z axis angular velocity from gyro-integrated rotation vector. (See Ref. Manual 6....
Definition BNO08x.cpp:2017
-
static const constexpr uint8_t SHTP_REPORT_BASE_TIMESTAMP
See SH2 Ref. Manual 7.2.1.
Definition BNO08x.hpp:379
-
bool receive_packet()
Receives a SHTP packet via SPI.
Definition BNO08x.cpp:332
-
bool run_full_calibration_routine()
Runs full calibration routine.
Definition BNO08x.cpp:631
-
static const constexpr uint64_t HOST_INT_TIMEOUT_MS
Max wait between HINT being asserted by BNO08x before transaction is considered failed (in milisecond...
Definition BNO08x.hpp:349
-
bool initialize()
Initializes BNO08x sensor.
Definition BNO08x.cpp:119
-
static const constexpr uint8_t CALIBRATE_GYRO
Calibrate gyro command used by queue_calibrate_command.
Definition BNO08x.hpp:354
-
static const constexpr uint8_t SHTP_REPORT_FRS_READ_RESPONSE
See SH2 Ref. Manual 6.3.7.
Definition BNO08x.hpp:375
-
static const constexpr uint8_t SENSOR_REPORTID_GEOMAGNETIC_ROTATION_VECTOR
See SH2 Ref. Manual 6.5.20.
Definition BNO08x.hpp:391
-
static const constexpr uint8_t TARE_AXIS_Z
Tar yaw axis only (used with tare now command)
Definition BNO08x.hpp:256
-
static const constexpr uint8_t TARE_AR_VR_STABILIZED_GAME_ROTATION_VECTOR
Tare ARVR stabilized game rotation vector.
Definition BNO08x.hpp:264
-
bno08x_config_t imu_config
IMU configuration settings.
Definition BNO08x.hpp:304
-
SemaphoreHandle_t tx_semaphore
Mutex semaphore used to prevent sending or receiving of packets if packet is currently being queued.
Definition BNO08x.hpp:291
-
static const constexpr uint8_t SENSOR_REPORTID_GRAVITY
See SH2 Ref. Manual 6.5.11.
Definition BNO08x.hpp:388
-
void calibrate_accelerometer()
Sends command to calibrate accelerometer.
Definition BNO08x.cpp:474
-
static const constexpr uint8_t COMMAND_DCD
Save DCD command (See SH2 Ref. Manual 6.4.7)
Definition BNO08x.hpp:366
-
int16_t get_raw_gyro_X()
Get raw gyroscope x axis reading from physical gyroscope MEMs sensor (See Ref. Manual 6....
Definition BNO08x.cpp:1768
-
uint16_t gravity_Y
Definition BNO08x.hpp:321
-
uint16_t raw_accel_Z
Definition BNO08x.hpp:312
-
uint16_t gravity_X
Definition BNO08x.hpp:321
-
float get_pitch_deg()
Get the reported rotation about y axis.
Definition BNO08x.cpp:1515
-
static const constexpr uint8_t CALIBRATE_ACCEL_GYRO_MAG
Calibrate accelerometer, gyro, & magnetometer command used by queue_calibrate_command.
Definition BNO08x.hpp:357
-
uint16_t packet_length_rx
Packet length received (calculated from packet_header_rx)
Definition BNO08x.hpp:302
-
float get_yaw_deg()
Get the reported rotation about z axis.
Definition BNO08x.cpp:1525
-
uint8_t * activity_confidences
Confidence of read activities (See SH-2 Ref. Manual 6.5.36)
Definition BNO08x.hpp:331
-
void enable_raw_gyro(uint16_t time_between_reports)
Sends command to enable raw gyro reports (See Ref. Manual 6.5.12)
Definition BNO08x.cpp:1213
-
uint16_t gravity_Z
Definition BNO08x.hpp:321
-
uint16_t raw_uncalib_gyro_Z
Definition BNO08x.hpp:323
-
static const constexpr uint8_t SENSOR_REPORTID_STABILITY_CLASSIFIER
See SH2 Ref. Manual 6.5.31.
Definition BNO08x.hpp:395
-
void save_tare()
Sends command to save tare into non-volatile memory of BNO08x (See Ref. Manual 6.4....
Definition BNO08x.cpp:1253
-
void calibrate_all()
Sends command to calibrate accelerometer, gyro, and magnetometer.
Definition BNO08x.cpp:462
-
uint16_t raw_uncalib_gyro_X
Definition BNO08x.hpp:323
-
float get_accel_Y()
Get y axis acceleration (total acceleration of device, units in m/s^2).
Definition BNO08x.cpp:1650
-
float get_linear_accel_Z()
Get z axis linear acceleration (acceleration of device minus gravity, units in m/s^2)
Definition BNO08x.cpp:1718
-
void clear_tare()
Sends command to clear persistent tare settings in non-volatile memory of BNO08x (See Ref....
Definition BNO08x.cpp:1265
-
void get_gyro_velocity(float &x, float &y, float &z)
Full rotational velocity from gyro-integrated rotation vector (See Ref. Manual 6.5....
Definition BNO08x.cpp:1985
-
uint16_t raw_lin_accel_Y
Definition BNO08x.hpp:314
-
int16_t get_raw_gyro_Y()
Get raw gyroscope y axis reading from physical gyroscope MEMs sensor (See Ref. Manual 6....
Definition BNO08x.cpp:1778
-
void request_calibration_status()
Requests ME calibration status from BNO08x (see Ref. Manual 6.4.7.2)
Definition BNO08x.cpp:570
+
void queue_tare_command(uint8_t command, uint8_t axis=TARE_AXIS_ALL, uint8_t rotation_vector_basis=TARE_ROTATION_VECTOR)
Queues a packet containing a command related to zeroing sensor's axes. (See Ref. Manual 6....
Definition BNO08x.cpp:2588
+
void get_gyro_calibrated_velocity(float &x, float &y, float &z, uint8_t &accuracy)
Get full rotational velocity with drift compensation (units in Rad/s).
Definition BNO08x.cpp:2042
+
uint16_t raw_velocity_gyro_Y
Definition BNO08x.hpp:336
+
static const constexpr uint8_t COMMAND_CLEAR_DCD
Clear DCD & Reset command (See SH2 Ref. Manual 6.4)
Definition BNO08x.hpp:387
+
uint8_t get_activity_classifier()
Get the current activity classifier (Seee Ref. Manual 6.5.36)
Definition BNO08x.cpp:2277
+
void disable_activity_classifier()
Sends command to disable activity classifier reports by setting report interval to 0.
Definition BNO08x.cpp:1399
+
float get_uncalibrated_gyro_bias_Z()
Get uncalibrated gyro Z axis drift estimate.
Definition BNO08x.cpp:2170
+
void get_quat(float &i, float &j, float &k, float &real, float &rad_accuracy, uint8_t &accuracy)
Get the full quaternion reading.
Definition BNO08x.cpp:1751
+
static const constexpr uint8_t SENSOR_REPORTID_LINEAR_ACCELERATION
See SH2 Ref. Manual 6.5.10.
Definition BNO08x.hpp:403
+
static const constexpr uint8_t SHTP_REPORT_PRODUCT_ID_REQUEST
See SH2 Ref. Manual 6.3.1.
Definition BNO08x.hpp:395
+
float get_gravity_Z()
Get the reported z axis gravity.
Definition BNO08x.cpp:1611
+
void enable_ARVR_stabilized_game_rotation_vector(uint32_t time_between_reports)
Sends command to enable ARVR stabilized game rotation vector reports (See Ref. Manual 6....
Definition BNO08x.cpp:1034
+
static const constexpr uint8_t CALIBRATE_STOP
Stop calibration command used by queue_calibrate_command.
Definition BNO08x.hpp:376
+
static const constexpr uint16_t FRS_RECORDID_ROTATION_VECTOR
Definition BNO08x.hpp:272
+
uint16_t mems_raw_accel_Z
Raw accelerometer readings from MEMS sensor (See SH2 Ref. Manual 6.5.8)
Definition BNO08x.hpp:351
+
static const constexpr uint8_t TARE_SET_REORIENTATION
See SH2 Ref. Manual 6.4.4.3.
Definition BNO08x.hpp:423
+
void enable_step_counter(uint32_t time_between_reports)
Sends command to enable step counter reports (See Ref. Manual 6.5.29)
Definition BNO08x.cpp:1151
+
float get_quat_real()
Get real component of reported quaternion.
Definition BNO08x.cpp:1799
+
void disable_gravity()
Sends command to disable gravity reports by setting report interval to 0.
Definition BNO08x.cpp:1315
+
TaskHandle_t spi_task_hdl
SPI task handle.
Definition BNO08x.hpp:358
+
uint16_t raw_quat_J
Definition BNO08x.hpp:334
+
float get_quat_radian_accuracy()
Get radian accuracy of reported quaternion.
Definition BNO08x.cpp:1810
+
uint16_t raw_gyro_Y
Definition BNO08x.hpp:333
+
static bno08x_config_t default_imu_config
default imu config settings
Definition BNO08x.hpp:306
+
float get_yaw()
Get the reported rotation about z axis.
Definition BNO08x.cpp:1687
+
void disable_magnetometer()
Sends command to disable magnetometer reports by setting report interval to 0.
Definition BNO08x.cpp:1351
+
void queue_packet(uint8_t channel_number, uint8_t data_length)
Queues an SHTP packet to be sent via SPI.
Definition BNO08x.cpp:382
+
uint16_t raw_quat_I
Definition BNO08x.hpp:334
+
static const constexpr uint16_t FRS_RECORDID_GYROSCOPE_CALIBRATED
Definition BNO08x.hpp:270
+
static const constexpr uint8_t SENSOR_REPORTID_MAGNETIC_FIELD
See SH2 Ref. Manual 6.5.16.
Definition BNO08x.hpp:402
+
uint16_t packet_length_tx
Packet length to be sent with send_packet()
Definition BNO08x.hpp:318
+
float get_roll_deg()
Get the reported rotation about x axis.
Definition BNO08x.cpp:1714
+
int16_t get_raw_accel_Z()
Get raw accelerometer z axis reading from physical accelerometer MEMs sensor (See Ref....
Definition BNO08x.cpp:1967
+
bool calibration_complete()
Returns true if calibration has completed.
Definition BNO08x.cpp:580
+
static const constexpr uint16_t FRS_RECORDID_ACCELEROMETER
Definition BNO08x.hpp:269
+
void enable_gyro_integrated_rotation_vector(uint32_t time_between_reports)
Sends command to enable gyro integrated rotation vector reports (See Ref. Manual 6....
Definition BNO08x.cpp:1047
+
float get_uncalibrated_gyro_bias_Y()
Get uncalibrated gyro Y axis drift estimate.
Definition BNO08x.cpp:2160
+
static const constexpr uint8_t SHTP_REPORT_FRS_READ_REQUEST
See SH2 Ref. Manual 6.3.6.
Definition BNO08x.hpp:393
+
uint8_t tx_buffer[50]
buffer used for sending packet with send_packet()
Definition BNO08x.hpp:312
+
uint8_t activity_classifier
Activity status reading (See SH-2 Ref. Manual 6.5.36)
Definition BNO08x.hpp:347
+
void disable_raw_gyro()
Sends command to disable raw gyro reports by setting report interval to 0.
Definition BNO08x.cpp:1423
+
uint16_t raw_accel_X
Definition BNO08x.hpp:329
+
float get_linear_accel_X()
Get x axis linear acceleration (acceleration of device minus gravity, units in m/s^2)
Definition BNO08x.cpp:1907
+
void disable_game_rotation_vector()
Sends command to disable game rotation vector reports by setting report interval to 0.
Definition BNO08x.cpp:1243
+
uint16_t raw_quat_K
Definition BNO08x.hpp:334
+
static const constexpr uint8_t COMMAND_DCD_PERIOD_SAVE
Configure DCD periodic saving (See SH2 Ref. Manual 6.4)
Definition BNO08x.hpp:385
+
uint8_t rx_buffer[300]
buffer used to receive packet with receive_packet()
Definition BNO08x.hpp:311
+
uint16_t parse_input_report()
Parses received input report sent by BNO08x.
Definition BNO08x.cpp:784
+
uint32_t meta_data[9]
First 9 bytes of meta data returned from FRS read operation (we don't really need the rest) (See Ref....
Definition BNO08x.hpp:316
+
void enable_uncalibrated_gyro(uint32_t time_between_reports)
Sends command to enable uncalibrated gyro reports (See Ref. Manual 6.5.14)
Definition BNO08x.cpp:1112
+
static void IRAM_ATTR hint_handler(void *arg)
HINT interrupt service routine, handles falling edge of BNO08x HINT pin.
Definition BNO08x.cpp:2665
+
uint8_t get_gyro_accuracy()
Get calibrated gyro accuracy.
Definition BNO08x.cpp:2085
+
void disable_gyro()
Sends command to disable gyro reports by setting report interval to 0.
Definition BNO08x.cpp:1327
+
float get_magf_Y()
Get Y component of magnetic field vector.
Definition BNO08x.cpp:1541
+
static const constexpr uint8_t COMMAND_ME_CALIBRATE
Command and response to configure ME calibration (See SH2 Ref. Manual 6.4.7)
Definition BNO08x.hpp:384
+
uint16_t raw_quat_real
Definition BNO08x.hpp:334
+
float get_gravity_X()
Get the reported x axis gravity.
Definition BNO08x.cpp:1591
+
float get_roll()
Get the reported rotation about x axis.
Definition BNO08x.cpp:1631
+
uint16_t raw_bias_X
Definition BNO08x.hpp:340
+
float get_gravity_Y()
Get the reported y axis gravity.
Definition BNO08x.cpp:1601
+
void enable_ARVR_stabilized_rotation_vector(uint32_t time_between_reports)
Sends command to enable ARVR stabilized rotation vector reports (See Ref. Manual 6....
Definition BNO08x.cpp:1021
+
static const constexpr uint8_t SENSOR_REPORTID_GYRO_INTEGRATED_ROTATION_VECTOR
See SH2 Ref. Manual 6.5.44.
Definition BNO08x.hpp:409
+
void enable_raw_gyro(uint32_t time_between_reports)
Sends command to enable raw gyro reports (See Ref. Manual 6.5.12)
Definition BNO08x.cpp:1206
+
static const constexpr uint8_t TARE_ROTATION_VECTOR
Tare rotation vector.
Definition BNO08x.hpp:278
+
uint8_t packet_header_rx[4]
SHTP header received with receive_packet()
Definition BNO08x.hpp:313
+
uint16_t mems_raw_magf_Z
Raw magnetometer (compass) readings from MEMS sensor (See SH-2 Ref. Manual 6.5.15)
Definition BNO08x.hpp:355
+
static const constexpr int16_t ROTATION_VECTOR_ACCURACY_Q1
Rotation vector accuracy estimate Q point (See SH-2 Ref. Manual 6.5.18)
Definition BNO08x.hpp:286
+
void get_accel(float &x, float &y, float &z, uint8_t &accuracy)
Get full acceleration (total acceleration of device, units in m/s^2).
Definition BNO08x.cpp:1836
+
uint16_t mems_raw_accel_X
Definition BNO08x.hpp:350
+
static const constexpr uint8_t COMMAND_COUNTER
Definition BNO08x.hpp:380
+
int16_t get_Q2(uint16_t record_ID)
Gets Q2 point from BNO08x FRS (flash record system).
Definition BNO08x.cpp:2374
+
static const constexpr uint8_t CALIBRATE_PLANAR_ACCEL
Calibrate planar acceleration command used by queue_calibrate_command.
Definition BNO08x.hpp:373
+
int16_t get_raw_accel_Y()
Get raw accelerometer y axis reading from physical accelerometer MEMs sensor (See Ref....
Definition BNO08x.cpp:1957
+
bool soft_reset()
Soft resets BNO08x sensor using executable channel.
Definition BNO08x.cpp:240
+
spi_bus_config_t bus_config
SPI bus GPIO configuration settings.
Definition BNO08x.hpp:322
+
bool wait_for_device_int()
Re-enables interrupts and waits for BNO08x to assert HINT pin.
Definition BNO08x.cpp:191
+
uint16_t gyro_accuracy
Raw gyro reading (See SH-2 Ref. Manual 6.5.13)
Definition BNO08x.hpp:333
+
int16_t get_raw_magf_Z()
Get raw magnetometer z axis reading from physical magnetometer sensor (See Ref. Manual 6....
Definition BNO08x.cpp:2027
+
void calibrate_gyro()
Sends command to calibrate gyro.
Definition BNO08x.cpp:479
+
uint16_t get_readings()
Waits for BNO08x HINT pin to assert, and parses the received data.
Definition BNO08x.cpp:728
+
static const constexpr uint8_t TARE_GYRO_INTEGRATED_ROTATION_VECTOR
Tare gyro integrated rotation vector.
Definition BNO08x.hpp:281
+
float get_quat_K()
Get K component of reported quaternion.
Definition BNO08x.cpp:1788
+
float get_quat_J()
Get J component of reported quaternion.
Definition BNO08x.cpp:1777
+
static const constexpr int16_t MAGNETOMETER_Q1
Magnetometer Q point (See SH-2 Ref. Manual 6.5.16)
Definition BNO08x.hpp:290
+
void save_calibration()
Sends command to save internal calibration data (See Ref. Manual 6.4.7).
Definition BNO08x.cpp:605
+
static const constexpr int16_t GYRO_Q1
Gyro Q point (See SH-2 Ref. Manual 6.5.13)
Definition BNO08x.hpp:289
+
void disable_ARVR_stabilized_rotation_vector()
Sends command to disable ARVR stabilized rotation vector reports by setting report interval to 0.
Definition BNO08x.cpp:1255
+
uint16_t raw_velocity_gyro_X
Definition BNO08x.hpp:336
+
uint16_t raw_magf_X
Definition BNO08x.hpp:342
+
uint8_t sequence_number[6]
Sequence num of each com channel, 6 in total.
Definition BNO08x.hpp:315
+
static const constexpr uint8_t SENSOR_REPORTID_RAW_ACCELEROMETER
See SH2 Ref. Manual 6.5.8.
Definition BNO08x.hpp:413
+
void disable_gyro_integrated_rotation_vector()
Sends command to disable gyro integrated rotation vector reports by setting report interval to 0.
Definition BNO08x.cpp:1279
+
uint16_t mems_raw_magf_Y
Definition BNO08x.hpp:354
+
static const constexpr uint8_t SENSOR_REPORTID_RAW_GYROSCOPE
See SH2 Ref. Manual 6.5.12.
Definition BNO08x.hpp:414
+
void disable_uncalibrated_gyro()
Sends command to disable uncalibrated gyro reports by setting report interval to 0.
Definition BNO08x.cpp:1339
+
static const constexpr int16_t ANGULAR_VELOCITY_Q1
Angular velocity Q point (See SH-2 Ref. Manual 6.5.44)
Definition BNO08x.hpp:291
+
static const constexpr uint8_t SENSOR_REPORTID_STEP_COUNTER
See SH2 Ref. Manual 6.5.29.
Definition BNO08x.hpp:411
+
static const constexpr uint8_t SENSOR_REPORTID_ROTATION_VECTOR
See SH2 Ref. Manual 6.5.18.
Definition BNO08x.hpp:404
+
static const constexpr uint8_t SHTP_REPORT_COMMAND_REQUEST
See SH2 Ref. Manual 6.3.8.
Definition BNO08x.hpp:391
+
void enable_stability_classifier(uint32_t time_between_reports)
Sends command to enable activity stability classifier reports (See Ref. Manual 6.5....
Definition BNO08x.cpp:1164
+
void disable_ARVR_stabilized_game_rotation_vector()
Sends command to disable ARVR stabilized game rotation vector reports by setting report interval to 0...
Definition BNO08x.cpp:1267
+
void disable_stability_classifier()
Sends command to disable stability reports by setting report interval to 0.
Definition BNO08x.cpp:1387
+
static const constexpr uint8_t SENSOR_REPORTID_GAME_ROTATION_VECTOR
See SH2 Ref. Manual 6.5.19.
Definition BNO08x.hpp:407
+
uint16_t raw_magf_Z
Definition BNO08x.hpp:342
+
uint16_t raw_velocity_gyro_Z
Raw gyro angular velocity reading (See SH-2 Ref. Manual 6.5.44)
Definition BNO08x.hpp:337
+
void enable_rotation_vector(uint32_t time_between_reports)
Sends command to enable rotation vector reports (See Ref. Manual 6.5.18)
Definition BNO08x.cpp:1008
+
float get_magf_Z()
Get Z component of magnetic field vector.
Definition BNO08x.cpp:1552
+
void enable_tap_detector(uint32_t time_between_reports)
Sends command to enable tap detector reports (See Ref. Manual 6.5.27)
Definition BNO08x.cpp:1138
+
uint16_t raw_accel_Y
Definition BNO08x.hpp:329
+
uint16_t mems_raw_magf_X
Definition BNO08x.hpp:354
+
void queue_request_product_id_command()
Queues a packet containing the request product ID command.
Definition BNO08x.cpp:443
+
uint16_t mems_raw_gyro_Y
Definition BNO08x.hpp:352
+
float get_gyro_calibrated_velocity_X()
Get calibrated gyro x axis angular velocity measurement.
Definition BNO08x.cpp:2055
+
static const constexpr uint8_t SENSOR_REPORTID_UNCALIBRATED_GYRO
See SH2 Ref. Manual 6.5.14.
Definition BNO08x.hpp:406
+
static const constexpr uint16_t FRS_RECORDID_MAGNETIC_FIELD_CALIBRATED
Definition BNO08x.hpp:271
+
static const constexpr uint8_t TARE_GAME_ROTATION_VECTOR
Tare game rotation vector.
Definition BNO08x.hpp:279
+
uint16_t raw_lin_accel_Z
Definition BNO08x.hpp:331
+
uint32_t time_stamp
Report timestamp (see datasheet 1.3.5.3)
Definition BNO08x.hpp:328
+
float get_accel_X()
Get x axis acceleration (total acceleration of device, units in m/s^2).
Definition BNO08x.cpp:1849
+
void enable_game_rotation_vector(uint32_t time_between_reports)
Sends command to enable game rotation vector reports (See Ref. Manual 6.5.19)
Definition BNO08x.cpp:995
+
static const constexpr uint8_t CALIBRATE_MAG
Calibrate magnetometer command used by queue_calibrate_command.
Definition BNO08x.hpp:372
+
spi_transaction_t spi_transaction
SPI transaction handle.
Definition BNO08x.hpp:325
+
bool mode_on()
Turns on/ brings BNO08x sensor out of sleep mode using executable channel.
Definition BNO08x.cpp:287
+
uint8_t command_sequence_number
Sequence num of command, sent within command packet.
Definition BNO08x.hpp:317
+
void calibrate_magnetometer()
Sends command to calibrate magnetometer.
Definition BNO08x.cpp:491
+
uint16_t mems_raw_gyro_Z
Raw gyro readings from MEMS sensor (See SH-2 Ref. Manual 6.5.12)
Definition BNO08x.hpp:353
+
uint16_t raw_bias_Y
Definition BNO08x.hpp:340
+
uint16_t magf_accuracy
Calibrated magnetic field reading in uTesla (See SH-2 Ref. Manual 6.5.16)
Definition BNO08x.hpp:343
+
static const constexpr uint8_t SENSOR_REPORTID_RAW_MAGNETOMETER
See SH2 Ref. Manual 6.5.15.
Definition BNO08x.hpp:415
+
void end_calibration()
Sends command to end calibration procedure.
Definition BNO08x.cpp:593
+
uint8_t commands[20]
Command to be sent with send_packet()
Definition BNO08x.hpp:314
+
spi_device_handle_t spi_hdl
SPI device handle.
Definition BNO08x.hpp:324
+
uint16_t raw_uncalib_gyro_Y
Definition BNO08x.hpp:340
+
uint8_t get_gravity_accuracy()
Get the reported gravity accuracy.
Definition BNO08x.cpp:1621
+
float get_gyro_velocity_Y()
Get y axis angular velocity from gyro-integrated rotation vector. (See Ref. Manual 6....
Definition BNO08x.cpp:2216
+
uint16_t raw_magf_Y
Definition BNO08x.hpp:342
+
float get_gyro_velocity_X()
Get x axis angular velocity from gyro-integrated rotation vector. (See Ref. Manual 6....
Definition BNO08x.cpp:2206
+
static const constexpr uint8_t CALIBRATE_ACCEL
Calibrate accelerometer command used by queue_calibrate_command.
Definition BNO08x.hpp:370
+
void queue_calibrate_command(uint8_t _to_calibrate)
Queues a packet containing a command to calibrate the specified sensor.
Definition BNO08x.cpp:516
+
static const constexpr int16_t LINEAR_ACCELEROMETER_Q1
Linear acceleration Q point (See SH-2 Ref. Manual 6.5.10)
Definition BNO08x.hpp:288
+
uint8_t calibration_status
Calibration status of device (See SH-2 Ref. Manual 6.4.7.1 & 6.4.7.2)
Definition BNO08x.hpp:349
+
float get_uncalibrated_gyro_bias_X()
Get uncalibrated gyro x axis drift estimate.
Definition BNO08x.cpp:2150
+
float get_gyro_calibrated_velocity_Y()
Get calibrated gyro y axis angular velocity measurement.
Definition BNO08x.cpp:2065
+
void get_linear_accel(float &x, float &y, float &z, uint8_t &accuracy)
Get full linear acceleration (acceleration of the device minus gravity, units in m/s^2).
Definition BNO08x.cpp:1894
+
void disable_accelerometer()
Sends command to disable accelerometer reports by setting report interval to 0.
Definition BNO08x.cpp:1291
+
void enable_gyro(uint32_t time_between_reports)
Sends command to enable gyro reports (See Ref. Manual 6.5.13)
Definition BNO08x.cpp:1099
+
void enable_activity_classifier(uint32_t time_between_reports, uint32_t activities_to_enable, uint8_t(&activity_confidence_vals)[9])
Sends command to enable activity classifier reports (See Ref. Manual 6.5.36)
Definition BNO08x.cpp:1179
+
uint16_t step_count
Step counter reading (See SH-2 Ref. Manual 6.5.29)
Definition BNO08x.hpp:345
+
uint16_t mems_raw_accel_Y
Definition BNO08x.hpp:350
+
uint32_t get_time_stamp()
Return timestamp of most recent report.
Definition BNO08x.cpp:1502
+
uint16_t get_step_count()
Get the counted amount of steps.
Definition BNO08x.cpp:2248
+
void disable_raw_magnetometer()
Sends command to disable raw magnetometer reports by setting report interval to 0.
Definition BNO08x.cpp:1435
+
int16_t get_raw_magf_X()
Get raw magnetometer x axis reading from physical magnetometer sensor (See Ref. Manual 6....
Definition BNO08x.cpp:2007
+
bool FRS_read_request(uint16_t record_ID, uint16_t read_offset, uint16_t block_size)
Requests meta data from BNO08x FRS (flash record system) given the record ID. Contains Q points and o...
Definition BNO08x.cpp:2460
+
uint16_t gravity_accuracy
Gravity reading in m/s^2 (See SH-2 Ref. Manual 6.5.11)
Definition BNO08x.hpp:339
+
static const constexpr int16_t GRAVITY_Q1
Gravity Q point (See SH-2 Ref. Manual 6.5.11)
Definition BNO08x.hpp:292
+
void enable_linear_accelerometer(uint32_t time_between_reports)
Sends command to enable linear accelerometer reports (See Ref. Manual 6.5.10)
Definition BNO08x.cpp:1073
+
uint16_t raw_lin_accel_X
Definition BNO08x.hpp:331
+
float get_gyro_velocity_Z()
Get z axis angular velocity from gyro-integrated rotation vector. (See Ref. Manual 6....
Definition BNO08x.cpp:2226
+
static const constexpr uint8_t SHTP_REPORT_BASE_TIMESTAMP
See SH2 Ref. Manual 7.2.1.
Definition BNO08x.hpp:396
+
bool receive_packet()
Receives a SHTP packet via SPI.
Definition BNO08x.cpp:331
+
bool run_full_calibration_routine()
Runs full calibration routine.
Definition BNO08x.cpp:624
+
static const constexpr uint64_t HOST_INT_TIMEOUT_MS
Max wait between HINT being asserted by BNO08x before transaction is considered failed (in milisecond...
Definition BNO08x.hpp:366
+
bool initialize()
Initializes BNO08x sensor.
Definition BNO08x.cpp:118
+
static const constexpr uint8_t CALIBRATE_GYRO
Calibrate gyro command used by queue_calibrate_command.
Definition BNO08x.hpp:371
+
static const constexpr uint8_t SHTP_REPORT_FRS_READ_RESPONSE
See SH2 Ref. Manual 6.3.7.
Definition BNO08x.hpp:392
+
static const constexpr uint8_t SENSOR_REPORTID_GEOMAGNETIC_ROTATION_VECTOR
See SH2 Ref. Manual 6.5.20.
Definition BNO08x.hpp:408
+
static const constexpr uint8_t TARE_AXIS_Z
Tar yaw axis only (used with tare now command)
Definition BNO08x.hpp:275
+
static const constexpr uint8_t TARE_AR_VR_STABILIZED_GAME_ROTATION_VECTOR
Tare ARVR stabilized game rotation vector.
Definition BNO08x.hpp:283
+
bno08x_config_t imu_config
IMU configuration settings.
Definition BNO08x.hpp:321
+
SemaphoreHandle_t tx_semaphore
Used to indicate to spi_task() whether or not a packet is currently waiting to be sent.
Definition BNO08x.hpp:308
+
static const constexpr uint8_t SENSOR_REPORTID_GRAVITY
See SH2 Ref. Manual 6.5.11.
Definition BNO08x.hpp:405
+
void calibrate_accelerometer()
Sends command to calibrate accelerometer.
Definition BNO08x.cpp:467
+
static const constexpr uint8_t COMMAND_DCD
Save DCD command (See SH2 Ref. Manual 6.4.7)
Definition BNO08x.hpp:383
+
int16_t get_raw_gyro_X()
Get raw gyroscope x axis reading from physical gyroscope MEMs sensor (See Ref. Manual 6....
Definition BNO08x.cpp:1977
+
uint16_t gravity_Y
Definition BNO08x.hpp:338
+
uint16_t raw_accel_Z
Definition BNO08x.hpp:329
+
void queue_feature_command(uint8_t report_ID, uint32_t time_between_reports)
Queues a packet containing a command with a request for sensor reports, reported periodically....
Definition BNO08x.cpp:2612
+
uint16_t gravity_X
Definition BNO08x.hpp:338
+
float get_pitch_deg()
Get the reported rotation about y axis.
Definition BNO08x.cpp:1724
+
static const constexpr uint8_t CALIBRATE_ACCEL_GYRO_MAG
Calibrate accelerometer, gyro, & magnetometer command used by queue_calibrate_command.
Definition BNO08x.hpp:374
+
uint16_t packet_length_rx
Packet length received (calculated from packet_header_rx)
Definition BNO08x.hpp:319
+
float get_yaw_deg()
Get the reported rotation about z axis.
Definition BNO08x.cpp:1734
+
uint8_t * activity_confidences
Confidence of read activities (See SH-2 Ref. Manual 6.5.36)
Definition BNO08x.hpp:348
+
uint16_t gravity_Z
Definition BNO08x.hpp:338
+
uint16_t raw_uncalib_gyro_Z
Definition BNO08x.hpp:340
+
static const constexpr uint8_t SENSOR_REPORTID_STABILITY_CLASSIFIER
See SH2 Ref. Manual 6.5.31.
Definition BNO08x.hpp:412
+
void save_tare()
Sends command to save tare into non-volatile memory of BNO08x (See Ref. Manual 6.4....
Definition BNO08x.cpp:1462
+
void disable_linear_accelerometer()
Sends command to disable linear accelerometer reports by setting report interval to 0.
Definition BNO08x.cpp:1303
+
void calibrate_all()
Sends command to calibrate accelerometer, gyro, and magnetometer.
Definition BNO08x.cpp:455
+
uint16_t raw_uncalib_gyro_X
Definition BNO08x.hpp:340
+
float get_accel_Y()
Get y axis acceleration (total acceleration of device, units in m/s^2).
Definition BNO08x.cpp:1859
+
float get_linear_accel_Z()
Get z axis linear acceleration (acceleration of device minus gravity, units in m/s^2)
Definition BNO08x.cpp:1927
+
void clear_tare()
Sends command to clear persistent tare settings in non-volatile memory of BNO08x (See Ref....
Definition BNO08x.cpp:1474
+
void get_gyro_velocity(float &x, float &y, float &z)
Full rotational velocity from gyro-integrated rotation vector (See Ref. Manual 6.5....
Definition BNO08x.cpp:2194
+
uint16_t raw_lin_accel_Y
Definition BNO08x.hpp:331
+
int16_t get_raw_gyro_Y()
Get raw gyroscope y axis reading from physical gyroscope MEMs sensor (See Ref. Manual 6....
Definition BNO08x.cpp:1987
+
void request_calibration_status()
Requests ME calibration status from BNO08x (see Ref. Manual 6.4.7.2)
Definition BNO08x.cpp:563
IMU configuration settings passed into constructor.
Definition BNO08x.hpp:39
spi_host_device_t spi_peripheral
SPI peripheral to be used.
Definition BNO08x.hpp:40
gpio_num_t io_int
Chip select pin (connects to BNO08x CS pin)
Definition BNO08x.hpp:45
diff --git a/documentation/html/class_b_n_o08x-members.html b/documentation/html/class_b_n_o08x-members.html index 0ea2a37..6012d45 100644 --- a/documentation/html/class_b_n_o08x-members.html +++ b/documentation/html/class_b_n_o08x-members.html @@ -113,24 +113,42 @@ $(function() { commandsBNO08xprivate data_available()BNO08x default_imu_configBNO08xprivatestatic - enable_accelerometer(uint16_t time_between_reports)BNO08x - enable_activity_classifier(uint16_t time_between_reports, uint32_t activities_to_enable, uint8_t(&activity_confidence_vals)[9])BNO08x - enable_ARVR_stabilized_game_rotation_vector(uint16_t time_between_reports)BNO08x - enable_ARVR_stabilized_rotation_vector(uint16_t time_between_reports)BNO08x - enable_game_rotation_vector(uint16_t time_between_reports)BNO08x - enable_gravity(uint16_t time_between_reports)BNO08x - enable_gyro(uint16_t time_between_reports)BNO08x - enable_gyro_integrated_rotation_vector(uint16_t timeBetweenReports)BNO08x - enable_linear_accelerometer(uint16_t time_between_reports)BNO08x - enable_magnetometer(uint16_t time_between_reports)BNO08x - enable_raw_accelerometer(uint16_t time_between_reports)BNO08x - enable_raw_gyro(uint16_t time_between_reports)BNO08x - enable_raw_magnetometer(uint16_t time_between_reports)BNO08x - enable_rotation_vector(uint16_t time_between_reports)BNO08x - enable_stability_classifier(uint16_t time_between_reports)BNO08x - enable_step_counter(uint16_t time_between_reports)BNO08x - enable_tap_detector(uint16_t time_between_reports)BNO08x - enable_uncalibrated_gyro(uint16_t time_between_reports)BNO08x + disable_accelerometer()BNO08x + disable_activity_classifier()BNO08x + disable_ARVR_stabilized_game_rotation_vector()BNO08x + disable_ARVR_stabilized_rotation_vector()BNO08x + disable_game_rotation_vector()BNO08x + disable_gravity()BNO08x + disable_gyro()BNO08x + disable_gyro_integrated_rotation_vector()BNO08x + disable_linear_accelerometer()BNO08x + disable_magnetometer()BNO08x + disable_raw_accelerometer()BNO08x + disable_raw_gyro()BNO08x + disable_raw_magnetometer()BNO08x + disable_rotation_vector()BNO08x + disable_stability_classifier()BNO08x + disable_step_counter()BNO08x + disable_tap_detector()BNO08x + disable_uncalibrated_gyro()BNO08x + enable_accelerometer(uint32_t time_between_reports)BNO08x + enable_activity_classifier(uint32_t time_between_reports, uint32_t activities_to_enable, uint8_t(&activity_confidence_vals)[9])BNO08x + enable_ARVR_stabilized_game_rotation_vector(uint32_t time_between_reports)BNO08x + enable_ARVR_stabilized_rotation_vector(uint32_t time_between_reports)BNO08x + enable_game_rotation_vector(uint32_t time_between_reports)BNO08x + enable_gravity(uint32_t time_between_reports)BNO08x + enable_gyro(uint32_t time_between_reports)BNO08x + enable_gyro_integrated_rotation_vector(uint32_t time_between_reports)BNO08x + enable_linear_accelerometer(uint32_t time_between_reports)BNO08x + enable_magnetometer(uint32_t time_between_reports)BNO08x + enable_raw_accelerometer(uint32_t time_between_reports)BNO08x + enable_raw_gyro(uint32_t time_between_reports)BNO08x + enable_raw_magnetometer(uint32_t time_between_reports)BNO08x + enable_rotation_vector(uint32_t time_between_reports)BNO08x + enable_stability_classifier(uint32_t time_between_reports)BNO08x + enable_step_counter(uint32_t time_between_reports)BNO08x + enable_tap_detector(uint32_t time_between_reports)BNO08x + enable_uncalibrated_gyro(uint32_t time_between_reports)BNO08x end_calibration()BNO08x FRS_read_data(uint16_t record_ID, uint8_t start_location, uint8_t words_to_read)BNO08x FRS_read_request(uint16_t record_ID, uint16_t read_offset, uint16_t block_size)BNO08x @@ -251,8 +269,8 @@ $(function() { quat_accuracyBNO08xprivate queue_calibrate_command(uint8_t _to_calibrate)BNO08xprivate queue_command(uint8_t command)BNO08xprivate - queue_feature_command(uint8_t report_ID, uint16_t time_between_reports)BNO08xprivate - queue_feature_command(uint8_t report_ID, uint16_t time_between_reports, uint32_t specific_config)BNO08xprivate + queue_feature_command(uint8_t report_ID, uint32_t time_between_reports)BNO08xprivate + queue_feature_command(uint8_t report_ID, uint32_t time_between_reports, uint32_t specific_config)BNO08xprivate queue_packet(uint8_t channel_number, uint8_t data_length)BNO08xprivate queue_request_product_id_command()BNO08xprivate queue_tare_command(uint8_t command, uint8_t axis=TARE_AXIS_ALL, uint8_t rotation_vector_basis=TARE_ROTATION_VECTOR)BNO08xprivate @@ -336,17 +354,16 @@ $(function() { TARE_GAME_ROTATION_VECTORBNO08xstatic TARE_GEOMAGNETIC_ROTATION_VECTORBNO08xstatic TARE_GYRO_INTEGRATED_ROTATION_VECTORBNO08xstatic - tare_now(uint8_t axis_sel=TARE_AXIS_ALL, uint8_t rotation_vector_basis=TARE_ROTATION_VECTOR)BNO08x - TARE_NOWBNO08xprivatestatic + TARE_NOWBNO08xprivatestatic + tare_now(uint8_t axis_sel=TARE_AXIS_ALL, uint8_t rotation_vector_basis=TARE_ROTATION_VECTOR)BNO08x TARE_PERSISTBNO08xprivatestatic TARE_ROTATION_VECTORBNO08xstatic TARE_SET_REORIENTATIONBNO08xprivatestatic time_stampBNO08xprivate tx_bufferBNO08xprivate - tx_packet_queuedBNO08xprivate - tx_semaphoreBNO08xprivate - uncalib_gyro_accuracyBNO08xprivate - wait_for_device_int()BNO08xprivate + tx_semaphoreBNO08xprivate + uncalib_gyro_accuracyBNO08xprivate + wait_for_device_int()BNO08xprivate