Loading...
Searching...
No Matches
BNO08x_global_types.hpp
Go to the documentation of this file.
#pragma once
#include <driver/gpio.h>
#include <driver/spi_common.h>
#include <driver/spi_master.h>
enum class BNO08xAccuracy
{
LOW = 1,
MED,
HIGH,
UNDEFINED
};
using IMUAccuracy = BNO08xAccuracy; // legacy version compatibility
enum class BNO08xResetReason
{
UNDEFINED,
POR,
INT_RST,
WTD,
EXT_RST,
OTHER
};
using IMUResetReason = BNO08xResetReason; // legacy version compatibility
enum class BNO08xActivityEnable
{
UNKNOWN = (1U << 0U),
IN_VEHICLE = (1U << 1U),
ON_BICYCLE = (1U << 2U),
ON_FOOT = (1U << 3U),
STILL = (1U << 4U),
TILTING = (1U << 5U),
WALKING = (1U << 6U),
RUNNING = (1U << 7U),
ON_STAIRS = (1U << 8U),
ALL = 0x1FU
};
enum class BNO08xActivity
{
UNKNOWN = 0, // 0 = unknown
IN_VEHICLE = 1, // 1 = in vehicle
ON_BICYCLE = 2, // 2 = on bicycle
ON_FOOT = 3, // 3 = on foot
STILL = 4, // 4 = still
TILTING = 5, // 5 = tilting
WALKING = 6, // 6 = walking
RUNNING = 7, // 7 = running
ON_STAIRS = 8, // 8 = on stairs
UNDEFINED = 9 // used for unit tests
};
enum class BNO08xStability
{
UNKNOWN = 0, // 0 = unknown
ON_TABLE = 1, // 1 = on table
STATIONARY = 2, // 2 = stationary
UNDEFINED = 3 // used for unit tests
};
typedef struct 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;
bno08x_config_t(bool install_isr_service = true)
: spi_peripheral((spi_host_device_t) CONFIG_ESP32_BNO08x_SPI_HOST)
, io_mosi(static_cast<gpio_num_t>(CONFIG_ESP32_BNO08X_GPIO_DI)) // default: 23
, io_miso(static_cast<gpio_num_t>(CONFIG_ESP32_BNO08X_GPIO_SDA)) // default: 19
, io_sclk(static_cast<gpio_num_t>(CONFIG_ESP32_BNO08X_GPIO_SCL)) // default: 18
, io_cs(static_cast<gpio_num_t>(CONFIG_ESP32_BNO08X_GPIO_CS)) // default: 33
, io_int(static_cast<gpio_num_t>(CONFIG_ESP32_BNO08X_GPIO_HINT)) // default: 26
, io_rst(static_cast<gpio_num_t>(CONFIG_ESP32_BNO08X_GPIO_RST)) // default: 32
, io_wake(static_cast<gpio_num_t>(CONFIG_ESP32_BNO08X_GPIO_WAKE)) // default: -1 (unused)
, sclk_speed(static_cast<uint32_t>(CONFIG_ESP32_BNO08X_SCL_SPEED_HZ)) // default: 2MHz
, install_isr_service(install_isr_service) // default: true
{
}
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)
: spi_peripheral(spi_peripheral)
, io_mosi(io_mosi)
, io_miso(io_miso)
, io_sclk(io_sclk)
, io_cs(io_cs)
, io_int(io_int)
, io_rst(io_rst)
, io_wake(io_wake)
, sclk_speed(sclk_speed)
, install_isr_service(install_isr_service)
{
}
} bno08x_config_t;
typedef bno08x_config_t imu_config_t; // legacy version compatibility
BNO08xStability
BNO08xStability
BNO08xStability states returned from get_stability_classifier()
Definition BNO08x_global_types.hpp:65
BNO08xStability::STATIONARY
@ STATIONARY
BNO08xStability::ON_TABLE
@ ON_TABLE
bno08x_config_t
struct bno08x_config_t bno08x_config_t
IMU configuration settings passed into constructor.
imu_config_t
bno08x_config_t imu_config_t
Definition BNO08x_global_types.hpp:121
BNO08xResetReason
BNO08xResetReason
Reason for previous IMU reset (returned by get_reset_reason())
Definition BNO08x_global_types.hpp:23
BNO08xResetReason::OTHER
@ OTHER
Previous reset was due to power other reason.
BNO08xResetReason::WTD
@ WTD
Previous reset was due to watchdog timer.
BNO08xResetReason::POR
@ POR
Previous reset was due to power on reset.
BNO08xResetReason::EXT_RST
@ EXT_RST
Previous reset was due to external reset.
BNO08xResetReason::INT_RST
@ INT_RST
Previous reset was due to internal reset.
BNO08xActivity
BNO08xActivity
BNO08xActivity states returned from get_activity_classifier()
Definition BNO08x_global_types.hpp:50
BNO08xActivityEnable
BNO08xActivityEnable
BNO08xActivity Classifier enable bits passed to enable_activity_classifier()
Definition BNO08x_global_types.hpp:35
BNO08xActivityEnable::RUNNING
@ RUNNING
BNO08xActivityEnable::ALL
@ ALL
BNO08xActivityEnable::WALKING
@ WALKING
BNO08xActivityEnable::UNKNOWN
@ UNKNOWN
BNO08xActivityEnable::TILTING
@ TILTING
BNO08xActivityEnable::ON_FOOT
@ ON_FOOT
BNO08xActivityEnable::STILL
@ STILL
BNO08xActivityEnable::ON_BICYCLE
@ ON_BICYCLE
BNO08xActivityEnable::IN_VEHICLE
@ IN_VEHICLE
BNO08xActivityEnable::ON_STAIRS
@ ON_STAIRS
BNO08xAccuracy
BNO08xAccuracy
Sensor accuracy returned during sensor calibration.
Definition BNO08x_global_types.hpp:13
BNO08xAccuracy::UNDEFINED
@ UNDEFINED
BNO08xAccuracy::MED
@ MED
BNO08xAccuracy::LOW
@ LOW
BNO08xAccuracy::HIGH
@ HIGH
bno08x_config_t
IMU configuration settings passed into constructor.
Definition BNO08x_global_types.hpp:74
bno08x_config_t::spi_peripheral
spi_host_device_t spi_peripheral
SPI peripheral to be used.
Definition BNO08x_global_types.hpp:75
bno08x_config_t::install_isr_service
bool install_isr_service
Indicates whether the ISR service for the HINT should be installed at IMU initialization,...
Definition BNO08x_global_types.hpp:84
bno08x_config_t::sclk_speed
uint32_t sclk_speed
Desired SPI SCLK speed in Hz (max 3MHz)
Definition BNO08x_global_types.hpp:83
bno08x_config_t::bno08x_config_t
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
bno08x_config_t::io_int
gpio_num_t io_int
Chip select pin (connects to BNO08x CS pin)
Definition BNO08x_global_types.hpp:80
bno08x_config_t::io_rst
gpio_num_t io_rst
Host interrupt pin (connects to BNO08x INT pin)
Definition BNO08x_global_types.hpp:81
bno08x_config_t::io_sclk
gpio_num_t io_sclk
SCLK pin (connects to BNO08x SCL pin)
Definition BNO08x_global_types.hpp:78
bno08x_config_t::bno08x_config_t
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
bno08x_config_t::io_mosi
gpio_num_t io_mosi
MOSI GPIO pin (connects to BNO08x DI pin)
Definition BNO08x_global_types.hpp:76
bno08x_config_t::io_wake
gpio_num_t io_wake
Reset pin (connects to BNO08x RST pin)
Definition BNO08x_global_types.hpp:82
bno08x_config_t::io_miso
gpio_num_t io_miso
MISO GPIO pin (connects to BNO08x SDA pin)
Definition BNO08x_global_types.hpp:77
bno08x_config_t::io_cs
gpio_num_t io_cs
Definition BNO08x_global_types.hpp:79