# esp32_BNO08x: include/BNO08xTestHelper.hpp Source File

Loading...
Searching...
No Matches
BNO08xTestHelper.hpp
Go to the documentation of this file.
#pragma once
// in-house includes
#include "BNO08x.hpp"
class BNO08xTestHelper
{
private:
inline static BNO08x* test_imu = nullptr;
inline static bno08x_config_t imu_cfg;
static const constexpr char* TAG = "BNO08xTestHelper";
public:
static void print_test_start_banner(const char* TEST_TAG)
{
printf("------------------------ BEGIN TEST: %s ------------------------\n\r", TEST_TAG);
}
static void print_test_end_banner(const char* TEST_TAG)
{
printf("------------------------ END TEST: %s ------------------------\n\r", TEST_TAG);
}
static void print_test_msg(const char* TEST_TAG, const char* msg)
{
printf("%s: %s: %s\n\r", TAG, TEST_TAG, msg);
}
static void set_test_imu_cfg(bno08x_config_t cfg)
{
imu_cfg = cfg;
}
static void create_test_imu()
{
if (test_imu != nullptr)
destroy_test_imu();
test_imu = new BNO08x();
}
static void destroy_test_imu()
{
if (test_imu != nullptr)
{
delete test_imu;
test_imu = nullptr;
}
}
static BNO08x* get_test_imu()
{
return test_imu;
}
static esp_err_t call_init_config_args()
{
if (test_imu == nullptr)
return ESP_FAIL;
return test_imu->init_config_args();
}
static esp_err_t call_init_gpio()
{
if (test_imu == nullptr)
return ESP_FAIL;
return test_imu->init_gpio();
}
static esp_err_t call_init_hint_isr()
{
if (test_imu == nullptr)
return ESP_FAIL;
return test_imu->init_hint_isr();
}
static esp_err_t call_init_spi()
{
if (test_imu == nullptr)
return ESP_FAIL;
return test_imu->init_spi();
}
static esp_err_t call_init_tasks()
{
if (test_imu == nullptr)
return ESP_FAIL;
return test_imu->init_tasks();
}
static esp_err_t call_init_sh2_HAL()
{
if (test_imu == nullptr)
return ESP_FAIL;
return test_imu->init_sh2_HAL();
}
static esp_err_t call_deinit_gpio()
{
if (test_imu == nullptr)
return ESP_FAIL;
return test_imu->deinit_gpio();
}
static esp_err_t call_deinit_hint_isr()
{
if (test_imu == nullptr)
return ESP_FAIL;
return test_imu->deinit_hint_isr();
}
static esp_err_t call_deinit_spi()
{
if (test_imu == nullptr)
return ESP_FAIL;
return test_imu->deinit_spi();
}
static esp_err_t call_deinit_tasks()
{
if (test_imu == nullptr)
return ESP_FAIL;
return test_imu->deinit_tasks();
}
static esp_err_t call_deinit_sh2_HAL()
{
if (test_imu == nullptr)
return ESP_FAIL;
return test_imu->deinit_sh2_HAL();
}
};
BNO08x.hpp
BNO08x
BNO08x IMU driver class.
Definition BNO08x.hpp:33
BNO08x::deinit_spi
esp_err_t deinit_spi()
Deinitializes SPI.
Definition BNO08x.cpp:931
BNO08x::deinit_gpio
esp_err_t deinit_gpio()
Deinitializes GPIO, called from deconstructor.
Definition BNO08x.cpp:805
BNO08x::init_config_args
esp_err_t init_config_args()
Initializes required esp-idf SPI data structures with values from user passed bno08x_config_t struct.
Definition BNO08x.cpp:390
BNO08x::init_spi
esp_err_t init_spi()
Initializes SPI.
Definition BNO08x.cpp:702
BNO08x::deinit_sh2_HAL
esp_err_t deinit_sh2_HAL()
Deinitializes sh2 HAL.
Definition BNO08x.cpp:1030
BNO08x::init_tasks
esp_err_t init_tasks()
Initializes data_proc_task.
Definition BNO08x.cpp:632
BNO08x::deinit_tasks
esp_err_t deinit_tasks()
Deinitializes tasks used by BNO08x driver.
Definition BNO08x.cpp:977
BNO08x::deinit_hint_isr
esp_err_t deinit_hint_isr()
Deinitializes host interrupt ISR, called from deconstructor.
Definition BNO08x.cpp:893
BNO08x::init_hint_isr
esp_err_t init_hint_isr()
Initializes host interrupt ISR.
Definition BNO08x.cpp:583
BNO08x::init_gpio
esp_err_t init_gpio()
Initializes required gpio.
Definition BNO08x.cpp:558
BNO08x::init_sh2_HAL
esp_err_t init_sh2_HAL()
Initializes sh2 HAL.
Definition BNO08x.cpp:747
BNO08xTestHelper
BNO08x unit test helper class.
Definition BNO08xTestHelper.hpp:17
BNO08xTestHelper::imu_cfg
static bno08x_config_t imu_cfg
Definition BNO08xTestHelper.hpp:20
BNO08xTestHelper::print_test_start_banner
static void print_test_start_banner(const char *TEST_TAG)
Prints test begin banner.
Definition BNO08xTestHelper.hpp:32
BNO08xTestHelper::print_test_end_banner
static void print_test_end_banner(const char *TEST_TAG)
Prints end begin banner.
Definition BNO08xTestHelper.hpp:44
BNO08xTestHelper::print_test_msg
static void print_test_msg(const char *TEST_TAG, const char *msg)
Prints a message during a test.
Definition BNO08xTestHelper.hpp:57
BNO08xTestHelper::test_imu
static BNO08x * test_imu
Definition BNO08xTestHelper.hpp:19
BNO08xTestHelper::call_deinit_gpio
static esp_err_t call_deinit_gpio()
Used to call private BNO08x::deinit_gpio() member for tests.
Definition BNO08xTestHelper.hpp:194
BNO08xTestHelper::call_deinit_tasks
static esp_err_t call_deinit_tasks()
Used to call private BNO08x::deinit_tasks() member for tests.
Definition BNO08xTestHelper.hpp:233
BNO08xTestHelper::get_test_imu
static BNO08x * get_test_imu()
Deletes test IMU calling deconstructor and releases heap allocated memory.
Definition BNO08xTestHelper.hpp:106
BNO08xTestHelper::call_init_gpio
static esp_err_t call_init_gpio()
Used to call private BNO08x::init_gpio() member for tests.
Definition BNO08xTestHelper.hpp:129
BNO08xTestHelper::call_deinit_spi
static esp_err_t call_deinit_spi()
Used to call private BNO08x::deinit_spi() member for tests.
Definition BNO08xTestHelper.hpp:220
BNO08xTestHelper::create_test_imu
static void create_test_imu()
Calls BNO08x constructor and creates new test IMU on heap.
Definition BNO08xTestHelper.hpp:79
BNO08xTestHelper::call_init_config_args
static esp_err_t call_init_config_args()
Used to call private BNO08x::init_config_args() member for tests.
Definition BNO08xTestHelper.hpp:116
BNO08xTestHelper::call_init_spi
static esp_err_t call_init_spi()
Used to call private BNO08x::init_spi() member for tests.
Definition BNO08xTestHelper.hpp:155
BNO08xTestHelper::call_init_hint_isr
static esp_err_t call_init_hint_isr()
Used to call private BNO08x::init_hint_isr() member for tests.
Definition BNO08xTestHelper.hpp:142
BNO08xTestHelper::call_init_sh2_HAL
static esp_err_t call_init_sh2_HAL()
Used to call private BNO08x::init_tasks() member for tests.
Definition BNO08xTestHelper.hpp:181
BNO08xTestHelper::call_init_tasks
static esp_err_t call_init_tasks()
Used to call private BNO08x::init_tasks() member for tests.
Definition BNO08xTestHelper.hpp:168
BNO08xTestHelper::set_test_imu_cfg
static void set_test_imu_cfg(bno08x_config_t cfg)
Set test imu configuration used with create_test_imu()
Definition BNO08xTestHelper.hpp:69
BNO08xTestHelper::TAG
static const constexpr char * TAG
Definition BNO08xTestHelper.hpp:22
BNO08xTestHelper::call_deinit_sh2_HAL
static esp_err_t call_deinit_sh2_HAL()
Used to call private BNO08x::deinit_tasks() member for tests.
Definition BNO08xTestHelper.hpp:246
BNO08xTestHelper::call_deinit_hint_isr
static esp_err_t call_deinit_hint_isr()
Used to call private BNO08x::deinit_hint_isr() member for tests.
Definition BNO08xTestHelper.hpp:207
BNO08xTestHelper::destroy_test_imu
static void destroy_test_imu()
Deletes test IMU calling deconstructor and releases heap allocated memory.
Definition BNO08xTestHelper.hpp:92
bno08x_config_t
IMU configuration settings passed into constructor.
Definition BNO08xGlobalTypes.hpp:38