10#include "driver/gpio.h"
11#include "esp_rom_gpio.h"
12#include "driver/spi_common.h"
13#include "driver/spi_master.h"
14#include "freertos/FreeRTOS.h"
15#include "freertos/task.h"
16#include "freertos/semphr.h"
19#include "rom/ets_sys.h"
85 float q_to_float(int16_t fixed_point_value, uint8_t q_point);
112 void enable_activity_classifier(uint16_t time_between_reports, uint32_t activities_to_enable, uint8_t (&activity_confidence_vals)[9]);
128 void get_magf(
float &x,
float &y,
float &z, uint8_t &accuracy);
134 void get_gravity(
float &x,
float &y,
float &z, uint8_t &accuracy);
148 void get_quat(
float &i,
float &j,
float &k,
float &real,
float &rad_accuracy, uint8_t &accuracy);
156 void get_accel(
float &x,
float &y,
float &z, uint8_t &accuracy);
186 void get_uncalibrated_gyro(
float &x,
float &y,
float &z,
float &bx,
float &by,
float &bz, uint8_t &accuracy);
209 int16_t
get_Q1(uint16_t record_ID);
210 int16_t
get_Q2(uint16_t record_ID);
211 int16_t
get_Q3(uint16_t record_ID);
214 uint32_t
FRS_read_word(uint16_t record_ID, uint8_t word_number);
215 bool FRS_read_request(uint16_t record_ID, uint16_t read_offset, uint16_t block_size);
216 bool FRS_read_data(uint16_t record_ID, uint8_t start_location, uint8_t words_to_read);
220 static const constexpr uint16_t FRS_RECORDID_ACCELEROMETER = 0xE302;
221 static const constexpr uint16_t FRS_RECORDID_GYROSCOPE_CALIBRATED = 0xE306;
222 static const constexpr uint16_t FRS_RECORDID_MAGNETIC_FIELD_CALIBRATED = 0xE309;
223 static const constexpr uint16_t FRS_RECORDID_ROTATION_VECTOR = 0xE30B;
230 void queue_packet(uint8_t channel_number, uint8_t data_length);
233 void queue_feature_command(uint8_t report_ID, uint16_t time_between_reports, uint32_t specific_config);
263 uint16_t raw_quat_I, raw_quat_J, raw_quat_K, raw_quat_real, raw_quat_radian_accuracy,
quat_accuracy;
266 uint16_t raw_uncalib_gyro_X, raw_uncalib_gyro_Y, raw_uncalib_gyro_Z, raw_bias_X, raw_bias_Y, raw_bias_Z,
uncalib_gyro_accuracy;
308 static const constexpr uint8_t COMMAND_ERRORS = 1;
309 static const constexpr uint8_t COMMAND_COUNTER = 2;
366 static const constexpr char *
TAG =
"BNO08x";
static const constexpr uint8_t SENSOR_REPORTID_PERSONAL_ACTIVITY_CLASSIFIER
See SH2 Ref. Manual 6.5.36.
Definition BNO08x.hpp:346
static const constexpr uint8_t SHTP_REPORT_PRODUCT_ID_RESPONSE
See SH2 Ref. Manual 6.3.2.
Definition BNO08x.hpp:323
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:1022
static const constexpr int16_t ACCELEROMETER_Q1
Acceleration Q point (See SH-2 Ref. Manual 6.5.9)
Definition BNO08x.hpp:290
uint16_t uncalib_gyro_accuracy
Uncalibrated gyro reading (See SH-2 Ref. Manual 6.5.14)
Definition BNO08x.hpp:266
void print_header()
Prints the most recently received SHTP header to serial console with ESP_LOG statement.
Definition BNO08x.cpp:2074
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:1180
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:1048
static const constexpr uint8_t SENSOR_REPORTID_AR_VR_STABILIZED_GAME_ROTATION_VECTOR
See SH2 Ref. Manual 6.5.43.
Definition BNO08x.hpp:348
static const constexpr uint8_t COMMAND_TARE
Command and response to tare command (See Sh2 Ref. Manual 6.4.4)
Definition BNO08x.hpp:310
float get_accel_Z()
Get z axis acceleration (total acceleration of device, units in m/s^2).
Definition BNO08x.cpp:1656
float get_uncalibrated_gyro_Z()
Get uncalibrated gyro Z axis angular velocity measurement.
Definition BNO08x.cpp:1926
static const constexpr int16_t ROTATION_VECTOR_Q1
Rotation vector Q point (See SH-2 Ref. Manual 6.5.18)
Definition BNO08x.hpp:288
static void spi_task_trampoline(void *arg)
Static function used to launch spi task.
Definition BNO08x.cpp:2421
int8_t get_stability_classifier()
Get the current stability classifier (Seee Ref. Manual 6.5.31)
Definition BNO08x.cpp:2045
void send_packet()
Sends a queued SHTP packet via SPI.
Definition BNO08x.cpp:421
float get_range(uint16_t record_ID)
Gets range from BNO08x FRS (flash record system).
Definition BNO08x.cpp:2218
float get_linear_accel_Y()
Get y axis linear acceleration (acceleration of device minus gravity, units in m/s^2)
Definition BNO08x.cpp:1704
float get_magf_X()
Get X component of magnetic field vector.
Definition BNO08x.cpp:1314
static const constexpr uint8_t TARE_PERSIST
See SH2 Ref. Manual 6.4.4.2.
Definition BNO08x.hpp:352
uint8_t tap_detector
Tap detector reading (See SH-2 Ref. Manual 6.5.27)
Definition BNO08x.hpp:268
uint8_t get_reset_reason()
Get the reason for the most recent reset.
Definition BNO08x.cpp:269
float get_quat_I()
Get I component of reported quaternion.
Definition BNO08x.cpp:1553
int16_t get_Q3(uint16_t record_ID)
Gets Q3 point from BNO08x FRS (flash record system).
Definition BNO08x.cpp:2188
float get_gyro_calibrated_velocity_Z()
Get calibrated gyro z axis angular velocity measurement.
Definition BNO08x.cpp:1862
void queue_command(uint8_t command)
Queues a packet containing a command.
Definition BNO08x.cpp:444
bool mode_sleep()
Puts BNO08x sensor into sleep/low power mode using executable channel.
Definition BNO08x.cpp:315
float get_uncalibrated_gyro_Y()
Get uncalibrated gyro Y axis angular velocity measurement.
Definition BNO08x.cpp:1916
uint8_t stability_classifier
Stability status reading (See SH-2 Ref. Manual 6.5.31)
Definition BNO08x.hpp:270
float get_pitch()
Get the reported rotation about y axis.
Definition BNO08x.cpp:1443
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:1890
void calibrate_planar_accelerometer()
Sends command to calibrate planar accelerometer.
Definition BNO08x.cpp:518
static const constexpr uint8_t SHTP_REPORT_SET_FEATURE_COMMAND
See SH2 Ref. Manual 6.5.4.
Definition BNO08x.hpp:326
void enable_accelerometer(uint16_t time_between_reports)
Sends command to enable accelerometer reports (See Ref. Manual 6.5.9)
Definition BNO08x.cpp:1061
float get_resolution(uint16_t record_ID)
Gets resolution from BNO08x FRS (flash record system).
Definition BNO08x.cpp:2201
int16_t get_raw_accel_X()
Get raw accelerometer x axis reading from physical accelerometer MEMs sensor (See Ref....
Definition BNO08x.cpp:1734
static const constexpr uint8_t SHTP_REPORT_COMMAND_RESPONSE
See SH2 Ref. Manual 6.3.9.
Definition BNO08x.hpp:319
static const constexpr uint8_t TARE_AXIS_ALL
Tare all axes (used with tare now command)
Definition BNO08x.hpp:355
static const constexpr uint8_t TARE_GEOMAGNETIC_ROTATION_VECTOR
tare geomagnetic rotation vector
Definition BNO08x.hpp:361
uint8_t get_quat_accuracy()
Get accuracy of reported quaternion.
Definition BNO08x.cpp:1608
static const constexpr uint8_t SENSOR_REPORTID_AR_VR_STABILIZED_ROTATION_VECTOR
See SH2 Ref. Manual 6.5.42.
Definition BNO08x.hpp:347
static const constexpr uint8_t TARE_NOW
See SH2 Ref. Manual 6.4.4.1.
Definition BNO08x.hpp:351
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:2238
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:1273
float get_uncalibrated_gyro_X()
Get uncalibrated gyro x axis angular velocity measurement.
Definition BNO08x.cpp:1906
bool hard_reset()
Hard resets BNO08x sensor.
Definition BNO08x.cpp:225
static const constexpr uint8_t SENSOR_REPORTID_GYROSCOPE
See SH2 Ref. Manual 6.5.13.
Definition BNO08x.hpp:331
int16_t get_raw_magf_Y()
Get raw magnetometer y axis reading from physical magnetometer sensor (See Ref. Manual 6....
Definition BNO08x.cpp:1804
static const constexpr char * TAG
Class tag used for serial print statements.
Definition BNO08x.hpp:366
void enable_gravity(uint16_t time_between_reports)
Sends command to enable gravity reading reports (See Ref. Manual 6.5.11)
Definition BNO08x.cpp:1087
int16_t get_raw_gyro_Z()
Get raw gyroscope z axis reading from physical gyroscope MEMs sensor (See Ref. Manual 6....
Definition BNO08x.cpp:1784
void spi_task()
Task responsible for SPI transactions. Executed when HINT in is asserted by BNO08x.
Definition BNO08x.cpp:2432
static const constexpr uint8_t COMMAND_OSCILLATOR
Retrieve oscillator type command (See SH2 Ref. Manual 6.4)
Definition BNO08x.hpp:315
static const constexpr uint8_t COMMAND_INITIALIZE
Reinitialize sensor hub components See (SH2 Ref. Manual 6.4.5)
Definition BNO08x.hpp:311
static const constexpr uint8_t TARE_AR_VR_STABILIZED_ROTATION_VECTOR
Tare ARVR stabilized rotation vector.
Definition BNO08x.hpp:363
uint8_t get_uncalibrated_gyro_accuracy()
Get uncalibrated gyro accuracy.
Definition BNO08x.cpp:1966
uint16_t accel_accuracy
Raw acceleration readings (See SH-2 Ref. Manual 6.5.8)
Definition BNO08x.hpp:260
uint8_t get_linear_accel_accuracy()
Get accuracy of linear acceleration.
Definition BNO08x.cpp:1724
void get_magf(float &x, float &y, float &z, uint8_t &accuracy)
Get the full magnetic field vector.
Definition BNO08x.cpp:1301
uint16_t accel_lin_accuracy
Raw linear acceleration (See SH-2 Ref. Manual 6.5.10)
Definition BNO08x.hpp:261
uint16_t quat_accuracy
Raw quaternion reading (See SH-2 Ref. Manual 6.5.44)
Definition BNO08x.hpp:263
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:966
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:1362
uint8_t get_accel_accuracy()
Get accuracy of linear acceleration.
Definition BNO08x.cpp:1666
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:2286
spi_device_interface_config_t imu_spi_config
SPI slave device settings.
Definition BNO08x.hpp:254
static const constexpr uint8_t SENSOR_REPORTID_TAP_DETECTOR
See SH2 Ref. Manual 6.5.27.
Definition BNO08x.hpp:340
int16_t get_Q1(uint16_t record_ID)
Gets Q1 point from BNO08x FRS (flash record system).
Definition BNO08x.cpp:2158
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:1234
static const constexpr uint8_t SENSOR_REPORTID_ACCELEROMETER
See SH2 Ref. Manual 6.5.9.
Definition BNO08x.hpp:330
uint8_t get_tap_detector()
Get if tap has occured.
Definition BNO08x.cpp:2023
uint8_t get_magf_accuracy()
Get accuracy of reported magnetic field vector.
Definition BNO08x.cpp:1347
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:285
volatile bool int_asserted
Interrupt asserted flag, sets true after hint_handler ISR launches SPI task and it has run to complet...
Definition BNO08x.hpp:283
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:2385
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:1829
static const constexpr uint8_t COMMAND_CLEAR_DCD
Clear DCD & Reset command (See SH2 Ref. Manual 6.4)
Definition BNO08x.hpp:316
uint8_t get_activity_classifier()
Get the current activity classifier (Seee Ref. Manual 6.5.36)
Definition BNO08x.cpp:2064
float get_uncalibrated_gyro_bias_Z()
Get uncalibrated gyro Z axis drift estimate.
Definition BNO08x.cpp:1956
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:1538
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:1165
static const constexpr uint8_t SENSOR_REPORTID_LINEAR_ACCELERATION
See SH2 Ref. Manual 6.5.10.
Definition BNO08x.hpp:333
static const constexpr uint64_t HOST_INT_TIMEOUT_US
Max wait between HINT being asserted by BNO08x before transaction is considered failed.
Definition BNO08x.hpp:297
static const constexpr uint8_t SHTP_REPORT_PRODUCT_ID_REQUEST
See SH2 Ref. Manual 6.3.1.
Definition BNO08x.hpp:324
float get_gravity_Z()
Get the reported z axis gravity.
Definition BNO08x.cpp:1395
static const constexpr uint8_t CALIBRATE_STOP
Stop calibration command used by queue_calibrate_command.
Definition BNO08x.hpp:305
uint16_t mems_raw_accel_Z
Raw accelerometer readings from MEMS sensor (See SH2 Ref. Manual 6.5.8)
Definition BNO08x.hpp:274
static const constexpr uint8_t TARE_SET_REORIENTATION
See SH2 Ref. Manual 6.4.4.3.
Definition BNO08x.hpp:353
float get_quat_real()
Get real component of reported quaternion.
Definition BNO08x.cpp:1586
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:240
TaskHandle_t spi_task_hdl
SPI task handle.
Definition BNO08x.hpp:279
float get_quat_radian_accuracy()
Get radian accuracy of reported quaternion.
Definition BNO08x.cpp:1597
static bno08x_config_t default_imu_config
default imu config settings
Definition BNO08x.hpp:238
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:996
float get_yaw()
Get the reported rotation about z axis.
Definition BNO08x.cpp:1473
void queue_packet(uint8_t channel_number, uint8_t data_length)
Queues an SHTP packet to be sent via SPI.
Definition BNO08x.cpp:390
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:2409
static const constexpr uint8_t SENSOR_REPORTID_MAGNETIC_FIELD
See SH2 Ref. Manual 6.5.16.
Definition BNO08x.hpp:332
uint16_t packet_length_tx
Packet length to be sent with send_packet()
Definition BNO08x.hpp:249
float get_roll_deg()
Get the reported rotation about x axis.
Definition BNO08x.cpp:1500
int16_t get_raw_accel_Z()
Get raw accelerometer z axis reading from physical accelerometer MEMs sensor (See Ref....
Definition BNO08x.cpp:1754
bool calibration_complete()
Returns true if calibration has completed.
Definition BNO08x.cpp:597
float get_uncalibrated_gyro_bias_Y()
Get uncalibrated gyro Y axis drift estimate.
Definition BNO08x.cpp:1946
static const constexpr uint8_t SHTP_REPORT_FRS_READ_REQUEST
See SH2 Ref. Manual 6.3.6.
Definition BNO08x.hpp:322
uint8_t tx_buffer[50]
buffer used for sending packet with send_packet()
Definition BNO08x.hpp:243
uint8_t activity_classifier
Activity status reading (See SH-2 Ref. Manual 6.5.36)
Definition BNO08x.hpp:271
void enable_gyro(uint16_t time_between_reports)
Sends command to enable gyro reports (See Ref. Manual 6.5.13)
Definition BNO08x.cpp:1100
float get_linear_accel_X()
Get x axis linear acceleration (acceleration of device minus gravity, units in m/s^2)
Definition BNO08x.cpp:1694
static const constexpr uint8_t COMMAND_DCD_PERIOD_SAVE
Configure DCD periodic saving (See SH2 Ref. Manual 6.4)
Definition BNO08x.hpp:314
uint8_t rx_buffer[300]
buffer used to receive packet with receive_packet()
Definition BNO08x.hpp:242
uint16_t parse_input_report()
Parses received input report sent by BNO08x.
Definition BNO08x.cpp:788
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:247
static void IRAM_ATTR hint_handler(void *arg)
HINT interrupt service routine, handles falling edge of BNO08x HINT pin.
Definition BNO08x.cpp:2457
uint8_t get_gyro_accuracy()
Get calibrated gyro accuracy.
Definition BNO08x.cpp:1872
float get_magf_Y()
Get Y component of magnetic field vector.
Definition BNO08x.cpp:1325
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:313
float get_gravity_X()
Get the reported x axis gravity.
Definition BNO08x.cpp:1375
float get_roll()
Get the reported rotation about x axis.
Definition BNO08x.cpp:1415
float get_gravity_Y()
Get the reported y axis gravity.
Definition BNO08x.cpp:1385
static const constexpr uint8_t SENSOR_REPORTID_GYRO_INTEGRATED_ROTATION_VECTOR
See SH2 Ref. Manual 6.5.44.
Definition BNO08x.hpp:339
static const constexpr uint8_t TARE_ROTATION_VECTOR
Tare rotation vector.
Definition BNO08x.hpp:359
uint8_t packet_header_rx[4]
SHTP header received with receive_packet()
Definition BNO08x.hpp:244
uint16_t mems_raw_magf_Z
Raw magnetometer (compass) readings from MEMS sensor (See SH-2 Ref. Manual 6.5.15)
Definition BNO08x.hpp:276
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:1139
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:289
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:1623
int16_t get_Q2(uint16_t record_ID)
Gets Q2 point from BNO08x FRS (flash record system).
Definition BNO08x.cpp:2173
static const constexpr uint8_t CALIBRATE_PLANAR_ACCEL
Calibrate planar acceleration command used by queue_calibrate_command.
Definition BNO08x.hpp:303
int16_t get_raw_accel_Y()
Get raw accelerometer y axis reading from physical accelerometer MEMs sensor (See Ref....
Definition BNO08x.cpp:1744
bool soft_reset()
Soft resets BNO08x sensor using executable channel.
Definition BNO08x.cpp:247
spi_bus_config_t bus_config
SPI bus GPIO configuration settings.
Definition BNO08x.hpp:253
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:262
int16_t get_raw_magf_Z()
Get raw magnetometer z axis reading from physical magnetometer sensor (See Ref. Manual 6....
Definition BNO08x.cpp:1814
void calibrate_gyro()
Sends command to calibrate gyro.
Definition BNO08x.cpp:494
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:362
float get_quat_K()
Get K component of reported quaternion.
Definition BNO08x.cpp:1575
float get_quat_J()
Get J component of reported quaternion.
Definition BNO08x.cpp:1564
static const constexpr int16_t MAGNETOMETER_Q1
Magnetometer Q point (See SH-2 Ref. Manual 6.5.16)
Definition BNO08x.hpp:293
void save_calibration()
Sends command to save internal calibration data (See Ref. Manual 6.4.7).
Definition BNO08x.cpp:622
static const constexpr int16_t GYRO_Q1
Gyro Q point (See SH-2 Ref. Manual 6.5.13)
Definition BNO08x.hpp:292
uint8_t sequence_number[6]
Sequence num of each com channel, 6 in total.
Definition BNO08x.hpp:246
static const constexpr uint8_t SENSOR_REPORTID_RAW_ACCELEROMETER
See SH2 Ref. Manual 6.5.8.
Definition BNO08x.hpp:343
static const constexpr uint8_t SENSOR_REPORTID_RAW_GYROSCOPE
See SH2 Ref. Manual 6.5.12.
Definition BNO08x.hpp:344
static const constexpr int16_t ANGULAR_VELOCITY_Q1
Angular velocity Q point (See SH-2 Ref. Manual 6.5.44)
Definition BNO08x.hpp:294
static const constexpr uint8_t SENSOR_REPORTID_STEP_COUNTER
See SH2 Ref. Manual 6.5.29.
Definition BNO08x.hpp:341
static const constexpr uint8_t SENSOR_REPORTID_ROTATION_VECTOR
See SH2 Ref. Manual 6.5.18.
Definition BNO08x.hpp:334
static const constexpr uint8_t SHTP_REPORT_COMMAND_REQUEST
See SH2 Ref. Manual 6.3.8.
Definition BNO08x.hpp:320
static const constexpr uint8_t SENSOR_REPORTID_GAME_ROTATION_VECTOR
See SH2 Ref. Manual 6.5.19.
Definition BNO08x.hpp:337
uint16_t raw_velocity_gyro_Z
Raw gyro angular velocity reading (See SH-2 Ref. Manual 6.5.44)
Definition BNO08x.hpp:264
float get_magf_Z()
Get Z component of magnetic field vector.
Definition BNO08x.cpp:1336
void queue_request_product_id_command()
Queues a packet containing the request product ID command.
Definition BNO08x.cpp:458
float get_gyro_calibrated_velocity_X()
Get calibrated gyro x axis angular velocity measurement.
Definition BNO08x.cpp:1842
static const constexpr uint8_t SENSOR_REPORTID_UNCALIBRATED_GYRO
See SH2 Ref. Manual 6.5.14.
Definition BNO08x.hpp:336
static const constexpr uint8_t TARE_GAME_ROTATION_VECTOR
Tare game rotation vector.
Definition BNO08x.hpp:360
uint32_t time_stamp
Report timestamp (see datasheet 1.3.5.3)
Definition BNO08x.hpp:259
float get_accel_X()
Get x axis acceleration (total acceleration of device, units in m/s^2).
Definition BNO08x.cpp:1636
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:1009
static const constexpr uint8_t CALIBRATE_MAG
Calibrate magnetometer command used by queue_calibrate_command.
Definition BNO08x.hpp:302
spi_transaction_t spi_transaction
SPI transaction handle.
Definition BNO08x.hpp:256
bool mode_on()
Turns on/ brings BNO08x sensor out of sleep mode using executable channel.
Definition BNO08x.cpp:293
uint8_t command_sequence_number
Sequence num of command, sent within command packet.
Definition BNO08x.hpp:248
void calibrate_magnetometer()
Sends command to calibrate magnetometer.
Definition BNO08x.cpp:506
uint16_t mems_raw_gyro_Z
Raw gyro readings from MEMS sensor (See SH-2 Ref. Manual 6.5.12)
Definition BNO08x.hpp:275
uint16_t magf_accuracy
Calibrated magnetic field reading in uTesla (See SH-2 Ref. Manual 6.5.16)
Definition BNO08x.hpp:267
static const constexpr uint8_t SENSOR_REPORTID_RAW_MAGNETOMETER
See SH2 Ref. Manual 6.5.15.
Definition BNO08x.hpp:345
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:1113
void end_calibration()
Sends command to end calibration procedure.
Definition BNO08x.cpp:610
uint8_t commands[20]
Command to be sent with send_packet()
Definition BNO08x.hpp:245
spi_device_handle_t spi_hdl
SPI device handle.
Definition BNO08x.hpp:255
uint8_t get_gravity_accuracy()
Get the reported gravity accuracy.
Definition BNO08x.cpp:1405
float get_gyro_velocity_Y()
Get y axis angular velocity from gyro-integrated rotation vector. (See Ref. Manual 6....
Definition BNO08x.cpp:2003
float get_gyro_velocity_X()
Get x axis angular velocity from gyro-integrated rotation vector. (See Ref. Manual 6....
Definition BNO08x.cpp:1993
static const constexpr uint8_t CALIBRATE_ACCEL
Calibrate accelerometer command used by queue_calibrate_command.
Definition BNO08x.hpp:300
void enable_magnetometer(uint16_t time_between_reports)
Sends command to enable magnetometer reports (See Ref. Manual 6.5.16)
Definition BNO08x.cpp:1126
void queue_calibrate_command(uint8_t _to_calibrate)
Queues a packet containing a command to calibrate the specified sensor.
Definition BNO08x.cpp:532
static const constexpr int16_t LINEAR_ACCELEROMETER_Q1
Linear acceleration Q point (See SH-2 Ref. Manual 6.5.10)
Definition BNO08x.hpp:291
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:1220
uint8_t calibration_status
Calibration status of device (See SH-2 Ref. Manual 6.4.7.1 & 6.4.7.2)
Definition BNO08x.hpp:273
float get_uncalibrated_gyro_bias_X()
Get uncalibrated gyro x axis drift estimate.
Definition BNO08x.cpp:1936
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:1074
float get_gyro_calibrated_velocity_Y()
Get calibrated gyro y axis angular velocity measurement.
Definition BNO08x.cpp:1852
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:1152
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:1681
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:1194
uint16_t step_count
Step counter reading (See SH-2 Ref. Manual 6.5.29)
Definition BNO08x.hpp:269
uint32_t get_time_stamp()
Return timestamp of most recent report.
Definition BNO08x.cpp:1286
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:1035
uint16_t get_step_count()
Get the counted amount of steps.
Definition BNO08x.cpp:2035
int16_t get_raw_magf_X()
Get raw magnetometer x axis reading from physical magnetometer sensor (See Ref. Manual 6....
Definition BNO08x.cpp:1794
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:2257
uint16_t gravity_accuracy
Gravity reading in m/s^2 (See SH-2 Ref. Manual 6.5.11)
Definition BNO08x.hpp:265
static const constexpr int16_t GRAVITY_Q1
Gravity Q point (See SH-2 Ref. Manual 6.5.11)
Definition BNO08x.hpp:295
float get_gyro_velocity_Z()
Get z axis angular velocity from gyro-integrated rotation vector. (See Ref. Manual 6....
Definition BNO08x.cpp:2013
static const constexpr uint8_t SHTP_REPORT_BASE_TIMESTAMP
See SH2 Ref. Manual 7.2.1.
Definition BNO08x.hpp:325
bool receive_packet()
Receives a SHTP packet via SPI.
Definition BNO08x.cpp:337
bool run_full_calibration_routine()
Runs full calibration routine.
Definition BNO08x.cpp:640
bool initialize()
Initializes BNO08x sensor.
Definition BNO08x.cpp:114
static const constexpr uint8_t CALIBRATE_GYRO
Calibrate gyro command used by queue_calibrate_command.
Definition BNO08x.hpp:301
static const constexpr uint8_t SHTP_REPORT_FRS_READ_RESPONSE
See SH2 Ref. Manual 6.3.7.
Definition BNO08x.hpp:321
static const constexpr uint8_t SENSOR_REPORTID_GEOMAGNETIC_ROTATION_VECTOR
See SH2 Ref. Manual 6.5.20.
Definition BNO08x.hpp:338
static const constexpr uint8_t TARE_AXIS_Z
Tar yaw axis only (used with tare now command)
Definition BNO08x.hpp:356
static const constexpr uint8_t TARE_AR_VR_STABILIZED_GAME_ROTATION_VECTOR
Tare ARVR stabilized game rotation vector.
Definition BNO08x.hpp:364
bno08x_config_t imu_config
IMU configuration settings.
Definition BNO08x.hpp:252
SemaphoreHandle_t tx_semaphore
Mutex semaphore used to prevent sending or receiving of packets if packet is currently being queued.
Definition BNO08x.hpp:241
static const constexpr uint8_t SENSOR_REPORTID_GRAVITY
See SH2 Ref. Manual 6.5.11.
Definition BNO08x.hpp:335
void calibrate_accelerometer()
Sends command to calibrate accelerometer.
Definition BNO08x.cpp:482
static const constexpr uint8_t COMMAND_DCD
Save DCD command (See SH2 Ref. Manual 6.4.7)
Definition BNO08x.hpp:312
int16_t get_raw_gyro_X()
Get raw gyroscope x axis reading from physical gyroscope MEMs sensor (See Ref. Manual 6....
Definition BNO08x.cpp:1764
float get_pitch_deg()
Get the reported rotation about y axis.
Definition BNO08x.cpp:1510
static const constexpr uint8_t CALIBRATE_ACCEL_GYRO_MAG
Calibrate accelerometer, gyro, & magnetometer command used by queue_calibrate_command.
Definition BNO08x.hpp:304
uint16_t packet_length_rx
Packet length received (calculated from packet_header_rx)
Definition BNO08x.hpp:250
float get_yaw_deg()
Get the reported rotation about z axis.
Definition BNO08x.cpp:1520
uint8_t * activity_confidences
Confidence of read activities (See SH-2 Ref. Manual 6.5.36)
Definition BNO08x.hpp:272
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:1207
static const constexpr uint8_t SENSOR_REPORTID_STABILITY_CLASSIFIER
See SH2 Ref. Manual 6.5.31.
Definition BNO08x.hpp:342
void save_tare()
Sends command to save tare into non-volatile memory of BNO08x (See Ref. Manual 6.4....
Definition BNO08x.cpp:1246
void calibrate_all()
Sends command to calibrate accelerometer, gyro, and magnetometer.
Definition BNO08x.cpp:470
float get_accel_Y()
Get y axis acceleration (total acceleration of device, units in m/s^2).
Definition BNO08x.cpp:1646
float get_linear_accel_Z()
Get z axis linear acceleration (acceleration of device minus gravity, units in m/s^2)
Definition BNO08x.cpp:1714
void clear_tare()
Sends command to clear persistent tare settings in non-volatile memory of BNO08x (See Ref....
Definition BNO08x.cpp:1258
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:1981
int16_t get_raw_gyro_Y()
Get raw gyroscope y axis reading from physical gyroscope MEMs sensor (See Ref. Manual 6....
Definition BNO08x.cpp:1774
void request_calibration_status()
Requests ME calibration status from BNO08x (see Ref. Manual 6.4.7.2)
Definition BNO08x.cpp:579
IMU configuration settings passed into constructor.
Definition BNO08x.hpp:42
spi_host_device_t spi_peripheral
SPI peripheral to be used.
Definition BNO08x.hpp:43
gpio_num_t io_int
Chip select pin (connects to BNO08x CS pin)
Definition BNO08x.hpp:48
gpio_num_t io_rst
Host interrupt pin (connects to BNO08x INT pin)
Definition BNO08x.hpp:49
gpio_num_t io_sclk
SCLK pin (connects to BNO08x SCL pin)
Definition BNO08x.hpp:46
uint64_t sclk_speed
Desired SPI SCLK speed in Hz (max 3MHz)
Definition BNO08x.hpp:51
bool debug_en
Whether or not debugging print statements are enabled.
Definition BNO08x.hpp:52
gpio_num_t io_mosi
MOSI GPIO pin (connects to BNO08x DI pin)
Definition BNO08x.hpp:44
gpio_num_t io_wake
Reset pin (connects to BNO08x RST pin)
Definition BNO08x.hpp:50
gpio_num_t io_miso
MISO GPIO pin (connects to BNO08x SDA pin)
Definition BNO08x.hpp:45
bno08x_config_t()
Default IMU configuration settings
Definition BNO08x.hpp:55