f620255c41
- `TT_LOG_*` macros are replaced by `Logger` via `#include<Tactility/Logger.h>` - Changed default timezone to Europe/Amsterdam - Fix for logic bug in unPhone hardware - Fix for init/deinit in DRV2605 driver - Other fixes - Removed optimization that broke unPhone (disabled the moving of heap-related functions to flash)
22 lines
529 B
C++
22 lines
529 B
C++
#include <Tactility/lvgl/LabelUtils.h>
|
|
#include <Tactility/file/File.h>
|
|
#include <Tactility/file/FileLock.h>
|
|
|
|
namespace tt::lvgl {
|
|
|
|
bool label_set_text_file(lv_obj_t* label, const char* filepath) {
|
|
std::unique_ptr<uint8_t[]> text;
|
|
file::getLock(filepath)->withLock([&text, filepath] {
|
|
text = file::readString(filepath);
|
|
});
|
|
|
|
if (text != nullptr) {
|
|
lv_label_set_text(label, reinterpret_cast<const char*>(text.get()));
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
} // namespace
|