C++ refactoring (#91)

This commit is contained in:
Ken Van Hoeylandt
2024-11-26 17:51:05 +01:00
committed by GitHub
parent d06137ba76
commit ca5d4b8226
159 changed files with 904 additions and 1086 deletions
+33
View File
@@ -0,0 +1,33 @@
#include "hal/Hal_i.h"
#include "hal/i2c/I2c.h"
#define TAG "hal"
namespace tt::hal {
void init(const Configuration& configuration) {
if (configuration.initPower != nullptr) {
TT_LOG_I(TAG, "Init power");
tt_check(configuration.initPower(), "Init power failed");
}
tt_check(i2c::init(configuration.i2c), "I2C init failed");
if (configuration.initHardware != nullptr) {
TT_LOG_I(TAG, "Init hardware");
tt_check(configuration.initHardware(), "Hardware init failed");
}
if (configuration.sdcard != nullptr) {
TT_LOG_I(TAG, "Mounting sdcard");
if (!sdcard::mount(configuration.sdcard)) {
TT_LOG_W(TAG, "SD card mount failed (init can continue)");
}
}
if (configuration.initLvgl != nullptr) {
TT_LOG_I(TAG, "Init LVGL");
tt_check(configuration.initLvgl(), "LVGL init failed");
}
}
} // namespace