lv_os.h

Functions

void lv_lock(void)

Lock LVGL's general mutex. LVGL is not thread safe, so a mutex is used to avoid executing multiple LVGL functions at the same time from different threads. It shall be called when calling LVGL functions from threads different than lv_timer_handler's thread. It doesn't need to be called in LVGL events because they are called from lv_timer_handler(). It is called internally in lv_timer_handler().

lv_result_t lv_lock_isr(void)

Same as lv_lock() but can be called from an interrupt.

Returns:

LV_RESULT_OK: success; LV_RESULT_INVALID: failure

void lv_unlock(void)

The pair of lv_lock() and lv_lock_isr(). It unlocks LVGL general mutex. It is called internally in lv_timer_handler().

void lv_sleep_ms(uint32_t ms)

Sleeps the current thread by an amount of milliseconds.

Parameters:

ms – amount of milliseconds to sleep the current thread.