HF-BNO08x Driver

Hardware-agnostic BNO08x library for Hillcrest / CEVA BNO08x sensors with full-stack, zero-thread driver support

C++ License CI Docs

๐Ÿ“š Table of Contents

  1. Overview
  2. Features
  3. Quick Start
  4. Installation
  5. API Reference
  6. Examples
  7. Documentation
  8. Contributing
  9. License

๐Ÿ“ฆ Overview

๐Ÿ“– ๐Ÿ“š๐ŸŒ Live Complete Documentation - Interactive guides, examples, and step-by-step tutorials

HF-BNO08x is a hardware-agnostic C++ library for the Hillcrest / CEVA BNO08x family of 9-axis IMU sensors (BNO080, BNO085, BNO086). The BNO08x sensors provide fused orientation data, calibrated IMU measurements, activity detection, step counting, and gesture recognition through the SH-2 (Sensor Hub 2) protocol.

The driver uses a CRTP-based communication interface design, allowing it to run on any platform (ESP32, STM32, Arduino, etc.) with zero runtime overhead. It provides access to all SH-2 sensor reports including rotation vectors, accelerometer, gyroscope, magnetometer, step counter, tap detector, and more. The driver also supports RVC (Robot Vacuum Cleaner) mode for simplified UART streaming and DFU (Device Firmware Update) for firmware updates.

โœจ Features

  • โœ… Complete SH-2 Coverage: Access every BNO085 SH-2 report (raw & calibrated IMU, rotation vectors, activity, tap/shake, step counter, etc.)
  • โœ… Hardware Agnostic: CRTP-based CommInterface works with any IยฒC, SPI, or UART implementation
  • โœ… Zero Internal Threads: You control timing - call Update() in your loop, ISR, or RTOS task
  • โœ… Auto Re-Sync: Detects sensor resets and seamlessly re-enables configured features
  • โœ… Float-Friendly API: Handy structs (Vector3, Quaternion, SensorEvent) with SI units
  • โœ… RVC Mode Support: Simplified UART streaming mode for basic orientation data
  • โœ… DFU Support: Firmware update capability via Device Firmware Update protocol
  • โœ… Pin Control API: Optional helpers to drive RSTN/BOOTN/WAKE and select IยฒC, UART, or SPI via PS pins

๐Ÿš€ Quick Start

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "inc/bno08x.hpp"

// 1. Implement the communication interface (see platform_integration.md)
class MyComm : public bno08x::CommInterface<MyComm> {
    // ... implement required methods
};

// 2. Create driver instance
MyComm comm;
BNO085<MyComm> imu(comm);

// 3. Initialize
if (!imu.Begin()) {
    // Handle error
    return;
}

// 4. Enable sensors
imu.EnableSensor(BNO085Sensor::RotationVector, 10);  // 100 Hz
imu.EnableSensor(BNO085Sensor::StepCounter, 0);     // on-change

// 5. Set callback
imu.SetCallback([](const SensorEvent& e) {
    if (e.sensor == BNO085Sensor::RotationVector) {
        printf("Quat: w=%.3f x=%.3f y=%.3f z=%.3f\n",
               e.rotation.w, e.rotation.x, e.rotation.y, e.rotation.z);
    }
});

// 6. Update loop
while (true) {
    imu.Update();  // Call as often as possible
    delay(5);
}

For detailed setup, see Installation and Quick Start Guide.

๐Ÿ”ง Installation

  1. Clone or copy the driver files into your project
  2. Implement the communication interface for your platform (see Platform Integration)
  3. Include the header in your code:
    1
    
    #include "inc/bno08x.hpp"
    
  4. Compile with a C++11 or newer compiler

For detailed installation instructions, see docs/installation.md.

๐Ÿ“– API Reference

Method Description
Begin() Initialize the sensor
EnableSensor() Enable periodic reporting for a sensor
DisableSensor() Disable reporting for a sensor
Update() Pump the SH-2 service loop
SetCallback() Register callback for sensor events
GetLatest() Get most recent event for a sensor
HasNewData() Check if new data is available

For complete API documentation, see docs/api_reference.md.

๐Ÿ“Š Examples

For ESP32 examples, see the examples/esp32 directory.

Detailed example walkthroughs are available in docs/examples.md.

๐Ÿ“š Documentation

For complete documentation, see the docs directory.

Special Features

๐Ÿค Contributing

Pull requests and suggestions are welcome! Please follow the existing code style and include tests for new features.

๐Ÿ“„ License

  • C++ wrapper code: GNU GPL v3.0
  • CEVA SH-2 backend: Apache 2.0 (included)

By contributing you agree your code is released under the same GPLv3 license.


Table of contents