lv_os.h

Enums

enum lv_thread_prio_t

Values:

enumerator LV_THREAD_PRIO_LOWEST
enumerator LV_THREAD_PRIO_LOW
enumerator LV_THREAD_PRIO_MID
enumerator LV_THREAD_PRIO_HIGH
enumerator LV_THREAD_PRIO_HIGHEST

Functions

lv_result_t lv_thread_init(lv_thread_t *thread, lv_thread_prio_t prio, void (*callback)(void*), size_t stack_size, void *user_data)

Create a new thread

Parameters:
  • thread -- a variable in which the thread will be stored

  • prio -- priority of the thread

  • callback -- function of the thread

  • stack_size -- stack size in bytes

  • user_data -- arbitrary data, will be available in the callback

Returns:

LV_RESULT_OK: success; LV_RESULT_INVALID: failure

lv_result_t lv_thread_delete(lv_thread_t *thread)

Delete a thread

Parameters:

thread -- the thread to delete

Returns:

LV_RESULT_OK: success; LV_RESULT_INVALID: failure

lv_result_t lv_mutex_init(lv_mutex_t *mutex)

Create a mutex

Parameters:

mutex -- a variable in which the thread will be stored

Returns:

LV_RESULT_OK: success; LV_RESULT_INVALID: failure

lv_result_t lv_mutex_lock(lv_mutex_t *mutex)

Lock a mutex

Parameters:

mutex -- the mutex to lock

Returns:

LV_RESULT_OK: success; LV_RESULT_INVALID: failure

lv_result_t lv_mutex_lock_isr(lv_mutex_t *mutex)

Lock a mutex from interrupt

Parameters:

mutex -- the mutex to lock

Returns:

LV_RESULT_OK: success; LV_RESULT_INVALID: failure

lv_result_t lv_mutex_unlock(lv_mutex_t *mutex)

Unlock a mutex

Parameters:

mutex -- the mutex to unlock

Returns:

LV_RESULT_OK: success; LV_RESULT_INVALID: failure

lv_result_t lv_mutex_delete(lv_mutex_t *mutex)

Delete a mutex

Parameters:

mutex -- the mutex to delete

Returns:

LV_RESULT_OK: success; LV_RESULT_INVALID: failure

lv_result_t lv_thread_sync_init(lv_thread_sync_t *sync)

Create a thread synchronization object

Parameters:

sync -- a variable in which the sync will be stored

Returns:

LV_RESULT_OK: success; LV_RESULT_INVALID: failure

lv_result_t lv_thread_sync_wait(lv_thread_sync_t *sync)

Wait for a "signal" on a sync object

Parameters:

sync -- a sync object

Returns:

LV_RESULT_OK: success; LV_RESULT_INVALID: failure

lv_result_t lv_thread_sync_signal(lv_thread_sync_t *sync)

Send a wake-up signal to a sync object

Parameters:

sync -- a sync object

Returns:

LV_RESULT_OK: success; LV_RESULT_INVALID: failure

lv_result_t lv_thread_sync_signal_isr(lv_thread_sync_t *sync)

Send a wake-up signal to a sync object from interrupt

Parameters:

sync -- a sync object

Returns:

LV_RESULT_OK: success; LV_RESULT_INVALID: failure

lv_result_t lv_thread_sync_delete(lv_thread_sync_t *sync)

Delete a sync object

Parameters:

sync -- a sync object to delete

Returns:

LV_RESULT_OK: success; LV_RESULT_INVALID: failure

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().