esp32_BNO08x 1.3
C++ BNO08x IMU driver component for esp-idf.
Loading...
Searching...
No Matches
BNO08xGlobalTypes.hpp
Go to the documentation of this file.
1
6#pragma once
7
8// macros for bno08x_tap_detector_t
9#define TAP_DETECTED_X_AXIS(tap) ((tap) & (1U << 0U) ? 1 : 0)
10#define TAP_DETECTED_X_AXIS_POSITIVE(tap) ((tap) & (1U << 1U) ? 1 : 0)
11#define TAP_DETECTED_Y_AXIS(tap) ((tap) & (1U << 2U) ? 1 : 0)
12#define TAP_DETECTED_Y_AXIS_POSITIVE(tap) ((tap) & (1U << 3U) ? 1 : 0)
13#define TAP_DETECTED_Z_AXIS(tap) ((tap) & (1U << 4U) ? 1 : 0)
14#define TAP_DETECTED_Z_AXIS_POSITIVE(tap) ((tap) & (1U << 5U) ? 1 : 0)
15#define TAP_DETECTED_DOUBLE(tap) ((tap) & (1U << 6U) ? 1 : 0)
16
17// macros for bno08x_shake_detector_t
18#define SHAKE_DETECTED_X(tap) ((tap) & (1U << 0U) ? 1 : 0)
19#define SHAKE_DETECTED_Y(tap) ((tap) & (1U << 1U) ? 1 : 0)
20#define SHAKE_DETECTED_Z(tap) ((tap) & (1U << 2U) ? 1 : 0)
21
22// standard library includes
23#include <math.h>
24#include <inttypes.h>
25#include <stdint.h>
26#include <cstring>
27
28// esp-idf includes
29#include <driver/gpio.h>
30#include <driver/spi_common.h>
31#include <driver/spi_master.h>
32
33// third-party includes
34#include "sh2_SensorValue.h"
35
37typedef struct bno08x_config_t
38{
39 spi_host_device_t spi_peripheral;
40 gpio_num_t io_mosi;
41 gpio_num_t io_miso;
42 gpio_num_t io_sclk;
43 gpio_num_t io_cs;
44 gpio_num_t io_int;
45 gpio_num_t io_rst;
46 uint32_t sclk_speed;
48
53 : spi_peripheral((spi_host_device_t) CONFIG_ESP32_BNO08x_SPI_HOST)
54 , io_mosi(static_cast<gpio_num_t>(CONFIG_ESP32_BNO08X_GPIO_DI)) // default: 23
55 , io_miso(static_cast<gpio_num_t>(CONFIG_ESP32_BNO08X_GPIO_SDA)) // default: 19
56 , io_sclk(static_cast<gpio_num_t>(CONFIG_ESP32_BNO08X_GPIO_SCL)) // default: 18
57 , io_cs(static_cast<gpio_num_t>(CONFIG_ESP32_BNO08X_GPIO_CS)) // default: 33
58 , io_int(static_cast<gpio_num_t>(CONFIG_ESP32_BNO08X_GPIO_HINT)) // default: 26
59 , io_rst(static_cast<gpio_num_t>(CONFIG_ESP32_BNO08X_GPIO_RST)) // default: 32
60 , sclk_speed(static_cast<uint32_t>(CONFIG_ESP32_BNO08X_SCL_SPEED_HZ)) // default: 2MHz
62
63 {
64 }
65
67 bno08x_config_t(spi_host_device_t spi_peripheral, gpio_num_t io_mosi, gpio_num_t io_miso, gpio_num_t io_sclk,
68 gpio_num_t io_cs, gpio_num_t io_int, gpio_num_t io_rst, uint32_t sclk_speed, bool install_isr_service = true)
73 , io_cs(io_cs)
74 , io_int(io_int)
75 , io_rst(io_rst)
78 {
79 }
81typedef bno08x_config_t imu_config_t; // legacy version compatibility
82
83enum class BNO08xCalSel
84{
85 accelerometer = SH2_CAL_ACCEL,
86 gyro = SH2_CAL_GYRO,
87 magnetometer = SH2_CAL_MAG,
88 planar_accelerometer = SH2_CAL_PLANAR,
89 all = (SH2_CAL_ACCEL | SH2_CAL_GYRO | SH2_CAL_MAG | SH2_CAL_PLANAR)
90};
91
94{
95 UNDEFINED,
96 POR,
97 INT_RST,
98 WTD,
99 EXT_RST,
100 OTHER
101};
102
106{
108 LOW,
109 MED,
110 HIGH,
112};
113using IMUAccuracy = BNO08xAccuracy; // legacy version compatibility
114
117{
118 UNKNOWN = (1U << 0U),
119 IN_VEHICLE = (1U << 1U),
120 ON_BICYCLE = (1U << 2U),
121 ON_FOOT = (1U << 3U),
122 STILL = (1U << 4U),
123 TILTING = (1U << 5U),
124 WALKING = (1U << 6U),
125 RUNNING = (1U << 7U),
126 ON_STAIRS = (1U << 8U),
127 ALL = 0x1FU
128};
129
132{
133 UNKNOWN = 0, // 0 = unknown
134 IN_VEHICLE = 1, // 1 = in vehicle
135 ON_BICYCLE = 2, // 2 = on bicycle
136 ON_FOOT = 3, // 3 = on foot
137 STILL = 4, // 4 = still
138 TILTING = 5, // 5 = tilting
139 WALKING = 6, // 6 = walking
140 RUNNING = 7, // 7 = running
141 ON_STAIRS = 8, // 8 = on stairs
142 UNDEFINED = 9 // used for unit tests
143};
144
147{
148 UNKNOWN = 0, // 0 = unknown
149 ON_TABLE = 1, // 1 = on table
150 STATIONARY = 2, // 2 = stationary
151 STABLE = 3, // 3 = stable
152 MOTION = 4, // 4 = in motion
153 RESERVED = 5, // 5 = reserved (not used)
154 UNDEFINED = 6 // used for unit tests
155};
156
158typedef struct bno08x_quat_t
159{
160 float real;
161 float i;
162 float j;
163 float k;
166
168 : real(0.0f)
169 , i(0.0f)
170 , j(0.0f)
171 , k(0.0f)
173 , rad_accuracy(0.0f)
174 {
175 }
176
177 // overloaded assignment operator to handle RV with rad accuracy
178 bno08x_quat_t& operator=(const sh2_RotationVectorWAcc_t& source)
179 {
180 this->real = source.real;
181 this->i = source.i;
182 this->j = source.j;
183 this->k = source.k;
184 this->rad_accuracy = source.accuracy;
185 return *this;
186 }
187
188 // overloaded assignment operator to handle RV with w/o rad accuracy
189 bno08x_quat_t& operator=(const sh2_RotationVector_t& source)
190 {
191 this->real = source.real;
192 this->i = source.i;
193 this->j = source.j;
194 this->k = source.k;
195 this->rad_accuracy = 0.0f;
196 return *this;
197 }
198
199 // overloaded assignment operator to handle IRV report
200 bno08x_quat_t& operator=(const sh2_GyroIntegratedRV_t& source)
201 {
202 this->real = source.real;
203 this->i = source.i;
204 this->j = source.j;
205 this->k = source.k;
206 this->rad_accuracy = 0.0f;
207 return *this;
208 }
209
211
214{
215 float x;
216 float y;
217 float z;
220
222 : x(0.0f)
223 , y(0.0f)
224 , z(0.0f)
226 , rad_accuracy(0.0f)
227 {
228 }
229
230 // overloaded = operator for quat to euler conversion
232 {
233 this->x = atan2(2.0f * (source.real * source.i + source.j * source.k),
234 1.0f - 2.0f * (source.i * source.i + source.j * source.j));
235 this->y = asin(2.0f * (source.real * source.j - source.k * source.i));
236 this->z = atan2(2.0f * (source.real * source.k + source.i * source.j),
237 1.0f - 2.0f * (source.j * source.j + source.k * source.k));
238 this->rad_accuracy = source.rad_accuracy;
239 this->accuracy = source.accuracy;
240 return *this;
241 }
242
243 // overloaded *= operator for rad2deg conversions
244 template <typename T>
246 {
247 x *= static_cast<float>(value);
248 y *= static_cast<float>(value);
249 z *= static_cast<float>(value);
250 rad_accuracy *= static_cast<float>(value);
251 return *this;
252 }
253
255
257typedef struct bno08x_ang_vel_t
258{
259 float x;
260 float y;
261 float z;
262
264 : x(0.0f)
265 , y(0.0f)
266 , z(0.0f)
267 {
268 }
269
270 // overloaded *= operator for rad2deg conversions
271 template <typename T>
273 {
274 x *= static_cast<float>(value);
275 y *= static_cast<float>(value);
276 z *= static_cast<float>(value);
277 return *this;
278 }
279
280 // strip sh2_GyroIntegratedRV_t of velocity data for IRV reports
281 bno08x_ang_vel_t& operator=(const sh2_GyroIntegratedRV_t& source)
282 {
283 this->x = source.angVelX;
284 this->y = source.angVelY;
285 this->z = source.angVelZ;
286 return *this;
287 }
289
291typedef struct bno08x_magf_t
292{
293 float x;
294 float y;
295 float z;
297
299 : x(0.0f)
300 , y(0.0f)
301 , z(0.0f)
303 {
304 }
305
306 // overloaded = operator for sh2_MagneticField_t conversion
307 bno08x_magf_t& operator=(const sh2_MagneticField_t& source)
308 {
309 this->x = source.x;
310 this->y = source.y;
311 this->z = source.z;
312 return *this;
313 }
314
315 // overloaded = operator for sh2_MagneticFieldUncalibrated_t conversion
316 bno08x_magf_t& operator=(const sh2_MagneticFieldUncalibrated_t& source)
317 {
318 this->x = source.x;
319 this->y = source.y;
320 this->z = source.z;
321 return *this;
322 }
323
325
327typedef struct bno08x_magf_bias_t
328{
329 float x;
330 float y;
331 float z;
332
334 : x(0.0f)
335 , y(0.0f)
336 , z(0.0f)
337 {
338 }
339
340 // overloaded = operator for sh2_MagneticFieldUncalibrated_t conversion
341 bno08x_magf_bias_t& operator=(const sh2_MagneticFieldUncalibrated_t& source)
342 {
343 this->x = source.biasX;
344 this->y = source.biasY;
345 this->z = source.biasZ;
346 return *this;
347 }
348
350
352typedef struct bno08x_gyro_t
353{
354 float x;
355 float y;
356 float z;
358
360 : x(0.0f)
361 , y(0.0f)
362 , z(0.0f)
364 {
365 }
366
367 // overloaded = operator for sh2_Gyroscope_t conversion
368 bno08x_gyro_t& operator=(const sh2_Gyroscope_t& source)
369 {
370 this->x = source.x;
371 this->y = source.y;
372 this->z = source.z;
373 return *this;
374 }
375
376 // overloaded = operator for sh2_GyroscopeUncalibrated conversion
377 bno08x_gyro_t& operator=(const sh2_GyroscopeUncalibrated& source)
378 {
379 this->x = source.x;
380 this->y = source.y;
381 this->z = source.z;
382 return *this;
383 }
384
386
388typedef struct bno08x_gyro_bias_t
389{
390 float x;
391 float y;
392 float z;
393
395 : x(0.0f)
396 , y(0.0f)
397 , z(0.0f)
398 {
399 }
400
401 // overloaded = operator for sh2_GyroscopeUncalibrated conversion
402 bno08x_gyro_bias_t& operator=(const sh2_GyroscopeUncalibrated& source)
403 {
404 this->x = source.biasX;
405 this->y = source.biasY;
406 this->z = source.biasZ;
407 return *this;
408 }
409
411
414{
415 uint8_t page;
418 uint8_t confidence[10];
420
429
430 // conversion from sh2_PersonalActivityClassifier_t
431 bno08x_activity_classifier_t& operator=(const sh2_PersonalActivityClassifier_t& source)
432 {
433 this->page = source.page;
434 this->lastPage = source.lastPage;
435 this->mostLikelyState = static_cast<BNO08xActivity>(source.mostLikelyState);
436
437 for (int i = 0; i < 10; ++i)
438 this->confidence[i] = source.confidence[i];
439
440 return *this;
441 }
443
447{
448 int8_t x_flag;
449 int8_t y_flag;
450 int8_t z_flag;
453
455 : x_flag(0)
456 , y_flag(0)
457 , z_flag(0)
458 , double_tap(false)
460 {
461 }
462
463 // overloaded = operator for sh2_GyroscopeUncalibrated conversion
464 bno08x_tap_detector_t& operator=(const sh2_TapDetector_t& source)
465 {
466 if (TAP_DETECTED_X_AXIS(source.flags))
467 this->x_flag = -1;
468 else
469 this->x_flag = 0;
470
471 if (TAP_DETECTED_X_AXIS_POSITIVE(source.flags))
472 this->x_flag = 1;
473
474 if (TAP_DETECTED_Y_AXIS(source.flags))
475 this->y_flag = -1;
476 else
477 this->y_flag = 0;
478
479 if (TAP_DETECTED_Y_AXIS_POSITIVE(source.flags))
480 this->y_flag = 1;
481
482 if (TAP_DETECTED_Z_AXIS(source.flags))
483 this->z_flag = -1;
484 else
485 this->z_flag = 0;
486
487 if (TAP_DETECTED_Z_AXIS_POSITIVE(source.flags))
488 this->z_flag = 1;
489
490 if (TAP_DETECTED_DOUBLE(source.flags))
491 this->double_tap = true;
492 else
493 this->double_tap = false;
494
495 return *this;
496 }
497
499
502{
503 uint8_t x_flag;
504 uint8_t y_flag;
505 uint8_t z_flag;
507
509 : x_flag(0U)
510 , y_flag(0U)
511 , z_flag(0U)
513 {
514 }
515
516 // overloaded = operator for sh2_GyroscopeUncalibrated conversion
517 bno08x_shake_detector_t& operator=(const sh2_ShakeDetector_t& source)
518 {
519 if (SHAKE_DETECTED_X(source.shake))
520 this->x_flag = 1U;
521 else
522 this->x_flag = 0U;
523
524 if (SHAKE_DETECTED_Y(source.shake))
525 this->y_flag = 1U;
526 else
527 this->y_flag = 0U;
528
529 if (SHAKE_DETECTED_Z(source.shake))
530 this->z_flag = 1U;
531 else
532 this->z_flag = 0U;
533
534 return *this;
535 }
536
538
541typedef struct bno08x_accel_t
542{
543 float x;
544 float y;
545 float z;
547
549 : x(0.0f)
550 , y(0.0f)
551 , z(0.0f)
553 {
554 }
555
556 // conversion from sh2_Accelerometer_t
557 bno08x_accel_t& operator=(const sh2_Accelerometer_t& source)
558 {
559 this->x = source.x;
560 this->y = source.y;
561 this->z = source.z;
562 return *this;
563 }
565
568{
569 uint32_t latency;
570 uint16_t steps;
572
574 : latency(0UL)
575 , steps(0U)
577 {
578 }
579
580 // conversion from sh2_StepCounter_t
581 bno08x_step_counter_t& operator=(const sh2_StepCounter_t& source)
582 {
583 this->latency = source.latency;
584 this->steps = source.steps;
585 return *this;
586 }
588
590typedef struct bno08x_raw_gyro_t
591{
592 int16_t x;
593 int16_t y;
594 int16_t z;
595 int16_t temperature;
596 uint32_t timestamp_us;
598
600 : x(0U)
601 , y(0U)
602 , z(0U)
603 , temperature(0U)
604 , timestamp_us(0UL)
606 {
607 }
608
609 // conversion from sh2_RawGyroscope_t
610 bno08x_raw_gyro_t& operator=(const sh2_RawGyroscope_t& source)
611 {
612 this->x = source.x;
613 this->y = source.y;
614 this->z = source.z;
615 this->temperature = source.temperature;
616 this->timestamp_us = source.timestamp;
617 return *this;
618 }
620
623typedef struct bno08x_raw_accel_t
624{
625 int16_t x;
626 int16_t y;
627 int16_t z;
628 uint32_t timestamp_us;
630
632 : x(0U)
633 , y(0U)
634 , z(0U)
635 , timestamp_us(0UL)
637 {
638 }
639
640 // conversion from sh2_RawAccelerometer_t
641 bno08x_raw_accel_t& operator=(const sh2_RawAccelerometer_t& source)
642 {
643 this->x = source.x;
644 this->y = source.y;
645 this->z = source.z;
646 this->timestamp_us = source.timestamp;
647 return *this;
648 }
650
653typedef struct bno08x_raw_magf_t
654{
655 int16_t x;
656 int16_t y;
657 int16_t z;
658 uint32_t timestamp_us;
660
662 : x(0U)
663 , y(0U)
664 , z(0U)
665 , timestamp_us(0UL)
667 {
668 }
669
670 // conversion from sh2_RawMagnetometer_t
671 bno08x_raw_magf_t& operator=(const sh2_RawMagnetometer_t& source)
672 {
673 this->x = source.x;
674 this->y = source.y;
675 this->z = source.z;
676 this->timestamp_us = source.timestamp;
677 return *this;
678 }
680
683{
686
692
693 // conversion from sh2_StabilityClassifier_t
694 bno08x_stability_classifier_t& operator=(const sh2_StabilityClassifier_t& source)
695 {
696 this->stability = static_cast<BNO08xStability>(source.classification);
697 return *this;
698 }
699
701
704{
705 uint32_t offered;
706 uint32_t on;
707 uint32_t accepted;
708 uint32_t
710
712 : offered(0UL)
713 , on(0UL)
714 , accepted(0UL)
715 , attempted(0UL)
716 {
717 }
718
719 // conversion from sh2_PersonalActivityClassifier_t
720 bno08x_sample_counts_t& operator=(const sh2_Counts_t& source)
721 {
722 this->offered = source.offered;
723 this->on = source.on;
724 this->accepted = source.accepted;
725 this->attempted = source.attempted;
726
727 return *this;
728 }
730
732typedef struct bno08x_meta_data_t
733{
734 uint8_t me_version;
735 uint8_t mh_version;
736 uint8_t sh_version;
737 uint32_t range;
738 uint32_t resolution;
739 uint16_t revision;
740 uint16_t power_mA;
741 uint32_t min_period_us;
742 uint32_t max_period_us;
743 uint32_t fifo_reserved;
744 uint32_t fifo_max;
746 uint16_t q_point_1;
747 uint16_t q_point_2;
748 uint16_t q_point_3;
749 uint32_t vendor_id_len;
750 char vendor_ID[48];
752 uint8_t sensor_specific[48];
753
754 // Default constructor
756 : me_version(0)
757 , mh_version(0)
758 , sh_version(0)
759 , range(0)
760 , resolution(0)
761 , revision(0)
762 , power_mA(0)
763 , min_period_us(0)
764 , max_period_us(0)
765 , fifo_reserved(0)
766 , fifo_max(0)
768 , q_point_1(0)
769 , q_point_2(0)
770 , q_point_3(0)
771 , vendor_id_len(0)
773 {
774 memset(vendor_ID, 0, sizeof(vendor_ID));
775 memset(sensor_specific, 0, sizeof(sensor_specific));
776 }
777
778 // Conversion constructor from sh2_SensorMetadata_t
779 bno08x_meta_data_t(const sh2_SensorMetadata_t& src)
780 {
781 me_version = src.meVersion;
782 mh_version = src.mhVersion;
783 sh_version = src.shVersion;
784 range = src.range;
785 resolution = src.resolution;
786 revision = src.revision;
787 power_mA = src.power_mA;
788 min_period_us = src.minPeriod_uS;
789 max_period_us = src.maxPeriod_uS;
790 fifo_reserved = src.fifoReserved;
791 fifo_max = src.fifoMax;
792 batch_buffer_bytes = src.batchBufferBytes;
793 q_point_1 = src.qPoint1;
794 q_point_2 = src.qPoint2;
795 q_point_3 = src.qPoint3;
796 vendor_id_len = src.vendorIdLen;
797 sensor_specific_len = src.sensorSpecificLen;
798 memcpy(vendor_ID, src.vendorId, vendor_id_len);
799 memcpy(sensor_specific, src.sensorSpecific, sensor_specific_len);
800 }
802
803static const constexpr uint8_t TOTAL_RPT_COUNT = 38;
#define SHAKE_DETECTED_Y(tap)
Definition BNO08xGlobalTypes.hpp:19
struct bno08x_accel_t bno08x_accel_t
Struct to represent acceleration data from acceleration, linear acceleration, and gravity reports.
struct bno08x_quat_t bno08x_quat_t
Struct to represent unit quaternion.
struct bno08x_meta_data_t bno08x_meta_data_t
Struct to represent sensor/report meta data, returned from BNO08xRpt::get_meta_data()
struct bno08x_ang_vel_t bno08x_ang_vel_t
Struct to represent angular velocity (units in rad/s)
#define TAP_DETECTED_Y_AXIS_POSITIVE(tap)
Definition BNO08xGlobalTypes.hpp:12
struct bno08x_magf_bias_t bno08x_magf_bias_t
Struct to represent magnetic field bias data (units in uTesla)
struct bno08x_raw_gyro_t bno08x_raw_gyro_t
Struct to represent raw mems gyro data from raw gyro reports (units in ADC counts).
struct bno08x_magf_t bno08x_magf_t
Struct to represent magnetic field data (units in uTesla)
BNO08xStability
BNO08xStability states returned from BNO08x::stability_classifier.get()
Definition BNO08xGlobalTypes.hpp:147
struct bno08x_config_t bno08x_config_t
IMU configuration settings passed into constructor.
struct bno08x_raw_magf_t bno08x_raw_magf_t
Struct to represent raw mems magnetometer data from raw magnetometer reports (units in ADC counts).
#define TAP_DETECTED_Z_AXIS_POSITIVE(tap)
Definition BNO08xGlobalTypes.hpp:14
struct bno08x_activity_classifier_t bno08x_activity_classifier_t
Struct to represent activity classifier data.
struct bno08x_gyro_bias_t bno08x_gyro_bias_t
Struct to represent gyro bias data (units in rad/s)
struct bno08x_shake_detector_t bno08x_shake_detector_t
Struct to represent shake detector data (flag meaning: 0 = no shake 1 = shake detected)
#define TAP_DETECTED_X_AXIS_POSITIVE(tap)
Definition BNO08xGlobalTypes.hpp:10
struct bno08x_euler_angle_t bno08x_euler_angle_t
Struct to represent euler angle (units in degrees or rads)
#define TAP_DETECTED_DOUBLE(tap)
Definition BNO08xGlobalTypes.hpp:15
static const constexpr uint8_t TOTAL_RPT_COUNT
Amount of possible reports returned from BNO08x.
Definition BNO08xGlobalTypes.hpp:803
#define SHAKE_DETECTED_Z(tap)
Definition BNO08xGlobalTypes.hpp:20
struct bno08x_stability_classifier_t bno08x_stability_classifier_t
Struct to represent stability classifier data from stability classifier reports.
#define TAP_DETECTED_Z_AXIS(tap)
Definition BNO08xGlobalTypes.hpp:13
bno08x_config_t imu_config_t
Definition BNO08xGlobalTypes.hpp:81
BNO08xResetReason
Reason for previous IMU reset (returned by get_reset_reason())
Definition BNO08xGlobalTypes.hpp:94
@ OTHER
Previous reset was due to power other reason.
@ UNDEFINED
Undefined reset reason, this should never occur and is an error.
@ 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 BNO08x::activity_classifier.get()
Definition BNO08xGlobalTypes.hpp:132
struct bno08x_gyro_t bno08x_gyro_t
Struct to represent gyro data (units in rad/s)
struct bno08x_raw_accel_t bno08x_raw_accel_t
Struct to represent raw mems accelerometer data from raw accelerometer reports (units in ADC counts).
#define TAP_DETECTED_X_AXIS(tap)
Definition BNO08xGlobalTypes.hpp:9
#define TAP_DETECTED_Y_AXIS(tap)
Definition BNO08xGlobalTypes.hpp:11
struct bno08x_step_counter_t bno08x_step_counter_t
Struct to represent step counter data from step counter reports.
BNO08xActivityEnable
BNO08xActivity Classifier enable bits passed to enable_activity_classifier()
Definition BNO08xGlobalTypes.hpp:117
struct bno08x_tap_detector_t bno08x_tap_detector_t
Struct to represent tap detector data (flag meaning: 0 = no tap, 1 = positive tap on axis,...
#define SHAKE_DETECTED_X(tap)
Definition BNO08xGlobalTypes.hpp:18
BNO08xAccuracy
Sensor accuracy returned from input reports, corresponds to status bits (see ref. manual 6....
Definition BNO08xGlobalTypes.hpp:106
BNO08xCalSel
Definition BNO08xGlobalTypes.hpp:84
struct bno08x_sample_counts_t bno08x_sample_counts_t
Struct to represent sample counts, returned from BNO08xRpt::get_sample_counts()
Struct to represent acceleration data from acceleration, linear acceleration, and gravity reports.
Definition BNO08xGlobalTypes.hpp:542
float z
Definition BNO08xGlobalTypes.hpp:545
bno08x_accel_t()
Definition BNO08xGlobalTypes.hpp:548
bno08x_accel_t & operator=(const sh2_Accelerometer_t &source)
Definition BNO08xGlobalTypes.hpp:557
float y
Definition BNO08xGlobalTypes.hpp:544
BNO08xAccuracy accuracy
Definition BNO08xGlobalTypes.hpp:546
float x
Definition BNO08xGlobalTypes.hpp:543
Struct to represent activity classifier data.
Definition BNO08xGlobalTypes.hpp:414
BNO08xActivity mostLikelyState
Definition BNO08xGlobalTypes.hpp:417
bno08x_activity_classifier_t()
Definition BNO08xGlobalTypes.hpp:421
BNO08xAccuracy accuracy
Definition BNO08xGlobalTypes.hpp:419
uint8_t confidence[10]
Definition BNO08xGlobalTypes.hpp:418
bool lastPage
Definition BNO08xGlobalTypes.hpp:416
uint8_t page
Definition BNO08xGlobalTypes.hpp:415
bno08x_activity_classifier_t & operator=(const sh2_PersonalActivityClassifier_t &source)
Definition BNO08xGlobalTypes.hpp:431
Struct to represent angular velocity (units in rad/s)
Definition BNO08xGlobalTypes.hpp:258
bno08x_ang_vel_t()
Definition BNO08xGlobalTypes.hpp:263
float z
Definition BNO08xGlobalTypes.hpp:261
float x
Definition BNO08xGlobalTypes.hpp:259
bno08x_ang_vel_t & operator*=(T value)
Definition BNO08xGlobalTypes.hpp:272
float y
Definition BNO08xGlobalTypes.hpp:260
bno08x_ang_vel_t & operator=(const sh2_GyroIntegratedRV_t &source)
Definition BNO08xGlobalTypes.hpp:281
IMU configuration settings passed into constructor.
Definition BNO08xGlobalTypes.hpp:38
spi_host_device_t spi_peripheral
SPI peripheral to be used.
Definition BNO08xGlobalTypes.hpp:39
bool install_isr_service
Indicates whether the ISR service for the HINT should be installed at IMU initialization,...
Definition BNO08xGlobalTypes.hpp:47
uint32_t sclk_speed
Reset pin (connects to BNO08x RST pin)
Definition BNO08xGlobalTypes.hpp:46
gpio_num_t io_int
Chip select pin (connects to BNO08x CS pin)
Definition BNO08xGlobalTypes.hpp:44
gpio_num_t io_rst
Host interrupt pin (connects to BNO08x INT pin)
Definition BNO08xGlobalTypes.hpp:45
gpio_num_t io_sclk
SCLK pin (connects to BNO08x SCL pin)
Definition BNO08xGlobalTypes.hpp:42
bno08x_config_t(bool install_isr_service=true)
Default IMU configuration settings constructor. To modify default GPIO pins, run "idf....
Definition BNO08xGlobalTypes.hpp:52
gpio_num_t io_mosi
MOSI GPIO pin (connects to BNO08x DI pin)
Definition BNO08xGlobalTypes.hpp:40
gpio_num_t io_miso
MISO GPIO pin (connects to BNO08x SDA pin)
Definition BNO08xGlobalTypes.hpp:41
gpio_num_t io_cs
Definition BNO08xGlobalTypes.hpp:43
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, uint32_t sclk_speed, bool install_isr_service=true)
Overloaded IMU configuration settings constructor for custom pin settings.
Definition BNO08xGlobalTypes.hpp:67
Struct to represent euler angle (units in degrees or rads)
Definition BNO08xGlobalTypes.hpp:214
bno08x_euler_angle_t & operator*=(T value)
Definition BNO08xGlobalTypes.hpp:245
float y
Definition BNO08xGlobalTypes.hpp:216
bno08x_euler_angle_t()
Definition BNO08xGlobalTypes.hpp:221
BNO08xAccuracy accuracy
Definition BNO08xGlobalTypes.hpp:218
float z
Definition BNO08xGlobalTypes.hpp:217
float x
Definition BNO08xGlobalTypes.hpp:215
float rad_accuracy
Definition BNO08xGlobalTypes.hpp:219
bno08x_euler_angle_t & operator=(const bno08x_quat_t &source)
Definition BNO08xGlobalTypes.hpp:231
Struct to represent gyro bias data (units in rad/s)
Definition BNO08xGlobalTypes.hpp:389
bno08x_gyro_bias_t()
Definition BNO08xGlobalTypes.hpp:394
float y
Definition BNO08xGlobalTypes.hpp:391
float x
Definition BNO08xGlobalTypes.hpp:390
bno08x_gyro_bias_t & operator=(const sh2_GyroscopeUncalibrated &source)
Definition BNO08xGlobalTypes.hpp:402
float z
Definition BNO08xGlobalTypes.hpp:392
Struct to represent gyro data (units in rad/s)
Definition BNO08xGlobalTypes.hpp:353
bno08x_gyro_t & operator=(const sh2_Gyroscope_t &source)
Definition BNO08xGlobalTypes.hpp:368
float x
Definition BNO08xGlobalTypes.hpp:354
bno08x_gyro_t & operator=(const sh2_GyroscopeUncalibrated &source)
Definition BNO08xGlobalTypes.hpp:377
BNO08xAccuracy accuracy
Definition BNO08xGlobalTypes.hpp:357
bno08x_gyro_t()
Definition BNO08xGlobalTypes.hpp:359
float y
Definition BNO08xGlobalTypes.hpp:355
float z
Definition BNO08xGlobalTypes.hpp:356
Struct to represent magnetic field bias data (units in uTesla)
Definition BNO08xGlobalTypes.hpp:328
float y
Definition BNO08xGlobalTypes.hpp:330
float z
Definition BNO08xGlobalTypes.hpp:331
bno08x_magf_bias_t()
Definition BNO08xGlobalTypes.hpp:333
float x
Definition BNO08xGlobalTypes.hpp:329
bno08x_magf_bias_t & operator=(const sh2_MagneticFieldUncalibrated_t &source)
Definition BNO08xGlobalTypes.hpp:341
Struct to represent magnetic field data (units in uTesla)
Definition BNO08xGlobalTypes.hpp:292
float y
Definition BNO08xGlobalTypes.hpp:294
float z
Definition BNO08xGlobalTypes.hpp:295
bno08x_magf_t & operator=(const sh2_MagneticFieldUncalibrated_t &source)
Definition BNO08xGlobalTypes.hpp:316
BNO08xAccuracy accuracy
Definition BNO08xGlobalTypes.hpp:296
float x
Definition BNO08xGlobalTypes.hpp:293
bno08x_magf_t()
Definition BNO08xGlobalTypes.hpp:298
bno08x_magf_t & operator=(const sh2_MagneticField_t &source)
Definition BNO08xGlobalTypes.hpp:307
Struct to represent sensor/report meta data, returned from BNO08xRpt::get_meta_data()
Definition BNO08xGlobalTypes.hpp:733
uint16_t q_point_2
q point for accuracy or bias fields
Definition BNO08xGlobalTypes.hpp:747
uint32_t vendor_id_len
[bytes]
Definition BNO08xGlobalTypes.hpp:749
uint16_t q_point_1
q point for sensor values
Definition BNO08xGlobalTypes.hpp:746
uint16_t q_point_3
q point for sensor data change sensitivity
Definition BNO08xGlobalTypes.hpp:748
uint16_t revision
Metadata record format revision.
Definition BNO08xGlobalTypes.hpp:739
uint32_t fifo_reserved
(Unused)
Definition BNO08xGlobalTypes.hpp:743
bno08x_meta_data_t()
Definition BNO08xGlobalTypes.hpp:755
uint32_t max_period_us
[uS] max period to use with enable_report
Definition BNO08xGlobalTypes.hpp:742
uint8_t sensor_specific[48]
See SH-2 Reference Manual.
Definition BNO08xGlobalTypes.hpp:752
char vendor_ID[48]
Vendor name and part number.
Definition BNO08xGlobalTypes.hpp:750
uint32_t min_period_us
[uS] min period to use with enable_report
Definition BNO08xGlobalTypes.hpp:741
bno08x_meta_data_t(const sh2_SensorMetadata_t &src)
Definition BNO08xGlobalTypes.hpp:779
uint8_t mh_version
Motion Hub Version.
Definition BNO08xGlobalTypes.hpp:735
uint32_t range
Same units as sensor reports.
Definition BNO08xGlobalTypes.hpp:737
uint8_t me_version
Motion Engine Version.
Definition BNO08xGlobalTypes.hpp:734
uint8_t sh_version
SensorHub Version.
Definition BNO08xGlobalTypes.hpp:736
uint32_t resolution
Same units as sensor reports.
Definition BNO08xGlobalTypes.hpp:738
uint32_t fifo_max
(Unused)
Definition BNO08xGlobalTypes.hpp:744
uint32_t sensor_specific_len
[bytes]
Definition BNO08xGlobalTypes.hpp:751
uint16_t power_mA
[mA] Fixed point 16Q10 format
Definition BNO08xGlobalTypes.hpp:740
uint32_t batch_buffer_bytes
(Unused)
Definition BNO08xGlobalTypes.hpp:745
Struct to represent unit quaternion.
Definition BNO08xGlobalTypes.hpp:159
bno08x_quat_t & operator=(const sh2_RotationVectorWAcc_t &source)
Definition BNO08xGlobalTypes.hpp:178
bno08x_quat_t & operator=(const sh2_RotationVector_t &source)
Definition BNO08xGlobalTypes.hpp:189
float rad_accuracy
Definition BNO08xGlobalTypes.hpp:165
float j
Definition BNO08xGlobalTypes.hpp:162
float real
Definition BNO08xGlobalTypes.hpp:160
float i
Definition BNO08xGlobalTypes.hpp:161
float k
Definition BNO08xGlobalTypes.hpp:163
bno08x_quat_t & operator=(const sh2_GyroIntegratedRV_t &source)
Definition BNO08xGlobalTypes.hpp:200
bno08x_quat_t()
Definition BNO08xGlobalTypes.hpp:167
BNO08xAccuracy accuracy
Definition BNO08xGlobalTypes.hpp:164
Struct to represent raw mems accelerometer data from raw accelerometer reports (units in ADC counts).
Definition BNO08xGlobalTypes.hpp:624
int16_t z
Definition BNO08xGlobalTypes.hpp:627
uint32_t timestamp_us
Definition BNO08xGlobalTypes.hpp:628
bno08x_raw_accel_t & operator=(const sh2_RawAccelerometer_t &source)
Definition BNO08xGlobalTypes.hpp:641
int16_t y
Definition BNO08xGlobalTypes.hpp:626
BNO08xAccuracy accuracy
Definition BNO08xGlobalTypes.hpp:629
int16_t x
Definition BNO08xGlobalTypes.hpp:625
bno08x_raw_accel_t()
Definition BNO08xGlobalTypes.hpp:631
Struct to represent raw mems gyro data from raw gyro reports (units in ADC counts).
Definition BNO08xGlobalTypes.hpp:591
bno08x_raw_gyro_t()
Definition BNO08xGlobalTypes.hpp:599
bno08x_raw_gyro_t & operator=(const sh2_RawGyroscope_t &source)
Definition BNO08xGlobalTypes.hpp:610
int16_t x
Definition BNO08xGlobalTypes.hpp:592
uint32_t timestamp_us
Definition BNO08xGlobalTypes.hpp:596
BNO08xAccuracy accuracy
Definition BNO08xGlobalTypes.hpp:597
int16_t temperature
Definition BNO08xGlobalTypes.hpp:595
int16_t y
Definition BNO08xGlobalTypes.hpp:593
int16_t z
Definition BNO08xGlobalTypes.hpp:594
Struct to represent raw mems magnetometer data from raw magnetometer reports (units in ADC counts).
Definition BNO08xGlobalTypes.hpp:654
int16_t z
Definition BNO08xGlobalTypes.hpp:657
int16_t x
Definition BNO08xGlobalTypes.hpp:655
uint32_t timestamp_us
Definition BNO08xGlobalTypes.hpp:658
bno08x_raw_magf_t()
Definition BNO08xGlobalTypes.hpp:661
int16_t y
Definition BNO08xGlobalTypes.hpp:656
bno08x_raw_magf_t & operator=(const sh2_RawMagnetometer_t &source)
Definition BNO08xGlobalTypes.hpp:671
BNO08xAccuracy accuracy
Definition BNO08xGlobalTypes.hpp:659
Struct to represent sample counts, returned from BNO08xRpt::get_sample_counts()
Definition BNO08xGlobalTypes.hpp:704
uint32_t on
Number of "offered" samples while this sensor was requested by host.
Definition BNO08xGlobalTypes.hpp:706
uint32_t accepted
Number of "on" samples that passed decimation filter.
Definition BNO08xGlobalTypes.hpp:707
uint32_t attempted
Number of "accepted" samples that passed threshold requirements and had transmission to the host atte...
Definition BNO08xGlobalTypes.hpp:709
uint32_t offered
Number of samples produced by underlying data source.
Definition BNO08xGlobalTypes.hpp:705
bno08x_sample_counts_t()
Definition BNO08xGlobalTypes.hpp:711
bno08x_sample_counts_t & operator=(const sh2_Counts_t &source)
Definition BNO08xGlobalTypes.hpp:720
Struct to represent shake detector data (flag meaning: 0 = no shake 1 = shake detected)
Definition BNO08xGlobalTypes.hpp:502
uint8_t x_flag
Definition BNO08xGlobalTypes.hpp:503
bno08x_shake_detector_t()
Definition BNO08xGlobalTypes.hpp:508
uint8_t z_flag
Definition BNO08xGlobalTypes.hpp:505
bno08x_shake_detector_t & operator=(const sh2_ShakeDetector_t &source)
Definition BNO08xGlobalTypes.hpp:517
uint8_t y_flag
Definition BNO08xGlobalTypes.hpp:504
BNO08xAccuracy accuracy
Definition BNO08xGlobalTypes.hpp:506
Struct to represent stability classifier data from stability classifier reports.
Definition BNO08xGlobalTypes.hpp:683
bno08x_stability_classifier_t()
Definition BNO08xGlobalTypes.hpp:687
BNO08xStability stability
Definition BNO08xGlobalTypes.hpp:684
BNO08xAccuracy accuracy
Definition BNO08xGlobalTypes.hpp:685
bno08x_stability_classifier_t & operator=(const sh2_StabilityClassifier_t &source)
Definition BNO08xGlobalTypes.hpp:694
Struct to represent step counter data from step counter reports.
Definition BNO08xGlobalTypes.hpp:568
bno08x_step_counter_t()
Definition BNO08xGlobalTypes.hpp:573
uint16_t steps
Definition BNO08xGlobalTypes.hpp:570
BNO08xAccuracy accuracy
Definition BNO08xGlobalTypes.hpp:571
uint32_t latency
Definition BNO08xGlobalTypes.hpp:569
bno08x_step_counter_t & operator=(const sh2_StepCounter_t &source)
Definition BNO08xGlobalTypes.hpp:581
Struct to represent tap detector data (flag meaning: 0 = no tap, 1 = positive tap on axis,...
Definition BNO08xGlobalTypes.hpp:447
int8_t x_flag
Definition BNO08xGlobalTypes.hpp:448
bno08x_tap_detector_t & operator=(const sh2_TapDetector_t &source)
Definition BNO08xGlobalTypes.hpp:464
int8_t z_flag
Definition BNO08xGlobalTypes.hpp:450
bno08x_tap_detector_t()
Definition BNO08xGlobalTypes.hpp:454
BNO08xAccuracy accuracy
Definition BNO08xGlobalTypes.hpp:452
int8_t y_flag
Definition BNO08xGlobalTypes.hpp:449
bool double_tap
Definition BNO08xGlobalTypes.hpp:451