esp32_BNO08x 1.2
C++ BNO08x IMU driver component for esp-idf.
Loading...
Searching...
No Matches
BNO08x_global_types.hpp
Go to the documentation of this file.
1
5#pragma once
6
7#include <driver/gpio.h>
8#include <driver/spi_common.h>
9#include <driver/spi_master.h>
10
13{
14 LOW = 1,
15 MED,
16 HIGH,
18};
19using IMUAccuracy = BNO08xAccuracy; // legacy version compatibility
20
23{
24 UNDEFINED,
25 POR,
26 INT_RST,
27 WTD,
28 EXT_RST,
29 OTHER
30};
31using IMUResetReason = BNO08xResetReason; // legacy version compatibility
32
35{
36 UNKNOWN = (1U << 0U),
37 IN_VEHICLE = (1U << 1U),
38 ON_BICYCLE = (1U << 2U),
39 ON_FOOT = (1U << 3U),
40 STILL = (1U << 4U),
41 TILTING = (1U << 5U),
42 WALKING = (1U << 6U),
43 RUNNING = (1U << 7U),
44 ON_STAIRS = (1U << 8U),
45 ALL = 0x1FU
46};
47
50{
51 UNKNOWN = 0, // 0 = unknown
52 IN_VEHICLE = 1, // 1 = in vehicle
53 ON_BICYCLE = 2, // 2 = on bicycle
54 ON_FOOT = 3, // 3 = on foot
55 STILL = 4, // 4 = still
56 TILTING = 5, // 5 = tilting
57 WALKING = 6, // 6 = walking
58 RUNNING = 7, // 7 = running
59 ON_STAIRS = 8, // 8 = on stairs
60 UNDEFINED = 9 // used for unit tests
61};
62
65{
66 UNKNOWN = 0, // 0 = unknown
67 ON_TABLE = 1, // 1 = on table
68 STATIONARY = 2, // 2 = stationary
69 UNDEFINED = 3 // used for unit tests
70};
71
73typedef struct bno08x_config_t
74{
75 spi_host_device_t spi_peripheral;
76 gpio_num_t io_mosi;
77 gpio_num_t io_miso;
78 gpio_num_t io_sclk;
79 gpio_num_t io_cs;
80 gpio_num_t io_int;
81 gpio_num_t io_rst;
82 gpio_num_t io_wake;
83 uint32_t sclk_speed;
85
90 : spi_peripheral((spi_host_device_t) CONFIG_ESP32_BNO08x_SPI_HOST)
91 , io_mosi(static_cast<gpio_num_t>(CONFIG_ESP32_BNO08X_GPIO_DI)) // default: 23
92 , io_miso(static_cast<gpio_num_t>(CONFIG_ESP32_BNO08X_GPIO_SDA)) // default: 19
93 , io_sclk(static_cast<gpio_num_t>(CONFIG_ESP32_BNO08X_GPIO_SCL)) // default: 18
94 , io_cs(static_cast<gpio_num_t>(CONFIG_ESP32_BNO08X_GPIO_CS)) // default: 33
95 , io_int(static_cast<gpio_num_t>(CONFIG_ESP32_BNO08X_GPIO_HINT)) // default: 26
96 , io_rst(static_cast<gpio_num_t>(CONFIG_ESP32_BNO08X_GPIO_RST)) // default: 32
97 , io_wake(static_cast<gpio_num_t>(CONFIG_ESP32_BNO08X_GPIO_WAKE)) // default: -1 (unused)
98 , sclk_speed(static_cast<uint32_t>(CONFIG_ESP32_BNO08X_SCL_SPEED_HZ)) // default: 2MHz
100
101 {
102 }
103
105 bno08x_config_t(spi_host_device_t spi_peripheral, gpio_num_t io_mosi, gpio_num_t io_miso, gpio_num_t io_sclk, gpio_num_t io_cs,
106 gpio_num_t io_int, gpio_num_t io_rst, gpio_num_t io_wake, uint32_t sclk_speed, bool install_isr_service = true)
111 , io_cs(io_cs)
112 , io_int(io_int)
113 , io_rst(io_rst)
117 {
118 }
120
121typedef bno08x_config_t imu_config_t; // legacy version compatibility
BNO08xStability
BNO08xStability states returned from get_stability_classifier()
Definition BNO08x_global_types.hpp:65
struct bno08x_config_t bno08x_config_t
IMU configuration settings passed into constructor.
bno08x_config_t imu_config_t
Definition BNO08x_global_types.hpp:121
BNO08xResetReason
Reason for previous IMU reset (returned by get_reset_reason())
Definition BNO08x_global_types.hpp:23
@ OTHER
Previous reset was due to power other reason.
@ WTD
Previous reset was due to watchdog timer.
@ POR
Previous reset was due to power on reset.
@ EXT_RST
Previous reset was due to external reset.
@ INT_RST
Previous reset was due to internal reset.
BNO08xActivity
BNO08xActivity states returned from get_activity_classifier()
Definition BNO08x_global_types.hpp:50
BNO08xActivityEnable
BNO08xActivity Classifier enable bits passed to enable_activity_classifier()
Definition BNO08x_global_types.hpp:35
BNO08xAccuracy
Sensor accuracy returned during sensor calibration.
Definition BNO08x_global_types.hpp:13
IMU configuration settings passed into constructor.
Definition BNO08x_global_types.hpp:74
spi_host_device_t spi_peripheral
SPI peripheral to be used.
Definition BNO08x_global_types.hpp:75
bool install_isr_service
Indicates whether the ISR service for the HINT should be installed at IMU initialization,...
Definition BNO08x_global_types.hpp:84
uint32_t sclk_speed
Desired SPI SCLK speed in Hz (max 3MHz)
Definition BNO08x_global_types.hpp:83
bno08x_config_t(spi_host_device_t spi_peripheral, gpio_num_t io_mosi, gpio_num_t io_miso, gpio_num_t io_sclk, gpio_num_t io_cs, gpio_num_t io_int, gpio_num_t io_rst, gpio_num_t io_wake, uint32_t sclk_speed, bool install_isr_service=true)
Overloaded IMU configuration settings constructor for custom pin settings.
Definition BNO08x_global_types.hpp:105
gpio_num_t io_int
Chip select pin (connects to BNO08x CS pin)
Definition BNO08x_global_types.hpp:80
gpio_num_t io_rst
Host interrupt pin (connects to BNO08x INT pin)
Definition BNO08x_global_types.hpp:81
gpio_num_t io_sclk
SCLK pin (connects to BNO08x SCL pin)
Definition BNO08x_global_types.hpp:78
bno08x_config_t(bool install_isr_service=true)
Default IMU configuration settings constructor. To modify default GPIO pins, run "idf....
Definition BNO08x_global_types.hpp:89
gpio_num_t io_mosi
MOSI GPIO pin (connects to BNO08x DI pin)
Definition BNO08x_global_types.hpp:76
gpio_num_t io_wake
Reset pin (connects to BNO08x RST pin)
Definition BNO08x_global_types.hpp:82
gpio_num_t io_miso
MISO GPIO pin (connects to BNO08x SDA pin)
Definition BNO08x_global_types.hpp:77
gpio_num_t io_cs
Definition BNO08x_global_types.hpp:79