19 static inline uint8_t test_imu_buffer[
sizeof(
BNO08x)];
20 inline static BNO08x* test_imu =
nullptr;
23 static const constexpr char* TAG =
"BNO08xTestHelper";
35 printf(
"------------------------ BEGIN TEST: %s ------------------------\n\r", TEST_TAG);
47 printf(
"------------------------ END TEST: %s ------------------------\n\r", TEST_TAG);
60 printf(
"%s: %s: %s\n\r", TAG, TEST_TAG, msg);
82 if (test_imu !=
nullptr)
85 test_imu =
new (&test_imu_buffer)
BNO08x();
95 if (test_imu !=
nullptr)
119 if (test_imu ==
nullptr)
122 return test_imu->init_config_args();
132 if (test_imu ==
nullptr)
135 return test_imu->init_gpio();
145 if (test_imu ==
nullptr)
148 return test_imu->init_hint_isr();
158 if (test_imu ==
nullptr)
161 return test_imu->init_spi();
171 if (test_imu ==
nullptr)
174 return test_imu->init_tasks();
184 if (test_imu ==
nullptr)
187 return test_imu->init_sh2_HAL();
197 if (test_imu ==
nullptr)
200 return test_imu->deinit_gpio();
210 if (test_imu ==
nullptr)
213 return test_imu->deinit_hint_isr();
223 if (test_imu ==
nullptr)
226 return test_imu->deinit_spi();
236 if (test_imu ==
nullptr)
239 return test_imu->deinit_tasks();
249 if (test_imu ==
nullptr)
252 return test_imu->deinit_sh2_HAL();
BNO08x IMU driver class.
Definition: BNO08x.hpp:33
BNO08x unit test helper class.
Definition: BNO08xTestHelper.hpp:17
static void print_test_start_banner(const char *TEST_TAG)
Prints test begin banner.
Definition: BNO08xTestHelper.hpp:33
static void print_test_end_banner(const char *TEST_TAG)
Prints end begin banner.
Definition: BNO08xTestHelper.hpp:45
static void print_test_msg(const char *TEST_TAG, const char *msg)
Prints a message during a test.
Definition: BNO08xTestHelper.hpp:58
static esp_err_t call_deinit_gpio()
Used to call private BNO08x::deinit_gpio() member for tests.
Definition: BNO08xTestHelper.hpp:195
static esp_err_t call_deinit_tasks()
Used to call private BNO08x::deinit_tasks() member for tests.
Definition: BNO08xTestHelper.hpp:234
static BNO08x * get_test_imu()
Deletes test IMU calling deconstructor and releases heap allocated memory.
Definition: BNO08xTestHelper.hpp:107
static esp_err_t call_init_gpio()
Used to call private BNO08x::init_gpio() member for tests.
Definition: BNO08xTestHelper.hpp:130
static esp_err_t call_deinit_spi()
Used to call private BNO08x::deinit_spi() member for tests.
Definition: BNO08xTestHelper.hpp:221
static void create_test_imu()
Calls BNO08x constructor and creates new test IMU on heap.
Definition: BNO08xTestHelper.hpp:80
static esp_err_t call_init_config_args()
Used to call private BNO08x::init_config_args() member for tests.
Definition: BNO08xTestHelper.hpp:117
static esp_err_t call_init_spi()
Used to call private BNO08x::init_spi() member for tests.
Definition: BNO08xTestHelper.hpp:156
static esp_err_t call_init_hint_isr()
Used to call private BNO08x::init_hint_isr() member for tests.
Definition: BNO08xTestHelper.hpp:143
static esp_err_t call_init_sh2_HAL()
Used to call private BNO08x::init_tasks() member for tests.
Definition: BNO08xTestHelper.hpp:182
static esp_err_t call_init_tasks()
Used to call private BNO08x::init_tasks() member for tests.
Definition: BNO08xTestHelper.hpp:169
static void set_test_imu_cfg(bno08x_config_t cfg)
Set test imu configuration used with create_test_imu()
Definition: BNO08xTestHelper.hpp:70
static esp_err_t call_deinit_sh2_HAL()
Used to call private BNO08x::deinit_tasks() member for tests.
Definition: BNO08xTestHelper.hpp:247
static esp_err_t call_deinit_hint_isr()
Used to call private BNO08x::deinit_hint_isr() member for tests.
Definition: BNO08xTestHelper.hpp:208
static void destroy_test_imu()
Deletes test IMU calling deconstructor and releases heap allocated memory.
Definition: BNO08xTestHelper.hpp:93
IMU configuration settings passed into constructor.
Definition: BNO08xGlobalTypes.hpp:38