HF-BNO08x  0.1.0-dev
Loading...
Searching...
No Matches
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

#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) {
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);
}
High-level C++ driver for the BNO08x 9-axis IMU family.
Unified driver for the BNO08x IMU – SH-2 mode, RVC mode, and DFU.
Definition bno08x.hpp:375
CRTP base class for BNO08x communication interfaces.
Definition bno08x_comm_interface.hpp:92
@ StepCounter
Cumulative step count.
@ RotationVector
Fused absolute orientation quaternion.
Container for a single decoded SH-2 sensor report.
Definition bno08x.hpp:201
BNO085Sensor sensor
Which sensor produced this event.
Definition bno08x.hpp:202

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:
    #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

  • 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](LICENSE)
  • CEVA SH-2 backend: Apache 2.0 (included)

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