mirror of
https://github.com/m5stack/ESP-Claw.git
synced 2026-05-20 11:51:49 -07:00
feat(basic_demo): porting components expression
- add display arbiter Co-authored-by: zhouli <1932489836@qq.com>
This commit is contained in:
committed by
zhouli
co-authored by
zhouli
parent
847e0543fb
commit
b3baef5802
@@ -8,6 +8,7 @@
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "display_arbiter.h"
|
||||
#include "esp_attr.h"
|
||||
#include "esp_check.h"
|
||||
#include "esp_heap_caps.h"
|
||||
@@ -716,6 +717,15 @@ static esp_err_t display_hal_submit_bitmap_locked(int x_start, int y_start,
|
||||
}
|
||||
}
|
||||
|
||||
if (!display_arbiter_is_owner(DISPLAY_ARBITER_OWNER_LUA)) {
|
||||
s_state.flush_in_flight = false;
|
||||
if (pending_framebuffer_index >= 0) {
|
||||
s_state.visible_framebuffer_index = (uint8_t)pending_framebuffer_index;
|
||||
s_state.pending_framebuffer_index = -1;
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
if (display_hal_panel_requires_swap()) {
|
||||
pixel_count = (size_t)(x_end - x_start) * (size_t)(y_end - y_start);
|
||||
ESP_RETURN_ON_FALSE(s_state.submit_swap_buffer != NULL, ESP_ERR_INVALID_STATE, TAG,
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "lua_module_display.h"
|
||||
|
||||
#include "cap_lua.h"
|
||||
#include "display_arbiter.h"
|
||||
#include "display_hal.h"
|
||||
#include "esp_err.h"
|
||||
#include "lauxlib.h"
|
||||
@@ -146,8 +147,14 @@ static int lua_display_init(lua_State *L)
|
||||
int lcd_height = lua_display_check_integer_arg(L, 4, "lcd_height");
|
||||
display_hal_panel_if_t panel_if = lua_display_parse_panel_if(L, 5);
|
||||
|
||||
esp_err_t err = display_hal_create(panel_handle, io_handle, panel_if, lcd_width, lcd_height);
|
||||
esp_err_t err = display_arbiter_acquire(DISPLAY_ARBITER_OWNER_LUA);
|
||||
if (err != ESP_OK) {
|
||||
return luaL_error(L, "display init acquire failed: %s", esp_err_to_name(err));
|
||||
}
|
||||
|
||||
err = display_hal_create(panel_handle, io_handle, panel_if, lcd_width, lcd_height);
|
||||
if (err != ESP_OK) {
|
||||
display_arbiter_release(DISPLAY_ARBITER_OWNER_LUA);
|
||||
return luaL_error(L, "display init failed: %s", esp_err_to_name(err));
|
||||
}
|
||||
|
||||
@@ -163,6 +170,11 @@ static int lua_display_deinit(lua_State *L)
|
||||
return luaL_error(L, "display deinit failed: %s", esp_err_to_name(err));
|
||||
}
|
||||
|
||||
err = display_arbiter_release(DISPLAY_ARBITER_OWNER_LUA);
|
||||
if (err != ESP_OK) {
|
||||
return luaL_error(L, "display release failed: %s", esp_err_to_name(err));
|
||||
}
|
||||
|
||||
lua_pushboolean(L, 1);
|
||||
return 1;
|
||||
}
|
||||
@@ -1353,7 +1365,6 @@ int luaopen_display(lua_State *L)
|
||||
lua_setfield(L, -2, "init");
|
||||
lua_pushcfunction(L, lua_display_deinit);
|
||||
lua_setfield(L, -2, "deinit");
|
||||
|
||||
lua_pushcfunction(L, lua_display_width);
|
||||
lua_setfield(L, -2, "width");
|
||||
lua_pushcfunction(L, lua_display_height);
|
||||
|
||||
Reference in New Issue
Block a user