Adafruit BNO08x Library
Adafruit_BNO08x.h
Go to the documentation of this file.
1 
17 #ifndef _ADAFRUIT_BNO08x_H
18 #define _ADAFRUIT_BNO08x_H
19 
20 #include "Arduino.h"
21 #include "sh2.h"
22 #include "sh2_SensorValue.h"
23 #include "sh2_err.h"
24 #include <Adafruit_BusIO_Register.h>
25 #include <Adafruit_I2CDevice.h>
26 #include <Adafruit_Sensor.h>
27 #include <Wire.h>
28 
29 #define BNO08x_I2CADDR_DEFAULT 0x4A
30 
31 /* Additional Activities not listed in SH-2 lib */
32 #define PAC_ON_STAIRS 8
33 #define PAC_OPTION_COUNT \
34  9
35 
36 
41 public:
42  Adafruit_BNO08x(int8_t reset_pin = -1);
44 
45  bool begin_I2C(uint8_t i2c_addr = BNO08x_I2CADDR_DEFAULT,
46  TwoWire *wire = &Wire, int32_t sensor_id = 0);
47  bool begin_UART(HardwareSerial *serial, int32_t sensor_id = 0);
48 
49  bool begin_SPI(uint8_t cs_pin, uint8_t int_pin, SPIClass *theSPI = &SPI,
50  int32_t sensor_id = 0);
51 
52  void hardwareReset(void);
53  bool wasReset(void);
54 
55  bool enableReport(sh2_SensorId_t sensor, uint32_t interval_us = 10000);
56  bool getSensorEvent(sh2_SensorValue_t *value);
57 
58  sh2_ProductIds_t prodIds;
59 
60 protected:
61  virtual bool _init(int32_t sensor_id);
62 
63  sh2_Hal_t
64  _HAL;
65 };
66 
67 #endif
Adafruit_BNO08x(int8_t reset_pin=-1)
Construct a new Adafruit_BNO08x::Adafruit_BNO08x object.
Definition: Adafruit_BNO08x.cpp:84
sh2_Hal_t _HAL
The struct representing the SH2 Hardware Abstraction Layer.
Definition: Adafruit_BNO08x.h:64
Class that stores state and functions for interacting with the BNO08x 9-DOF Orientation IMU Fusion Br...
Definition: Adafruit_BNO08x.h:40
void hardwareReset(void)
Reset the device using the Reset pin.
Definition: Adafruit_BNO08x.cpp:216
bool wasReset(void)
Check if a reset has occured.
Definition: Adafruit_BNO08x.cpp:223
~Adafruit_BNO08x()
Destroy the Adafruit_BNO08x::Adafruit_BNO08x object.
Definition: Adafruit_BNO08x.cpp:90
bool begin_UART(HardwareSerial *serial, int32_t sensor_id=0)
Sets up the hardware and initializes UART.
Definition: Adafruit_BNO08x.cpp:135
#define BNO08x_I2CADDR_DEFAULT
The default I2C address.
Definition: Adafruit_BNO08x.h:29
bool getSensorEvent(sh2_SensorValue_t *value)
Fill the given sensor value object with a new report.
Definition: Adafruit_BNO08x.cpp:237
virtual bool _init(int32_t sensor_id)
Initializer for post i2c/spi init.
Definition: Adafruit_BNO08x.cpp:188
bool begin_I2C(uint8_t i2c_addr=BNO08x_I2CADDR_DEFAULT, TwoWire *wire=&Wire, int32_t sensor_id=0)
Sets up the hardware and initializes I2C.
Definition: Adafruit_BNO08x.cpp:105
bool begin_SPI(uint8_t cs_pin, uint8_t int_pin, SPIClass *theSPI=&SPI, int32_t sensor_id=0)
Sets up the hardware and initializes hardware SPI.
Definition: Adafruit_BNO08x.cpp:156
bool enableReport(sh2_SensorId_t sensor, uint32_t interval_us=10000)
Enable the given report type.
Definition: Adafruit_BNO08x.cpp:260
sh2_ProductIds_t prodIds
The product IDs returned by the sensor.
Definition: Adafruit_BNO08x.h:58