esp32_BNO08x 1.4
C++ BNO08x IMU driver component for esp-idf.
BNO08xGlobalTypes.hpp File Reference
#include <math.h>
#include <inttypes.h>
#include <stdint.h>
#include <cstring>
#include <driver/gpio.h>
#include <driver/spi_common.h>
#include <driver/spi_master.h>
#include "sh2_SensorValue.h"
Include dependency graph for BNO08xGlobalTypes.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  bno08x_config_t
 IMU configuration settings passed into constructor. More...
 
struct  bno08x_quat_t
 Struct to represent unit quaternion. More...
 
struct  bno08x_euler_angle_t
 Struct to represent euler angle (units in degrees or rads) More...
 
struct  bno08x_ang_vel_t
 Struct to represent angular velocity (units in rad/s) More...
 
struct  bno08x_magf_t
 Struct to represent magnetic field data (units in uTesla) More...
 
struct  bno08x_magf_bias_t
 Struct to represent magnetic field bias data (units in uTesla) More...
 
struct  bno08x_gyro_t
 Struct to represent gyro data (units in rad/s) More...
 
struct  bno08x_gyro_bias_t
 Struct to represent gyro bias data (units in rad/s) More...
 
struct  bno08x_activity_classifier_t
 Struct to represent activity classifier data. More...
 
struct  bno08x_tap_detector_t
 Struct to represent tap detector data (flag meaning: 0 = no tap, 1 = positive tap on axis, -1 = negative tap on axis) More...
 
struct  bno08x_shake_detector_t
 Struct to represent shake detector data (flag meaning: 0 = no shake 1 = shake detected) More...
 
struct  bno08x_accel_t
 Struct to represent acceleration data from acceleration, linear acceleration, and gravity reports. More...
 
struct  bno08x_step_counter_t
 Struct to represent step counter data from step counter reports. More...
 
struct  bno08x_raw_gyro_t
 Struct to represent raw mems gyro data from raw gyro reports (units in ADC counts). More...
 
struct  bno08x_raw_accel_t
 Struct to represent raw mems accelerometer data from raw accelerometer reports (units in ADC counts). More...
 
struct  bno08x_raw_magf_t
 Struct to represent raw mems magnetometer data from raw magnetometer reports (units in ADC counts). More...
 
struct  bno08x_stability_classifier_t
 Struct to represent stability classifier data from stability classifier reports. More...
 
struct  bno08x_sample_counts_t
 Struct to represent sample counts, returned from BNO08xRpt::get_sample_counts() More...
 
struct  bno08x_meta_data_t
 Struct to represent sensor/report meta data, returned from BNO08xRpt::get_meta_data() More...
 

Macros

#define TAP_DETECTED_X_AXIS(tap)   ((tap) & (1U << 0U) ? 1 : 0)
 
#define TAP_DETECTED_X_AXIS_POSITIVE(tap)   ((tap) & (1U << 1U) ? 1 : 0)
 
#define TAP_DETECTED_Y_AXIS(tap)   ((tap) & (1U << 2U) ? 1 : 0)
 
#define TAP_DETECTED_Y_AXIS_POSITIVE(tap)   ((tap) & (1U << 3U) ? 1 : 0)
 
#define TAP_DETECTED_Z_AXIS(tap)   ((tap) & (1U << 4U) ? 1 : 0)
 
#define TAP_DETECTED_Z_AXIS_POSITIVE(tap)   ((tap) & (1U << 5U) ? 1 : 0)
 
#define TAP_DETECTED_DOUBLE(tap)   ((tap) & (1U << 6U) ? 1 : 0)
 
#define SHAKE_DETECTED_X(tap)   ((tap) & (1U << 0U) ? 1 : 0)
 
#define SHAKE_DETECTED_Y(tap)   ((tap) & (1U << 1U) ? 1 : 0)
 
#define SHAKE_DETECTED_Z(tap)   ((tap) & (1U << 2U) ? 1 : 0)
 

Typedefs

typedef struct bno08x_config_t bno08x_config_t
 IMU configuration settings passed into constructor. More...
 
typedef bno08x_config_t imu_config_t
 
using IMUAccuracy = BNO08xAccuracy
 
typedef struct bno08x_quat_t bno08x_quat_t
 Struct to represent unit quaternion. More...
 
typedef struct bno08x_euler_angle_t bno08x_euler_angle_t
 Struct to represent euler angle (units in degrees or rads) More...
 
typedef struct bno08x_ang_vel_t bno08x_ang_vel_t
 Struct to represent angular velocity (units in rad/s) More...
 
typedef struct bno08x_magf_t bno08x_magf_t
 Struct to represent magnetic field data (units in uTesla) More...
 
typedef struct bno08x_magf_bias_t bno08x_magf_bias_t
 Struct to represent magnetic field bias data (units in uTesla) More...
 
typedef struct bno08x_gyro_t bno08x_gyro_t
 Struct to represent gyro data (units in rad/s) More...
 
typedef struct bno08x_gyro_bias_t bno08x_gyro_bias_t
 Struct to represent gyro bias data (units in rad/s) More...
 
typedef struct bno08x_activity_classifier_t bno08x_activity_classifier_t
 Struct to represent activity classifier data. More...
 
typedef struct bno08x_tap_detector_t bno08x_tap_detector_t
 Struct to represent tap detector data (flag meaning: 0 = no tap, 1 = positive tap on axis, -1 = negative tap on axis) More...
 
typedef struct bno08x_shake_detector_t bno08x_shake_detector_t
 Struct to represent shake detector data (flag meaning: 0 = no shake 1 = shake detected) More...
 
typedef struct bno08x_accel_t bno08x_accel_t
 Struct to represent acceleration data from acceleration, linear acceleration, and gravity reports. More...
 
typedef struct bno08x_step_counter_t bno08x_step_counter_t
 Struct to represent step counter data from step counter reports. More...
 
typedef struct bno08x_raw_gyro_t bno08x_raw_gyro_t
 Struct to represent raw mems gyro data from raw gyro reports (units in ADC counts). More...
 
typedef struct bno08x_raw_accel_t bno08x_raw_accel_t
 Struct to represent raw mems accelerometer data from raw accelerometer reports (units in ADC counts). More...
 
typedef struct bno08x_raw_magf_t bno08x_raw_magf_t
 Struct to represent raw mems magnetometer data from raw magnetometer reports (units in ADC counts). More...
 
typedef struct bno08x_stability_classifier_t bno08x_stability_classifier_t
 Struct to represent stability classifier data from stability classifier reports. More...
 
typedef struct bno08x_sample_counts_t bno08x_sample_counts_t
 Struct to represent sample counts, returned from BNO08xRpt::get_sample_counts() More...
 
typedef struct bno08x_meta_data_t bno08x_meta_data_t
 Struct to represent sensor/report meta data, returned from BNO08xRpt::get_meta_data() More...
 

Enumerations

enum class  BNO08xCalSel : uint8_t {
  accelerometer = SH2_CAL_ACCEL , gyro = SH2_CAL_GYRO , magnetometer = SH2_CAL_MAG , planar_accelerometer = SH2_CAL_PLANAR ,
  all = (SH2_CAL_ACCEL | SH2_CAL_GYRO | SH2_CAL_MAG | SH2_CAL_PLANAR)
}
 
enum class  BNO08xResetReason : uint8_t {
  UNDEFINED , POR , INT_RST , WTD ,
  EXT_RST , OTHER
}
 Reason for previous IMU reset (returned by get_reset_reason()) More...
 
enum class  BNO08xAccuracy : uint8_t {
  UNRELIABLE , LOW , MED , HIGH ,
  UNDEFINED
}
 Sensor accuracy returned from input reports, corresponds to status bits (see ref. manual 6.5.1) More...
 
enum class  BNO08xActivityEnable : uint32_t {
  UNKNOWN = (1U << 0U) , IN_VEHICLE = (1U << 1U) , ON_BICYCLE = (1U << 2U) , ON_FOOT = (1U << 3U) ,
  STILL = (1U << 4U) , TILTING = (1U << 5U) , WALKING = (1U << 6U) , RUNNING = (1U << 7U) ,
  ON_STAIRS = (1U << 8U) , ALL = (UNKNOWN | IN_VEHICLE | ON_BICYCLE | ON_FOOT | STILL | TILTING | WALKING | RUNNING | ON_STAIRS)
}
 BNO08xActivity Classifier enable bits passed to enable_activity_classifier() See ref manual 6.5.36.1. More...
 
enum class  BNO08xActivity : uint8_t {
  UNKNOWN = 0 , IN_VEHICLE = 1 , ON_BICYCLE = 2 , ON_FOOT = 3 ,
  STILL = 4 , TILTING = 5 , WALKING = 6 , RUNNING = 7 ,
  ON_STAIRS = 8 , UNDEFINED = 9
}
 BNO08xActivity states returned from BNO08x::activity_classifier.get() More...
 
enum class  BNO08xStability : uint8_t {
  UNKNOWN = 0 , ON_TABLE = 1 , STATIONARY = 2 , STABLE = 3 ,
  MOTION = 4 , RESERVED = 5 , UNDEFINED = 6
}
 BNO08xStability states returned from BNO08x::stability_classifier.get() More...
 
enum class  BNO08xFrsID : uint16_t {
  STATIC_CALIBRATION_AGM = 0x7979 , NOMINAL_CALIBRATION = 0x4D4D , STATIC_CALIBRATION_SRA = 0x8A8A , NOMINAL_CALIBRATION_SRA = 0x4E4E ,
  DYNAMIC_CALIBRATION = 0x1F1F , ME_POWER_MGMT = 0xD3E2 , SYSTEM_ORIENTATION = 0x2D3E , ACCEL_ORIENTATION = 0x2D41 ,
  SCREEN_ACCEL_ORIENTATION = 0x2D43 , GYROSCOPE_ORIENTATION = 0x2D46 , MAGNETOMETER_ORIENTATION = 0x2D4C , ARVR_STABILIZATION_RV = 0x3E2D ,
  ARVR_STABILIZATION_GRV = 0x3E2E , TAP_DETECT_CONFIG = 0xC269 , SIG_MOTION_DETECT_CONFIG = 0xC274 , SHAKE_DETECT_CONFIG = 0x7D7D ,
  MAX_FUSION_PERIOD = 0xD7D7 , SERIAL_NUMBER = 0x4B4B , ES_PRESSURE_CAL = 0x39AF , ES_TEMPERATURE_CAL = 0x4D20 ,
  ES_HUMIDITY_CAL = 0x1AC9 , ES_AMBIENT_LIGHT_CAL = 0x39B1 , ES_PROXIMITY_CAL = 0x4DA2 , ALS_CAL = 0xD401 ,
  PROXIMITY_SENSOR_CAL = 0xD402 , PICKUP_DETECTOR_CONFIG = 0x1B2A , FLIP_DETECTOR_CONFIG = 0xFC94 , STABILITY_DETECTOR_CONFIG = 0xED85 ,
  ACTIVITY_TRACKER_CONFIG = 0xED88 , SLEEP_DETECTOR_CONFIG = 0xED87 , TILT_DETECTOR_CONFIG = 0xED89 , POCKET_DETECTOR_CONFIG = 0xEF27 ,
  CIRCLE_DETECTOR_CONFIG = 0xEE51 , USER_RECORD = 0x74B4 , ME_TIME_SOURCE_SELECT = 0xD403 , UART_FORMAT = 0xA1A1 ,
  GYRO_INTEGRATED_RV_CONFIG = 0xA1A2 , META_RAW_ACCELEROMETER = 0xE301 , META_ACCELEROMETER = 0xE302 , META_LINEAR_ACCELERATION = 0xE303 ,
  META_GRAVITY = 0xE304 , META_RAW_GYROSCOPE = 0xE305 , META_GYROSCOPE_CALIBRATED = 0xE306 , META_GYROSCOPE_UNCALIBRATED = 0xE307 ,
  META_RAW_MAGNETOMETER = 0xE308 , META_MAGNETIC_FIELD_CALIBRATED = 0xE309 , META_MAGNETIC_FIELD_UNCALIBRATED = 0xE30A , META_ROTATION_VECTOR = 0xE30B ,
  META_GAME_ROTATION_VECTOR = 0xE30C , META_GEOMAGNETIC_ROTATION_VECTOR = 0xE30D , META_PRESSURE = 0xE30E , META_AMBIENT_LIGHT = 0xE30F ,
  META_HUMIDITY = 0xE310 , META_PROXIMITY = 0xE311 , META_TEMPERATURE = 0xE312 , META_TAP_DETECTOR = 0xE313 ,
  META_STEP_DETECTOR = 0xE314 , META_STEP_COUNTER = 0xE315 , META_SIGNIFICANT_MOTION = 0xE316 , META_STABILITY_CLASSIFIER = 0xE317 ,
  META_SHAKE_DETECTOR = 0xE318 , META_FLIP_DETECTOR = 0xE319 , META_PICKUP_DETECTOR = 0xE31A , META_STABILITY_DETECTOR = 0xE31B ,
  META_PERSONAL_ACTIVITY_CLASSIFIER = 0xE31C , META_SLEEP_DETECTOR = 0xE31D , META_TILT_DETECTOR = 0xE31E , META_POCKET_DETECTOR = 0xE31F ,
  META_CIRCLE_DETECTOR = 0xE320 , META_HEART_RATE_MONITOR = 0xE321 , META_ARVR_STABILIZED_RV = 0xE322 , META_ARVR_STABILIZED_GRV = 0xE323 ,
  META_GYRO_INTEGRATED_RV = 0xE324
}
 

Functions

const constexpr char * BNO08xAccuracy_to_str (BNO08xAccuracy accuracy)
 
const constexpr char * BNO08xActivity_to_str (BNO08xActivity activity)
 Converts a BNO08xActivity enum to string. More...
 
const constexpr char * BNO08xStability_to_str (BNO08xStability stability)
 Converts a BNO08xStability enum to string. More...
 
const constexpr char * BNO08xFrsID_to_str (BNO08xFrsID id)
 

Detailed Description

Author
Myles Parfeniuk

Macro Definition Documentation

◆ SHAKE_DETECTED_X

#define SHAKE_DETECTED_X (   tap)    ((tap) & (1U << 0U) ? 1 : 0)

◆ SHAKE_DETECTED_Y

#define SHAKE_DETECTED_Y (   tap)    ((tap) & (1U << 1U) ? 1 : 0)

◆ SHAKE_DETECTED_Z

#define SHAKE_DETECTED_Z (   tap)    ((tap) & (1U << 2U) ? 1 : 0)

◆ TAP_DETECTED_DOUBLE

#define TAP_DETECTED_DOUBLE (   tap)    ((tap) & (1U << 6U) ? 1 : 0)

◆ TAP_DETECTED_X_AXIS

#define TAP_DETECTED_X_AXIS (   tap)    ((tap) & (1U << 0U) ? 1 : 0)

◆ TAP_DETECTED_X_AXIS_POSITIVE

#define TAP_DETECTED_X_AXIS_POSITIVE (   tap)    ((tap) & (1U << 1U) ? 1 : 0)

◆ TAP_DETECTED_Y_AXIS

#define TAP_DETECTED_Y_AXIS (   tap)    ((tap) & (1U << 2U) ? 1 : 0)

◆ TAP_DETECTED_Y_AXIS_POSITIVE

#define TAP_DETECTED_Y_AXIS_POSITIVE (   tap)    ((tap) & (1U << 3U) ? 1 : 0)

◆ TAP_DETECTED_Z_AXIS

#define TAP_DETECTED_Z_AXIS (   tap)    ((tap) & (1U << 4U) ? 1 : 0)

◆ TAP_DETECTED_Z_AXIS_POSITIVE

#define TAP_DETECTED_Z_AXIS_POSITIVE (   tap)    ((tap) & (1U << 5U) ? 1 : 0)

Typedef Documentation

◆ bno08x_accel_t

Struct to represent acceleration data from acceleration, linear acceleration, and gravity reports.

◆ bno08x_activity_classifier_t

Struct to represent activity classifier data.

◆ bno08x_ang_vel_t

Struct to represent angular velocity (units in rad/s)

◆ bno08x_config_t

IMU configuration settings passed into constructor.

◆ bno08x_euler_angle_t

Struct to represent euler angle (units in degrees or rads)

◆ bno08x_gyro_bias_t

Struct to represent gyro bias data (units in rad/s)

◆ bno08x_gyro_t

typedef struct bno08x_gyro_t bno08x_gyro_t

Struct to represent gyro data (units in rad/s)

◆ bno08x_magf_bias_t

Struct to represent magnetic field bias data (units in uTesla)

◆ bno08x_magf_t

typedef struct bno08x_magf_t bno08x_magf_t

Struct to represent magnetic field data (units in uTesla)

◆ bno08x_meta_data_t

Struct to represent sensor/report meta data, returned from BNO08xRpt::get_meta_data()

◆ bno08x_quat_t

typedef struct bno08x_quat_t bno08x_quat_t

Struct to represent unit quaternion.

◆ bno08x_raw_accel_t

Struct to represent raw mems accelerometer data from raw accelerometer reports (units in ADC counts).

◆ bno08x_raw_gyro_t

Struct to represent raw mems gyro data from raw gyro reports (units in ADC counts).

◆ bno08x_raw_magf_t

Struct to represent raw mems magnetometer data from raw magnetometer reports (units in ADC counts).

◆ bno08x_sample_counts_t

Struct to represent sample counts, returned from BNO08xRpt::get_sample_counts()

◆ bno08x_shake_detector_t

Struct to represent shake detector data (flag meaning: 0 = no shake 1 = shake detected)

◆ bno08x_stability_classifier_t

Struct to represent stability classifier data from stability classifier reports.

◆ bno08x_step_counter_t

Struct to represent step counter data from step counter reports.

◆ bno08x_tap_detector_t

Struct to represent tap detector data (flag meaning: 0 = no tap, 1 = positive tap on axis, -1 = negative tap on axis)

◆ imu_config_t

◆ IMUAccuracy

Enumeration Type Documentation

◆ BNO08xAccuracy

enum class BNO08xAccuracy : uint8_t
strong

Sensor accuracy returned from input reports, corresponds to status bits (see ref. manual 6.5.1)

Enumerator
UNRELIABLE 
LOW 
MED 
HIGH 
UNDEFINED 

◆ BNO08xActivity

enum class BNO08xActivity : uint8_t
strong

BNO08xActivity states returned from BNO08x::activity_classifier.get()

Enumerator
UNKNOWN 
IN_VEHICLE 
ON_BICYCLE 
ON_FOOT 
STILL 
TILTING 
WALKING 
RUNNING 
ON_STAIRS 
UNDEFINED 

◆ BNO08xActivityEnable

enum class BNO08xActivityEnable : uint32_t
strong

BNO08xActivity Classifier enable bits passed to enable_activity_classifier() See ref manual 6.5.36.1.

Enumerator
UNKNOWN 
IN_VEHICLE 
ON_BICYCLE 
ON_FOOT 
STILL 
TILTING 
WALKING 
RUNNING 
ON_STAIRS 
ALL 

◆ BNO08xCalSel

enum class BNO08xCalSel : uint8_t
strong
Enumerator
accelerometer 
gyro 
magnetometer 
planar_accelerometer 
all 

◆ BNO08xFrsID

enum class BNO08xFrsID : uint16_t
strong
Enumerator
STATIC_CALIBRATION_AGM 
NOMINAL_CALIBRATION 
STATIC_CALIBRATION_SRA 
NOMINAL_CALIBRATION_SRA 
DYNAMIC_CALIBRATION 
ME_POWER_MGMT 
SYSTEM_ORIENTATION 
ACCEL_ORIENTATION 
SCREEN_ACCEL_ORIENTATION 
GYROSCOPE_ORIENTATION 
MAGNETOMETER_ORIENTATION 
ARVR_STABILIZATION_RV 
ARVR_STABILIZATION_GRV 
TAP_DETECT_CONFIG 
SIG_MOTION_DETECT_CONFIG 
SHAKE_DETECT_CONFIG 
MAX_FUSION_PERIOD 
SERIAL_NUMBER 
ES_PRESSURE_CAL 
ES_TEMPERATURE_CAL 
ES_HUMIDITY_CAL 
ES_AMBIENT_LIGHT_CAL 
ES_PROXIMITY_CAL 
ALS_CAL 
PROXIMITY_SENSOR_CAL 
PICKUP_DETECTOR_CONFIG 
FLIP_DETECTOR_CONFIG 
STABILITY_DETECTOR_CONFIG 
ACTIVITY_TRACKER_CONFIG 
SLEEP_DETECTOR_CONFIG 
TILT_DETECTOR_CONFIG 
POCKET_DETECTOR_CONFIG 
CIRCLE_DETECTOR_CONFIG 
USER_RECORD 
ME_TIME_SOURCE_SELECT 
UART_FORMAT 
GYRO_INTEGRATED_RV_CONFIG 
META_RAW_ACCELEROMETER 
META_ACCELEROMETER 
META_LINEAR_ACCELERATION 
META_GRAVITY 
META_RAW_GYROSCOPE 
META_GYROSCOPE_CALIBRATED 
META_GYROSCOPE_UNCALIBRATED 
META_RAW_MAGNETOMETER 
META_MAGNETIC_FIELD_CALIBRATED 
META_MAGNETIC_FIELD_UNCALIBRATED 
META_ROTATION_VECTOR 
META_GAME_ROTATION_VECTOR 
META_GEOMAGNETIC_ROTATION_VECTOR 
META_PRESSURE 
META_AMBIENT_LIGHT 
META_HUMIDITY 
META_PROXIMITY 
META_TEMPERATURE 
META_TAP_DETECTOR 
META_STEP_DETECTOR 
META_STEP_COUNTER 
META_SIGNIFICANT_MOTION 
META_STABILITY_CLASSIFIER 
META_SHAKE_DETECTOR 
META_FLIP_DETECTOR 
META_PICKUP_DETECTOR 
META_STABILITY_DETECTOR 
META_PERSONAL_ACTIVITY_CLASSIFIER 
META_SLEEP_DETECTOR 
META_TILT_DETECTOR 
META_POCKET_DETECTOR 
META_CIRCLE_DETECTOR 
META_HEART_RATE_MONITOR 
META_ARVR_STABILIZED_RV 
META_ARVR_STABILIZED_GRV 
META_GYRO_INTEGRATED_RV 

◆ BNO08xResetReason

enum class BNO08xResetReason : uint8_t
strong

Reason for previous IMU reset (returned by get_reset_reason())

Enumerator
UNDEFINED 

Undefined reset reason, this should never occur and is an error.

POR 

Previous reset was due to power on reset.

INT_RST 

Previous reset was due to internal reset.

WTD 

Previous reset was due to watchdog timer.

EXT_RST 

Previous reset was due to external reset.

OTHER 

Previous reset was due to power other reason.

◆ BNO08xStability

enum class BNO08xStability : uint8_t
strong

BNO08xStability states returned from BNO08x::stability_classifier.get()

Enumerator
UNKNOWN 
ON_TABLE 
STATIONARY 
STABLE 
MOTION 
RESERVED 
UNDEFINED 

Function Documentation

◆ BNO08xAccuracy_to_str()

const constexpr char * BNO08xAccuracy_to_str ( BNO08xAccuracy  accuracy)
constexpr
Here is the caller graph for this function:

◆ BNO08xActivity_to_str()

const constexpr char * BNO08xActivity_to_str ( BNO08xActivity  activity)
constexpr

Converts a BNO08xActivity enum to string.

Returns
The resulting string conversion of the enum.

◆ BNO08xFrsID_to_str()

const constexpr char * BNO08xFrsID_to_str ( BNO08xFrsID  id)
constexpr
Here is the caller graph for this function:

◆ BNO08xStability_to_str()

const constexpr char * BNO08xStability_to_str ( BNO08xStability  stability)
constexpr

Converts a BNO08xStability enum to string.

Returns
The resulting string conversion of the enum.