Ken Van Hoeylandt 08029a84dd
Various fixes and improvements (#269)
- Bump version for next release
- Fix default gamma for CYD 2432S032C
- Remember gamma curve setting from Display settings app
- Add UART to Core2 (still has no voltage on Grove port, though)
- LVGL performance improvements: pin to second core and set task priority to "critical"
- Fix build warnings, including deprecations
- Removed deprecated `Thread` constructor
- Fix WaveShare S3 display: Some displays would show a white screen at 12MHz, so I'm putting it back to the
official config values.
2025-04-01 23:42:56 +02:00

60 lines
1.2 KiB
C++

#include "Tactility/lvgl/LvglSync.h"
#include <Tactility/Mutex.h>
namespace tt::lvgl {
static Mutex lockMutex;
static bool defaultLock(uint32_t timeoutMillis) {
return lockMutex.lock(timeoutMillis);
}
static void defaultUnlock() {
lockMutex.unlock();
}
static LvglLock lock_singleton = defaultLock;
static LvglUnlock unlock_singleton = defaultUnlock;
void syncSet(LvglLock lock, LvglUnlock unlock) {
auto old_lock = lock_singleton;
auto old_unlock = unlock_singleton;
// Ensure the old lock is not engaged when changing locks
old_lock((uint32_t)portMAX_DELAY);
lock_singleton = lock;
unlock_singleton = unlock;
old_unlock();
}
bool lock(TickType_t timeout) {
return lock_singleton(pdMS_TO_TICKS(timeout == 0 ? portMAX_DELAY : timeout));
}
void unlock() {
unlock_singleton();
}
class LvglSync : public Lock {
public:
~LvglSync() override = default;
bool lock(TickType_t timeoutTicks) const override {
return tt::lvgl::lock(timeoutTicks);
}
bool unlock() const override {
tt::lvgl::unlock();
return true;
}
};
static std::shared_ptr<Lock> lvglSync = std::make_shared<LvglSync>();
std::shared_ptr<Lock> getSyncLock() {
return lvglSync;
}
} // namespace