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

参数:
  • 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

返回:

LV_RESULT_OK: success; LV_RESULT_INVALID: failure

lv_result_t lv_thread_delete(lv_thread_t *thread)

Delete a thread

参数:

thread -- the thread to delete

返回:

LV_RESULT_OK: success; LV_RESULT_INVALID: failure

lv_result_t lv_mutex_init(lv_mutex_t *mutex)

Create a mutex

参数:

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

返回:

LV_RESULT_OK: success; LV_RESULT_INVALID: failure

lv_result_t lv_mutex_lock(lv_mutex_t *mutex)

Lock a mutex

参数:

mutex -- the mutex to lock

返回:

LV_RESULT_OK: success; LV_RESULT_INVALID: failure

lv_result_t lv_mutex_lock_isr(lv_mutex_t *mutex)

Lock a mutex from interrupt

参数:

mutex -- the mutex to lock

返回:

LV_RESULT_OK: success; LV_RESULT_INVALID: failure

lv_result_t lv_mutex_unlock(lv_mutex_t *mutex)

Unlock a mutex

参数:

mutex -- the mutex to unlock

返回:

LV_RESULT_OK: success; LV_RESULT_INVALID: failure

lv_result_t lv_mutex_delete(lv_mutex_t *mutex)

Delete a mutex

参数:

mutex -- the mutex to delete

返回:

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

参数:

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

返回:

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

参数:

sync -- a sync object

返回:

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

参数:

sync -- a sync object

返回:

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

参数:

sync -- a sync object

返回:

LV_RESULT_OK: success; LV_RESULT_INVALID: failure

lv_result_t lv_thread_sync_delete(lv_thread_sync_t *sync)

Delete a sync object

参数:

sync -- a sync object to delete

返回:

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.

返回:

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