HF-BNO08x  0.1.0-dev
Loading...
Searching...
No Matches
esp32_bno08x_test_config.hpp
Go to the documentation of this file.
1
11#pragma once
12
13#include <cstdint>
14
15//==============================================================================
16// COMPILE-TIME CONFIGURATION FLAGS
17//==============================================================================
18
33#ifndef ESP32_BNO08X_ENABLE_DETAILED_I2C_LOGGING
34#define ESP32_BNO08X_ENABLE_DETAILED_I2C_LOGGING 0
35#endif
36
38
45struct I2CPins {
46 static constexpr uint8_t SDA = 4;
47 static constexpr uint8_t SCL = 5;
48};
49
57 static constexpr int8_t RST = 16;
58 static constexpr int8_t INT = 17;
59 static constexpr int8_t BOOT = -1;
60 static constexpr int8_t WAKE = -1;
61};
62
75struct I2CParams {
76 static constexpr uint32_t FREQUENCY = 400000;
77 static constexpr uint8_t DEVICE_ADDRESS = 0x4B;
78 static constexpr uint8_t ALT_ADDRESS = 0x4A;
79 static constexpr uint32_t SCL_WAIT_US = 50000;
80 static constexpr bool PULLUP_ENABLE = true;
81};
82
89 static constexpr uint16_t ACCEL_RANGE_G = 8;
90 static constexpr uint16_t GYRO_RANGE_DPS = 2000;
91 static constexpr float ROTATION_ACCURACY_DEG = 2.0f;
92 static constexpr uint16_t MAX_REPORT_RATE_HZ = 400;
93};
94
101 static constexpr float VDD_MIN = 2.4f;
102 static constexpr float VDD_NOM = 3.3f;
103 static constexpr float VDD_MAX = 3.6f;
104};
105
112 static constexpr int16_t OPERATING_MIN = -40;
113 static constexpr int16_t OPERATING_MAX = 85;
114 static constexpr int16_t WARNING_THRESHOLD = 75;
115};
116
122struct Timing {
123 static constexpr uint16_t POWER_ON_DELAY_MS = 100;
124 static constexpr uint16_t RESET_LOW_MS = 2;
125 static constexpr uint16_t BOOT_DELAY_MS = 200;
126 static constexpr uint16_t SHTP_HEADER_TIMEOUT_MS = 100;
127};
128
135 static constexpr uint16_t POLL_INTERVAL_MS = 100;
136 static constexpr uint8_t MAX_RETRY_COUNT = 3;
137 static constexpr uint8_t SENSOR_RESET_LIMIT = 5;
138};
139
146 static constexpr uint16_t REPORT_COUNT = 100;
147 static constexpr uint16_t SAMPLE_INTERVAL_MS = 10;
148 static constexpr uint16_t TEST_DURATION_MS = 5000;
149 static constexpr float QUATERNION_TOLERANCE = 0.01f;
150};
151
157struct AppConfig {
158 // Logging
159 static constexpr bool ENABLE_DEBUG_LOGGING = true;
160 static constexpr bool ENABLE_I2C_LOGGING = false;
161
162 // Performance
163 static constexpr bool ENABLE_PERFORMANCE_MONITORING = true;
164 static constexpr uint16_t STATS_REPORT_INTERVAL_MS = 10000;
165
166 // Error handling
167 static constexpr bool ENABLE_AUTO_RECOVERY = true;
168 static constexpr uint8_t MAX_ERROR_COUNT = 10;
169};
170
171} // namespace BNO08x_TestConfig
172
178static_assert(BNO08x_TestConfig::I2CParams::FREQUENCY <= 400000,
179 "I2C frequency exceeds BNO08x maximum of 400kHz");
180
183 "BNO08x I2C address must be 0x4A or 0x4B");
184
188#define BNO08X_VALIDATE_GPIO(pin) \
189 static_assert((pin) >= 0 && (pin) < 49, "Invalid GPIO pin number for ESP32-S3")
Definition esp32_bno08x_test_config.hpp:37
Application-specific Configuration.
Definition esp32_bno08x_test_config.hpp:157
static constexpr bool ENABLE_AUTO_RECOVERY
Enable automatic error recovery.
Definition esp32_bno08x_test_config.hpp:167
static constexpr bool ENABLE_DEBUG_LOGGING
Enable detailed debug logs.
Definition esp32_bno08x_test_config.hpp:159
static constexpr bool ENABLE_I2C_LOGGING
Enable I2C transaction logs.
Definition esp32_bno08x_test_config.hpp:160
static constexpr uint16_t STATS_REPORT_INTERVAL_MS
Statistics reporting interval.
Definition esp32_bno08x_test_config.hpp:164
static constexpr bool ENABLE_PERFORMANCE_MONITORING
Enable performance metrics.
Definition esp32_bno08x_test_config.hpp:163
static constexpr uint8_t MAX_ERROR_COUNT
Maximum errors before failsafe.
Definition esp32_bno08x_test_config.hpp:168
Control GPIO Pins for BNO08x.
Definition esp32_bno08x_test_config.hpp:56
static constexpr int8_t INT
GPIO17 - Interrupt pin (HINTN, active low)
Definition esp32_bno08x_test_config.hpp:58
static constexpr int8_t RST
GPIO16 - Reset pin (RSTN, active low)
Definition esp32_bno08x_test_config.hpp:57
static constexpr int8_t WAKE
WAKE pin (SPI mode only, not used for I2C)
Definition esp32_bno08x_test_config.hpp:60
static constexpr int8_t BOOT
BOOTN pin (not wired in this design)
Definition esp32_bno08x_test_config.hpp:59
Diagnostic Thresholds.
Definition esp32_bno08x_test_config.hpp:134
static constexpr uint8_t MAX_RETRY_COUNT
Maximum communication retries.
Definition esp32_bno08x_test_config.hpp:136
static constexpr uint16_t POLL_INTERVAL_MS
Diagnostic polling interval (ms)
Definition esp32_bno08x_test_config.hpp:135
static constexpr uint8_t SENSOR_RESET_LIMIT
Max resets before failsafe.
Definition esp32_bno08x_test_config.hpp:137
I2C Communication Parameters.
Definition esp32_bno08x_test_config.hpp:75
static constexpr uint32_t SCL_WAIT_US
Clock stretching timeout (50ms)
Definition esp32_bno08x_test_config.hpp:79
static constexpr bool PULLUP_ENABLE
Enable internal pullups.
Definition esp32_bno08x_test_config.hpp:80
static constexpr uint8_t DEVICE_ADDRESS
7-bit I2C address (SA0=HIGH)
Definition esp32_bno08x_test_config.hpp:77
static constexpr uint32_t FREQUENCY
400kHz I2C frequency (Fast Mode)
Definition esp32_bno08x_test_config.hpp:76
static constexpr uint8_t ALT_ADDRESS
Alternative address (SA0=LOW)
Definition esp32_bno08x_test_config.hpp:78
I2C Pin Configuration for ESP32-S3.
Definition esp32_bno08x_test_config.hpp:45
static constexpr uint8_t SCL
GPIO5 - I2C SCL (clock)
Definition esp32_bno08x_test_config.hpp:47
static constexpr uint8_t SDA
GPIO4 - I2C SDA (data)
Definition esp32_bno08x_test_config.hpp:46
Sensor Specifications.
Definition esp32_bno08x_test_config.hpp:88
static constexpr float ROTATION_ACCURACY_DEG
Rotation vector accuracy (°)
Definition esp32_bno08x_test_config.hpp:91
static constexpr uint16_t ACCEL_RANGE_G
Accelerometer range (±g)
Definition esp32_bno08x_test_config.hpp:89
static constexpr uint16_t MAX_REPORT_RATE_HZ
Maximum report rate (Hz)
Definition esp32_bno08x_test_config.hpp:92
static constexpr uint16_t GYRO_RANGE_DPS
Gyroscope range (±°/s)
Definition esp32_bno08x_test_config.hpp:90
Supply Voltage Specifications (volts)
Definition esp32_bno08x_test_config.hpp:100
static constexpr float VDD_MIN
Minimum VDD voltage (V)
Definition esp32_bno08x_test_config.hpp:101
static constexpr float VDD_MAX
Maximum VDD voltage (V)
Definition esp32_bno08x_test_config.hpp:103
static constexpr float VDD_NOM
Nominal VDD voltage (V)
Definition esp32_bno08x_test_config.hpp:102
Temperature Specifications (celsius)
Definition esp32_bno08x_test_config.hpp:111
static constexpr int16_t WARNING_THRESHOLD
Temperature warning threshold (°C)
Definition esp32_bno08x_test_config.hpp:114
static constexpr int16_t OPERATING_MAX
Maximum operating temperature (°C)
Definition esp32_bno08x_test_config.hpp:113
static constexpr int16_t OPERATING_MIN
Minimum operating temperature (°C)
Definition esp32_bno08x_test_config.hpp:112
Test Configuration.
Definition esp32_bno08x_test_config.hpp:145
static constexpr uint16_t TEST_DURATION_MS
Test duration (ms)
Definition esp32_bno08x_test_config.hpp:148
static constexpr uint16_t SAMPLE_INTERVAL_MS
Sampling interval (ms)
Definition esp32_bno08x_test_config.hpp:147
static constexpr float QUATERNION_TOLERANCE
Quaternion norm tolerance.
Definition esp32_bno08x_test_config.hpp:149
static constexpr uint16_t REPORT_COUNT
Number of reports per test.
Definition esp32_bno08x_test_config.hpp:146
Timing Parameters.
Definition esp32_bno08x_test_config.hpp:122
static constexpr uint16_t RESET_LOW_MS
Reset pulse low duration (ms)
Definition esp32_bno08x_test_config.hpp:124
static constexpr uint16_t BOOT_DELAY_MS
Boot delay after reset release (ms)
Definition esp32_bno08x_test_config.hpp:125
static constexpr uint16_t SHTP_HEADER_TIMEOUT_MS
SHTP header read timeout (ms)
Definition esp32_bno08x_test_config.hpp:126
static constexpr uint16_t POWER_ON_DELAY_MS
Power-on initialization delay (ms)
Definition esp32_bno08x_test_config.hpp:123