committed by
GitHub
parent
6d80144e12
commit
85e26636a3
@@ -0,0 +1,27 @@
|
||||
#include "LvglSync.h"
|
||||
|
||||
namespace tt::lvgl {
|
||||
|
||||
static LvglLock lock_singleton = nullptr;
|
||||
static LvglUnlock unlock_singleton = nullptr;
|
||||
|
||||
void sync_set(LvglLock lock, LvglUnlock unlock) {
|
||||
lock_singleton = lock;
|
||||
unlock_singleton = unlock;
|
||||
}
|
||||
|
||||
bool lock(uint32_t timeout_ticks) {
|
||||
if (lock_singleton) {
|
||||
return lock_singleton(timeout_ticks);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void unlock() {
|
||||
if (unlock_singleton) {
|
||||
unlock_singleton();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
Reference in New Issue
Block a user