HF-BNO08x Driver
Hardware-agnostic BNO08x library for Hillcrest / CEVA BNO08x sensors with full-stack, zero-thread driver support
๐ Table of Contents
- Overview
- Features
- Quick Start
- Installation
- API Reference
- Examples
- Documentation
- Contributing
- 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
CommInterfaceworks 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
- Clone or copy the driver files into your project
- Implement the communication interface for your platform (see Platform Integration)
- Include the header in your code:
1
#include "inc/bno08x.hpp"
- 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
- RVC Mode - Simplified UART streaming mode
- DFU (Firmware Update) - Device firmware update guide
๐ค 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.