14 lines
523 B
C
14 lines
523 B
C
extern SemaphoreHandle_t lvgl_mux;
|
|
const char* TAG="bsp";
|
|
bool bsp_display_lock(int timeout_ms)
|
|
{
|
|
ESP_LOGI(TAG, "Obtention mutex");
|
|
// Convert timeout in milliseconds to FreeRTOS ticks
|
|
// If `timeout_ms` is set to -1, the program will block until the condition is met
|
|
const TickType_t timeout_ticks = (timeout_ms == -1) ? portMAX_DELAY : pdMS_TO_TICKS(timeout_ms);
|
|
return xSemaphoreTakeRecursive(lvgl_mux, timeout_ticks) == pdTRUE;
|
|
}
|
|
void bsp_display_unlock() {
|
|
xSemaphoreGiveRecursive(lvgl_mux);
|
|
}
|