# esp32_BNO08x: include/BNO08x.hpp Source File

Loading...
Searching...
No Matches
BNO08x.hpp
Go to the documentation of this file.
#pragma once
// etl includes
#include <etl/vector.h>
#include <etl/variant.h>
#include <etl/map.h>
// esp-idf includes
#include <driver/gpio.h>
#include <driver/spi_common.h>
#include <driver/spi_master.h>
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
#include <freertos/event_groups.h>
#include <freertos/queue.h>
// in-house includes
#include "BNO08xGlobalTypes.hpp"
#include "BNO08xPrivateTypes.hpp"
#include "BNO08xSH2HAL.hpp"
#include "BNO08xReports.hpp"
class BNO08x
{
public:
BNO08x(bno08x_config_t imu_config = bno08x_config_t());
~BNO08x();
bool initialize();
bool hard_reset();
bool soft_reset();
bool disable_all_reports();
BNO08xResetReason get_reset_reason();
bool on();
bool sleep();
bool calibration_start(uint32_t period_us);
bool calibration_end(sh2_CalStatus_t& status);
bool dynamic_calibration_enable(BNO08xCalSel sensor);
bool dynamic_calibration_disable(BNO08xCalSel sensor);
bool dynamic_calibration_autosave_enable();
bool dynamic_calibration_autosave_disable();
bool save_dynamic_calibration();
bool clear_dynamic_calibration();
bool get_frs(uint16_t frs_ID, uint32_t (&data)[16], uint16_t& rx_data_sz);
sh2_ProductIds_t get_product_IDs();
bool data_available();
bool register_cb(std::function<void(void)> cb_fxn);
bool register_cb(std::function<void(uint8_t report_ID)> cb_fxn);
void print_product_ids();
// enum helper fxns
static const char* activity_to_str(BNO08xActivity activity);
static const char* stability_to_str(BNO08xStability stability);
static const char* accuracy_to_str(BNO08xAccuracy accuracy);
typedef struct bno08x_reports_t
{
BNO08xRptAcceleration accelerometer;
BNO08xRptLinearAcceleration linear_accelerometer;
BNO08xRptGravity gravity;
BNO08xRptCalMagnetometer cal_magnetometer;
BNO08xRptUncalMagnetometer uncal_magnetometer;
BNO08xRptCalGyro cal_gyro;
BNO08xRptUncalGyro uncal_gyro;
BNO08xRptRV rv;
BNO08xRptGameRV rv_game;
BNO08xRptARVRStabilizedRV rv_ARVR_stabilized;
BNO08xRptARVRStabilizedGameRV rv_ARVR_stabilized_game;
BNO08xRptIGyroRV rv_gyro_integrated;
BNO08xRptRVGeomag rv_geomagnetic;
BNO08xRptRawMEMSGyro raw_gyro;
BNO08xRptRawMEMSAccelerometer raw_accelerometer;
BNO08xRptRawMEMSMagnetometer raw_magnetometer;
BNO08xRptStepCounter step_counter;
BNO08xRptActivityClassifier activity_classifier;
BNO08xRptStabilityClassifier stability_classifier;
BNO08xRptShakeDetector shake_detector;
BNO08xRptTapDetector tap_detector;
bno08x_reports_t(BNO08xPrivateTypes::bno08x_sync_ctx_t* sync_ctx)
: accelerometer(SH2_ACCELEROMETER, BNO08xPrivateTypes::EVT_GRP_RPT_ACCELEROMETER_BIT, sync_ctx)
, linear_accelerometer(
SH2_LINEAR_ACCELERATION, BNO08xPrivateTypes::EVT_GRP_RPT_LINEAR_ACCELEROMETER_BIT, sync_ctx)
, gravity(SH2_GRAVITY, BNO08xPrivateTypes::EVT_GRP_RPT_GRAVITY_BIT, sync_ctx)
, cal_magnetometer(
SH2_MAGNETIC_FIELD_CALIBRATED, BNO08xPrivateTypes::EVT_GRP_RPT_CAL_MAGNETOMETER_BIT, sync_ctx)
, uncal_magnetometer(
SH2_MAGNETIC_FIELD_UNCALIBRATED, BNO08xPrivateTypes::EVT_GRP_RPT_UNCAL_MAGNETOMETER_BIT, sync_ctx)
, cal_gyro(SH2_GYROSCOPE_CALIBRATED, BNO08xPrivateTypes::EVT_GRP_RPT_CAL_GYRO_BIT, sync_ctx)
, uncal_gyro(SH2_GYROSCOPE_UNCALIBRATED, BNO08xPrivateTypes::EVT_GRP_RPT_UNCAL_GYRO_BIT, sync_ctx)
, rv(SH2_ROTATION_VECTOR, BNO08xPrivateTypes::EVT_GRP_RPT_RV_BIT, sync_ctx)
, rv_game(SH2_GAME_ROTATION_VECTOR, BNO08xPrivateTypes::EVT_GRP_RPT_RV_GAME_BIT, sync_ctx)
, rv_ARVR_stabilized(SH2_ARVR_STABILIZED_RV, BNO08xPrivateTypes::EVT_GRP_RPT_RV_ARVR_S_BIT, sync_ctx)
, rv_ARVR_stabilized_game(
SH2_ARVR_STABILIZED_GRV, BNO08xPrivateTypes::EVT_GRP_RPT_RV_ARVR_S_GAME_BIT, sync_ctx)
, rv_gyro_integrated(SH2_GYRO_INTEGRATED_RV, BNO08xPrivateTypes::EVT_GRP_RPT_GYRO_INTEGRATED_RV_BIT, sync_ctx)
, rv_geomagnetic(SH2_GEOMAGNETIC_ROTATION_VECTOR, BNO08xPrivateTypes::EVT_GRP_RPT_GEOMAG_RV_BIT, sync_ctx)
, raw_gyro(SH2_RAW_GYROSCOPE, BNO08xPrivateTypes::EVT_GRP_RPT_RAW_GYRO_BIT, sync_ctx)
, raw_accelerometer(SH2_RAW_ACCELEROMETER, BNO08xPrivateTypes::EVT_GRP_RPT_RAW_ACCELEROMETER_BIT, sync_ctx)
, raw_magnetometer(SH2_RAW_MAGNETOMETER, BNO08xPrivateTypes::EVT_GRP_RPT_RAW_MAGNETOMETER_BIT, sync_ctx)
, step_counter(SH2_STEP_COUNTER, BNO08xPrivateTypes::EVT_GRP_RPT_STEP_COUNTER_BIT, sync_ctx)
, activity_classifier(
SH2_PERSONAL_ACTIVITY_CLASSIFIER, BNO08xPrivateTypes::EVT_GRP_RPT_ACTIVITY_CLASSIFIER_BIT, sync_ctx)
, stability_classifier(
SH2_STABILITY_CLASSIFIER, BNO08xPrivateTypes::EVT_GRP_RPT_STABILITY_CLASSIFIER_BIT, sync_ctx)
, shake_detector(SH2_SHAKE_DETECTOR, BNO08xPrivateTypes::EVT_GRP_RPT_SHAKE_DETECTOR_BIT, sync_ctx)
, tap_detector(SH2_TAP_DETECTOR, BNO08xPrivateTypes::EVT_GRP_RPT_TAP_DETECTOR_BIT, sync_ctx)
{
}
} bno08x_reports_t;
bno08x_reports_t rpt;
private:
// data processing task
static const constexpr configSTACK_DEPTH_TYPE DATA_PROC_TASK_SZ =
CONFIG_ESP32_BNO08X_DATA_PROC_TASK_SZ;
TaskHandle_t data_proc_task_hdl;
static void data_proc_task_trampoline(void* arg);
void data_proc_task();
// sh2 service task
static const constexpr configSTACK_DEPTH_TYPE SH2_HAL_SERVICE_TASK_SZ =
CONFIG_ESP32_BNO08X_SH2_HAL_SERVICE_TASK_SZ;
TaskHandle_t sh2_HAL_service_task_hdl;
static void sh2_HAL_service_task_trampoline(void* arg);
void sh2_HAL_service_task();
// callback task
static const constexpr configSTACK_DEPTH_TYPE CB_TASK_SZ =
CONFIG_ESP32_BNO08X_CB_TASK_SZ;
TaskHandle_t cb_task_hdl;
static void cb_task_trampoline(void* arg);
void cb_task();
SemaphoreHandle_t sem_kill_tasks;
void lock_sh2_HAL();
void unlock_sh2_HAL();
void lock_user_data();
void unlock_user_data();
void handle_sensor_report(sh2_SensorValue_t* sensor_val);
void handle_cb(uint8_t rpt_ID, BNO08xCbGeneric* cb_entry);
esp_err_t init_config_args();
esp_err_t init_gpio();
esp_err_t init_gpio_inputs();
esp_err_t init_gpio_outputs();
esp_err_t init_hint_isr();
esp_err_t init_spi();
esp_err_t init_tasks();
esp_err_t init_sh2_HAL();
esp_err_t deinit_gpio();
esp_err_t deinit_gpio_inputs();
esp_err_t deinit_gpio_outputs();
esp_err_t deinit_hint_isr();
esp_err_t deinit_spi();
esp_err_t deinit_tasks();
esp_err_t deinit_sh2_HAL();
esp_err_t wait_for_hint();
esp_err_t wait_for_reset();
void toggle_reset();
esp_err_t re_enable_reports();
sh2_Hal_t sh2_HAL;
QueueHandle_t
queue_rx_sensor_event;
QueueHandle_t queue_cb_report_id;
bno08x_config_t imu_config{};
spi_bus_config_t bus_config{};
spi_device_interface_config_t imu_spi_config{};
spi_device_handle_t spi_hdl{};
spi_transaction_t spi_transaction{};
BNO08xPrivateTypes::bno08x_init_status_t
init_status;
BNO08xPrivateTypes::bno08x_sync_ctx_t sync_ctx;
sh2_ProductIds_t product_IDs;
// clang-format off
etl::map<uint8_t, BNO08xRpt*, TOTAL_RPT_COUNT, etl::less<uint8_t>> usr_reports =
{
{SH2_ACCELEROMETER, &rpt.accelerometer},
{SH2_LINEAR_ACCELERATION, &rpt.linear_accelerometer},
{SH2_GRAVITY, &rpt.gravity},
{SH2_MAGNETIC_FIELD_CALIBRATED, &rpt.cal_magnetometer},
{SH2_MAGNETIC_FIELD_UNCALIBRATED, &rpt.uncal_magnetometer},
{SH2_GYROSCOPE_CALIBRATED, &rpt.cal_gyro},
{SH2_GYROSCOPE_UNCALIBRATED, &rpt.uncal_gyro},
{SH2_ROTATION_VECTOR, &rpt.rv},
{SH2_GAME_ROTATION_VECTOR, &rpt.rv_game},
{SH2_ARVR_STABILIZED_RV, &rpt.rv_ARVR_stabilized},
{SH2_ARVR_STABILIZED_GRV, &rpt.rv_ARVR_stabilized_game},
{SH2_GYRO_INTEGRATED_RV, &rpt.rv_gyro_integrated},
{SH2_GEOMAGNETIC_ROTATION_VECTOR, &rpt.rv_geomagnetic},
{SH2_RAW_GYROSCOPE, &rpt.raw_gyro},
{SH2_RAW_ACCELEROMETER, &rpt.raw_accelerometer},
{SH2_RAW_MAGNETOMETER, &rpt.raw_magnetometer},
{SH2_STEP_COUNTER, &rpt.step_counter},
{SH2_PERSONAL_ACTIVITY_CLASSIFIER, &rpt.activity_classifier},
{SH2_STABILITY_CLASSIFIER, &rpt.stability_classifier},
{SH2_SHAKE_DETECTOR, &rpt.shake_detector},
{SH2_TAP_DETECTOR, &rpt.tap_detector},
// not implemented, see include/report for existing implementations to add your own
{SH2_PRESSURE, nullptr}, // requires auxilary i2c sensor
{SH2_AMBIENT_LIGHT, nullptr}, // requires auxilary i2c sensor
{SH2_HUMIDITY, nullptr}, // requires auxilary i2c sensor
{SH2_PROXIMITY, nullptr}, // requires auxilary i2c sensor
{SH2_TEMPERATURE, nullptr}, // requires auxilary i2c sensor
{SH2_HEART_RATE_MONITOR, nullptr}, // requires auxilary i2c sensor
{SH2_STEP_DETECTOR, nullptr},
{SH2_SIGNIFICANT_MOTION, nullptr},
{SH2_FLIP_DETECTOR, nullptr},
{SH2_PICKUP_DETECTOR, nullptr},
{SH2_STABILITY_DETECTOR, nullptr},
{SH2_SLEEP_DETECTOR, nullptr},
{SH2_TILT_DETECTOR, nullptr},
{SH2_POCKET_DETECTOR, nullptr},
{SH2_CIRCLE_DETECTOR, nullptr},
{SH2_IZRO_MOTION_REQUEST, nullptr}
};
// clang-format on
static void IRAM_ATTR hint_handler(void* arg);
static const constexpr uint16_t RX_DATA_LENGTH = 300U;
static const constexpr TickType_t HOST_INT_TIMEOUT_DEFAULT_MS =
CONFIG_ESP32_BNO08X_HINT_TIMEOUT_MS /
portTICK_PERIOD_MS;
static const constexpr TickType_t DATA_AVAILABLE_TIMEOUT_MS =
CONFIG_ESP32_BNO08X_DATA_AVAILABLE_TIMEOUT_MS /
portTICK_PERIOD_MS;
static const constexpr TickType_t HARD_RESET_DELAY_MS =
CONFIG_ESP32_BNO08X_HARD_RESET_DELAY_MS /
portTICK_PERIOD_MS;
static const constexpr uint32_t SCLK_MAX_SPEED = 3000000UL;
static const constexpr char* TAG = "BNO08x";
friend class BNO08xSH2HAL;
friend class BNO08xTestHelper;
};
BNO08xGlobalTypes.hpp
BNO08xStability
BNO08xStability
BNO08xStability states returned from BNO08x::stability_classifier.get()
Definition BNO08xGlobalTypes.hpp:147
bno08x_config_t
struct bno08x_config_t bno08x_config_t
IMU configuration settings passed into constructor.
BNO08xResetReason
BNO08xResetReason
Reason for previous IMU reset (returned by get_reset_reason())
Definition BNO08xGlobalTypes.hpp:94
BNO08xActivity
BNO08xActivity
BNO08xActivity states returned from BNO08x::activity_classifier.get()
Definition BNO08xGlobalTypes.hpp:132
BNO08xAccuracy
BNO08xAccuracy
Sensor accuracy returned from input reports, corresponds to status bits (see ref. manual 6....
Definition BNO08xGlobalTypes.hpp:106
BNO08xCalSel
BNO08xCalSel
Definition BNO08xGlobalTypes.hpp:84
BNO08xPrivateTypes.hpp
BNO08xReports.hpp
BNO08xSH2HAL.hpp
BNO08xCbGeneric
Parent class to represent callback functions as generic type such that all flavors can be invoked by ...
Definition BNO08xCbGeneric.hpp:19
BNO08x
BNO08x IMU driver class.
Definition BNO08x.hpp:33
BNO08x::SCLK_MAX_SPEED
static const constexpr uint32_t SCLK_MAX_SPEED
Max SPI SCLK speed BNO08x is capable of.
Definition BNO08x.hpp:264
BNO08x::activity_to_str
static const char * activity_to_str(BNO08xActivity activity)
Converts a BNO08xActivity enum to string.
Definition BNO08x.cpp:1658
BNO08x::init_status
BNO08xPrivateTypes::bno08x_init_status_t init_status
Initialization status of various functionality, used by deconstructor during cleanup,...
Definition BNO08x.hpp:199
BNO08x::data_proc_task_trampoline
static void data_proc_task_trampoline(void *arg)
Static function used to launch data processing task.
Definition BNO08x.cpp:125
BNO08x::unlock_user_data
void unlock_user_data()
Unlocks user data to allow other tasks to read/modify it.
Definition BNO08x.cpp:323
BNO08x::RX_DATA_LENGTH
static const constexpr uint16_t RX_DATA_LENGTH
length buffer containing data received over spi
Definition BNO08x.hpp:250
BNO08x::save_dynamic_calibration
bool save_dynamic_calibration()
Saves dynamic/motion engine calibration data to BNO08x internal flash immediately....
Definition BNO08x.cpp:1379
BNO08x::deinit_gpio_inputs
esp_err_t deinit_gpio_inputs()
Deinitializes GPIO inputs, called from deconstructor.
Definition BNO08x.cpp:835
BNO08x::sync_ctx
BNO08xPrivateTypes::bno08x_sync_ctx_t sync_ctx
Holds context used to synchronize tasks and callback execution.
Definition BNO08x.hpp:200
BNO08x::deinit_spi
esp_err_t deinit_spi()
Deinitializes SPI.
Definition BNO08x.cpp:931
BNO08x::hard_reset
bool hard_reset()
Hard resets BNO08x device.
Definition BNO08x.cpp:1046
BNO08x::TAG
static const constexpr char * TAG
Class tag used for serial print statements.
Definition BNO08x.hpp:266
BNO08x::unlock_sh2_HAL
void unlock_sh2_HAL()
Unlocks sh2 HAL lib to allow other tasks to call its APIs.
Definition BNO08x.cpp:303
BNO08x::data_available
bool data_available()
Polls for new data/report to become available.
Definition BNO08x.cpp:1582
BNO08x::lock_user_data
void lock_user_data()
Locks locks user data to only allow the calling task to read/modify it.
Definition BNO08x.cpp:313
BNO08x::accuracy_to_str
static const char * accuracy_to_str(BNO08xAccuracy accuracy)
Definition BNO08x.cpp:1715
BNO08x::imu_spi_config
spi_device_interface_config_t imu_spi_config
SPI slave device settings.
Definition BNO08x.hpp:195
BNO08x::dynamic_calibration_autosave_enable
bool dynamic_calibration_autosave_enable()
Enables the automatic saving of dynamic/ME calibration data to BNO08x internal flash See ref manual 6...
Definition BNO08x.cpp:1345
BNO08x::deinit_gpio
esp_err_t deinit_gpio()
Deinitializes GPIO, called from deconstructor.
Definition BNO08x.cpp:805
BNO08x::init_config_args
esp_err_t init_config_args()
Initializes required esp-idf SPI data structures with values from user passed bno08x_config_t struct.
Definition BNO08x.cpp:390
BNO08x::usr_reports
etl::map< uint8_t, BNO08xRpt *, TOTAL_RPT_COUNT, etl::less< uint8_t > > usr_reports
Definition BNO08x.hpp:204
BNO08x::init_spi
esp_err_t init_spi()
Initializes SPI.
Definition BNO08x.cpp:702
BNO08x::dynamic_calibration_disable
bool dynamic_calibration_disable(BNO08xCalSel sensor)
Disables dynamic/motion engine calibration for specified sensor(s), see ref. manual 6....
Definition BNO08x.cpp:1318
BNO08x::cb_task
void cb_task()
Task responsible for executing callbacks registered with register_cb().
Definition BNO08x.cpp:255
BNO08x::CB_TASK_SZ
static const constexpr configSTACK_DEPTH_TYPE CB_TASK_SZ
Size of sh2_HAL_service_task() stack in bytes.
Definition BNO08x.hpp:146
BNO08x::wait_for_reset
esp_err_t wait_for_reset()
Waits for SH2 HAL lib to detect reset or HOST_INT_TIMEOUT_DEFAULT_MS to elapse.
Definition BNO08x.cpp:1507
BNO08x::toggle_reset
void toggle_reset()
Toggles reset gpio pin for hard reset of BNO08x device.
Definition BNO08x.cpp:1523
BNO08x::~BNO08x
~BNO08x()
BNO08x imu deconstructor.
Definition BNO08x.cpp:39
BNO08x::cb_task_hdl
TaskHandle_t cb_task_hdl
sh2_HAL_service_task() task handle
Definition BNO08x.hpp:148
BNO08x::wait_for_hint
esp_err_t wait_for_hint()
Waits for HINT pin assertion or HOST_INT_TIMEOUT_DEFAULT_MS to elapse.
Definition BNO08x.cpp:1488
BNO08x::print_product_ids
void print_product_ids()
Prints product IDs received at initialization.
Definition BNO08x.cpp:1635
BNO08x::deinit_sh2_HAL
esp_err_t deinit_sh2_HAL()
Deinitializes sh2 HAL.
Definition BNO08x.cpp:1030
BNO08x::sleep
bool sleep()
Places BNO08x device in sleep state by sending SLEEP (3) command on "device" channel.
Definition BNO08x.cpp:1239
BNO08x::sh2_HAL_service_task
void sh2_HAL_service_task()
Task responsible for calling shtp_service() when HINT is asserted to dispatch any sh2 HAL lib callbac...
Definition BNO08x.cpp:185
BNO08x::handle_sensor_report
void handle_sensor_report(sh2_SensorValue_t *sensor_val)
Parses receieved report and updates uer data with it.
Definition BNO08x.cpp:333
BNO08x::hint_handler
static void IRAM_ATTR hint_handler(void *arg)
HINT interrupt service routine, handles falling edge of BNO08x HINT pin.
Definition BNO08x.cpp:1741
BNO08x::calibration_end
bool calibration_end(sh2_CalStatus_t &status)
Ends turn-table calibration, see ref. manual 6.4.10.2.
Definition BNO08x.cpp:1281
BNO08x::clear_dynamic_calibration
bool clear_dynamic_calibration()
Clears dynamic/motion engine calibration data and resets BNO08x device. See ref manual 6....
Definition BNO08x.cpp:1396
BNO08x::handle_cb
void handle_cb(uint8_t rpt_ID, BNO08xCbGeneric *cb_entry)
Determines the flavor of a passed callback and executes it appropriately.
Definition BNO08x.cpp:375
BNO08x::DATA_PROC_TASK_SZ
static const constexpr configSTACK_DEPTH_TYPE DATA_PROC_TASK_SZ
Size of data_proc_task() stack in bytes.
Definition BNO08x.hpp:132
BNO08x::sh2_HAL_service_task_trampoline
static void sh2_HAL_service_task_trampoline(void *arg)
Static function used to launch sh2 HAL service task.
Definition BNO08x.cpp:172
BNO08x::queue_cb_report_id
QueueHandle_t queue_cb_report_id
Queue to send report ID of most recent report to cb_task()
Definition BNO08x.hpp:191
BNO08x::lock_sh2_HAL
void lock_sh2_HAL()
Locks sh2 HAL lib to only allow the calling task to call its APIs.
Definition BNO08x.cpp:293
BNO08x::init_gpio_inputs
esp_err_t init_gpio_inputs()
Initializes required gpio inputs.
Definition BNO08x.cpp:485
BNO08x::init_tasks
esp_err_t init_tasks()
Initializes data_proc_task.
Definition BNO08x.cpp:632
BNO08x::dynamic_calibration_enable
bool dynamic_calibration_enable(BNO08xCalSel sensor)
Enables dynamic/motion engine calibration for specified sensor(s), see ref. manual 6....
Definition BNO08x.cpp:1299
BNO08x::dynamic_calibration_autosave_disable
bool dynamic_calibration_autosave_disable()
Disables the automatic saving of dynamic/ME calibration data to BNO08x internal flash See ref manual ...
Definition BNO08x.cpp:1362
BNO08x::deinit_tasks
esp_err_t deinit_tasks()
Deinitializes tasks used by BNO08x driver.
Definition BNO08x.cpp:977
BNO08x::get_reset_reason
BNO08xResetReason get_reset_reason()
Returns reason for previous reset via product ID report.
Definition BNO08x.cpp:1192
BNO08x::soft_reset
bool soft_reset()
Soft resets BNO08x device by sending RESET (1) command on "device" channel.
Definition BNO08x.cpp:1090
BNO08x::bus_config
spi_bus_config_t bus_config
SPI bus GPIO configuration settings.
Definition BNO08x.hpp:194
BNO08x::deinit_hint_isr
esp_err_t deinit_hint_isr()
Deinitializes host interrupt ISR, called from deconstructor.
Definition BNO08x.cpp:893
BNO08x::HARD_RESET_DELAY_MS
static const constexpr TickType_t HARD_RESET_DELAY_MS
How long RST pin is held low during hard reset (min 10ns according to datasheet, but should be longer...
Definition BNO08x.hpp:260
BNO08x::init_hint_isr
esp_err_t init_hint_isr()
Initializes host interrupt ISR.
Definition BNO08x.cpp:583
BNO08x::stability_to_str
static const char * stability_to_str(BNO08xStability stability)
Converts a BNO08xStability enum to string.
Definition BNO08x.cpp:1692
BNO08x::get_product_IDs
sh2_ProductIds_t get_product_IDs()
Returns product ID info sent by IMU at initialization.
Definition BNO08x.cpp:1477
BNO08x::sem_kill_tasks
SemaphoreHandle_t sem_kill_tasks
Counting Semaphore to count amount of killed tasks.
Definition BNO08x.hpp:152
BNO08x::on
bool on()
Places BNO08x device in on state by sending ON (2) command on "device" channel.
Definition BNO08x.cpp:1223
BNO08x::SH2_HAL_SERVICE_TASK_SZ
static const constexpr configSTACK_DEPTH_TYPE SH2_HAL_SERVICE_TASK_SZ
Size of sh2_HAL_service_task() stack in bytes.
Definition BNO08x.hpp:139
BNO08x::register_cb
bool register_cb(std::function< void(void)> cb_fxn)
Registers a callback to execute when new data from a report is received.
Definition BNO08x.cpp:1600
BNO08x::deinit_gpio_outputs
esp_err_t deinit_gpio_outputs()
Deinitializes GPIO outputs, called from deconstructor.
Definition BNO08x.cpp:857
BNO08x::data_proc_task
void data_proc_task()
Task responsible for parsing/handling sensor events sent by SH2 HAL and updating data that is returne...
Definition BNO08x.cpp:138
BNO08x::sh2_HAL
sh2_Hal_t sh2_HAL
sh2 hardware abstraction layer struct for use with sh2 HAL lib.
Definition BNO08x.hpp:186
BNO08x::spi_transaction
spi_transaction_t spi_transaction
SPI transaction handle.
Definition BNO08x.hpp:197
BNO08x::re_enable_reports
esp_err_t re_enable_reports()
Re-enables all reports enabled by user (called when BNO08x reset is detected by sh2 HAL lib).
Definition BNO08x.cpp:1541
BNO08x::product_IDs
sh2_ProductIds_t product_IDs
Product ID info returned IMU at initialization, can be viewed with print_product_ids()
Definition BNO08x.hpp:201
BNO08x::spi_hdl
spi_device_handle_t spi_hdl
SPI device handle.
Definition BNO08x.hpp:196
BNO08x::init_gpio_outputs
esp_err_t init_gpio_outputs()
Initializes required gpio outputs.
Definition BNO08x.cpp:521
BNO08x::BNO08x
BNO08x(bno08x_config_t imu_config=bno08x_config_t())
BNO08x imu constructor.
Definition BNO08x.cpp:20
BNO08x::cb_task_trampoline
static void cb_task_trampoline(void *arg)
Static function used to launch cb_task task.
Definition BNO08x.cpp:243
BNO08x::bno08x_reports_t
struct BNO08x::bno08x_reports_t bno08x_reports_t
Contains report implementations.
BNO08x::init_gpio
esp_err_t init_gpio()
Initializes required gpio.
Definition BNO08x.cpp:558
BNO08x::rpt
bno08x_reports_t rpt
Definition BNO08x.hpp:128
BNO08x::init_sh2_HAL
esp_err_t init_sh2_HAL()
Initializes sh2 HAL.
Definition BNO08x.cpp:747
BNO08x::DATA_AVAILABLE_TIMEOUT_MS
static const constexpr TickType_t DATA_AVAILABLE_TIMEOUT_MS
Max wait between data_available() being called and no new data/report being detected.
Definition BNO08x.hpp:256
BNO08x::HOST_INT_TIMEOUT_DEFAULT_MS
static const constexpr TickType_t HOST_INT_TIMEOUT_DEFAULT_MS
Max wait between HINT being asserted by BNO08x before transaction is considered failed (in milisecond...
Definition BNO08x.hpp:252
BNO08x::initialize
bool initialize()
Initializes BNO08x sensor.
Definition BNO08x.cpp:81
BNO08x::disable_all_reports
bool disable_all_reports()
Disables all currently enabled reports.
Definition BNO08x.cpp:1148
BNO08x::imu_config
bno08x_config_t imu_config
IMU configuration settings.
Definition BNO08x.hpp:193
BNO08x::get_frs
bool get_frs(uint16_t frs_ID, uint32_t(&data)[16], uint16_t &rx_data_sz)
Retrieves a record from flash record system (if your goal is to retrieve meta data use the BNO08xRpt:...
Definition BNO08x.cpp:1461
BNO08x::queue_rx_sensor_event
QueueHandle_t queue_rx_sensor_event
Queue to send sensor events from sh2 HAL sensor event callback (BNO08xSH2HAL::sensor_event_cb()) to d...
Definition BNO08x.hpp:189
BNO08x::calibration_start
bool calibration_start(uint32_t period_us)
Starts simple calibration, see ref. manual 6.4.10.1.
Definition BNO08x.cpp:1263
BNO08x::data_proc_task_hdl
TaskHandle_t data_proc_task_hdl
data_proc_task() task handle
Definition BNO08x.hpp:134
BNO08x::sh2_HAL_service_task_hdl
TaskHandle_t sh2_HAL_service_task_hdl
sh2_HAL_service_task() task handle
Definition BNO08x.hpp:141
BNO08xRptARVRStabilizedGameRV
Class to represent ARVR stabilized rotation vector reports. (See Ref. Manual 6.5.43)
Definition BNO08xRptARVRStabilizedGameRV.hpp:16
BNO08xRptARVRStabilizedRV
Class to represent ARVR stabilized rotation vector reports. (See Ref. Manual 6.5.42)
Definition BNO08xRptARVRStabilizedRV.hpp:16
BNO08xRptAcceleration
Class to represent accelerometer reports. (See Ref. Manual 6.5.9)
Definition BNO08xRptAcceleration.hpp:16
BNO08xRptActivityClassifier
Class to represent activity classifier reports. (See Ref. Manual 6.5.36)
Definition BNO08xRptActivityClassifier.hpp:16
BNO08xRptCalGyro
Class to represent calibrated gyro reports. (See Ref. Manual 6.5.13)
Definition BNO08xRptCalGyro.hpp:16
BNO08xRptCalMagnetometer
Class to represent calibrated magnetometer reports. (See Ref. Manual 6.5.16)
Definition BNO08xRptCalMagnetometer.hpp:16
BNO08xRptGameRV
Class to represent game rotation vector reports. (See Ref. Manual 6.5.19)
Definition BNO08xRptGameRV.hpp:16
BNO08xRptGravity
Class to represent gravity reports. (See Ref. Manual 6.5.11)
Definition BNO08xRptGravity.hpp:16
BNO08xRptIGyroRV
Class to represent integrated gyro rotation vector reports. (See Ref. Manual 6.5.44)
Definition BNO08xRptIGyroRV.hpp:16
BNO08xRptLinearAcceleration
Class to represent linear accelerometer reports. (See Ref. Manual 6.5.10)
Definition BNO08xRptLinearAcceleration.hpp:16
BNO08xRptRVGeomag
Class to represent geomagnetic rotation vector reports. (See Ref. Manual 6.5.20)
Definition BNO08xRptRVGeomag.hpp:16
BNO08xRptRV
Class to represent rotation vector reports. (See Ref. Manual 6.5.18)
Definition BNO08xRptRV.hpp:16
BNO08xRptRawMEMSAccelerometer
Class to represent raw accelerometer reports. (See Ref. Manual 6.5.8)
Definition BNO08xRptRawMEMSAccelerometer.hpp:16
BNO08xRptRawMEMSGyro
Class to represent raw gyro reports. (See Ref. Manual 6.5.12)
Definition BNO08xRptRawMEMSGyro.hpp:16
BNO08xRptRawMEMSMagnetometer
Class to represent raw magnetometer reports. (See Ref. Manual 6.5.15)
Definition BNO08xRptRawMEMSMagnetometer.hpp:16
BNO08xRptShakeDetector
Class to represent shake detector reports. (See Ref. Manual 6.5.32)
Definition BNO08xRptShakeDetector.hpp:16
BNO08xRptStabilityClassifier
Class to represent stability classifier reports. (See Ref. Manual 6.5.31)
Definition BNO08xRptStabilityClassifier.hpp:16
BNO08xRptStepCounter
Class to represent step counter reports. (See Ref. Manual 6.5.29)
Definition BNO08xRptStepCounter.hpp:16
BNO08xRptTapDetector
Class to represent tap detector reports. (See Ref. Manual 6.5.27)
Definition BNO08xRptTapDetector.hpp:16
BNO08xRptUncalGyro
Class to represent uncalibrated gyro reports. (See Ref. Manual 6.5.14)
Definition BNO08xRptUncalGyro.hpp:16
BNO08xRptUncalMagnetometer
Class to represent uncalibrated magnetometer reports. (See Ref. Manual 6.5.17)
Definition BNO08xRptUncalMagnetometer.hpp:17
BNO08xSH2HAL
Fully static class containing callback implementations for sh2 HAL lib.
Definition BNO08xSH2HAL.hpp:72
BNO08xTestHelper
BNO08x unit test helper class.
Definition BNO08xTestHelper.hpp:17
BNO08xPrivateTypes
Definition BNO08xPrivateTypes.hpp:21
BNO08x::bno08x_reports_t
Contains report implementations.
Definition BNO08x.hpp:73
BNO08x::bno08x_reports_t::rv_ARVR_stabilized
BNO08xRptARVRStabilizedRV rv_ARVR_stabilized
Definition BNO08x.hpp:83
BNO08x::bno08x_reports_t::cal_magnetometer
BNO08xRptCalMagnetometer cal_magnetometer
Definition BNO08x.hpp:77
BNO08x::bno08x_reports_t::tap_detector
BNO08xRptTapDetector tap_detector
Definition BNO08x.hpp:94
BNO08x::bno08x_reports_t::raw_gyro
BNO08xRptRawMEMSGyro raw_gyro
Definition BNO08x.hpp:87
BNO08x::bno08x_reports_t::stability_classifier
BNO08xRptStabilityClassifier stability_classifier
Definition BNO08x.hpp:92
BNO08x::bno08x_reports_t::uncal_magnetometer
BNO08xRptUncalMagnetometer uncal_magnetometer
Definition BNO08x.hpp:78
BNO08x::bno08x_reports_t::activity_classifier
BNO08xRptActivityClassifier activity_classifier
Definition BNO08x.hpp:91
BNO08x::bno08x_reports_t::rv_gyro_integrated
BNO08xRptIGyroRV rv_gyro_integrated
Definition BNO08x.hpp:85
BNO08x::bno08x_reports_t::uncal_gyro
BNO08xRptUncalGyro uncal_gyro
Definition BNO08x.hpp:80
BNO08x::bno08x_reports_t::rv_geomagnetic
BNO08xRptRVGeomag rv_geomagnetic
Definition BNO08x.hpp:86
BNO08x::bno08x_reports_t::rv_game
BNO08xRptGameRV rv_game
Definition BNO08x.hpp:82
BNO08x::bno08x_reports_t::shake_detector
BNO08xRptShakeDetector shake_detector
Definition BNO08x.hpp:93
BNO08x::bno08x_reports_t::raw_accelerometer
BNO08xRptRawMEMSAccelerometer raw_accelerometer
Definition BNO08x.hpp:88
BNO08x::bno08x_reports_t::bno08x_reports_t
bno08x_reports_t(BNO08xPrivateTypes::bno08x_sync_ctx_t *sync_ctx)
Definition BNO08x.hpp:96
BNO08x::bno08x_reports_t::raw_magnetometer
BNO08xRptRawMEMSMagnetometer raw_magnetometer
Definition BNO08x.hpp:89
BNO08x::bno08x_reports_t::accelerometer
BNO08xRptAcceleration accelerometer
Definition BNO08x.hpp:74
BNO08x::bno08x_reports_t::linear_accelerometer
BNO08xRptLinearAcceleration linear_accelerometer
Definition BNO08x.hpp:75
BNO08x::bno08x_reports_t::cal_gyro
BNO08xRptCalGyro cal_gyro
Definition BNO08x.hpp:79
BNO08x::bno08x_reports_t::rv
BNO08xRptRV rv
Definition BNO08x.hpp:81
BNO08x::bno08x_reports_t::step_counter
BNO08xRptStepCounter step_counter
Definition BNO08x.hpp:90
BNO08x::bno08x_reports_t::gravity
BNO08xRptGravity gravity
Definition BNO08x.hpp:76
BNO08x::bno08x_reports_t::rv_ARVR_stabilized_game
BNO08xRptARVRStabilizedGameRV rv_ARVR_stabilized_game
Definition BNO08x.hpp:84
BNO08xPrivateTypes::bno08x_init_status_t
Holds info about which functionality has been successfully initialized (used by deconstructor during ...
Definition BNO08xPrivateTypes.hpp:28
BNO08xPrivateTypes::bno08x_sync_ctx_t
Holds context used to synchronize tasks and callback execution.
Definition BNO08xPrivateTypes.hpp:57
bno08x_config_t
IMU configuration settings passed into constructor.
Definition BNO08xGlobalTypes.hpp:38