Skip to content

Commit

Permalink
Merge branch 'master' of https://gitee.com/openLuat/LuatOS
Browse files Browse the repository at this point in the history
  • Loading branch information
allewalker committed Mar 4, 2025
2 parents 0f2fa58 + df35e14 commit 94c0aba
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions components/camera/luat_camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ typedef struct luat_camera_conf
uint8_t color_bit;
uint8_t id_reg;
uint8_t id_value;
uint8_t usb_port;
size_t init_cmd_size;
uint8_t *init_cmd;
#ifdef __LUATOS__
Expand All @@ -66,6 +67,7 @@ typedef struct
uint8_t is_msb; //0 or 1;
uint8_t is_two_line_rx; //0 or 1;
uint8_t seq_type; //0 or 1
uint8_t usb_port;
uint8_t plat_param[4];
#ifdef __LUATOS__
luat_lcd_conf_t* lcd_conf;
Expand Down
8 changes: 8 additions & 0 deletions components/camera/luat_lib_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,14 @@ static int l_camera_init(lua_State *L){
conf.id = luaL_checkinteger(L, -1);
}
lua_pop(L, 1);

lua_pushliteral(L, "usb_port");
lua_gettable(L, 1);
if (lua_isinteger(L, -1)) {
conf.usb_port = luaL_checkinteger(L, -1);
}
lua_pop(L, 1);

lua_pushliteral(L, "init_cmd");
lua_gettable(L, 1);
if (lua_istable(L, -1)) {
Expand Down
3 changes: 2 additions & 1 deletion demo/camera/usb_cam/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ local camera_id = camera.USB
local usb_camera_table = {
id = camera_id,
sensor_width = 1280,
sensor_height = 720
sensor_height = 720,
usb_port = 1
}

camera.on(camera_id, "scanned", function(id, str)
Expand Down

0 comments on commit 94c0aba

Please sign in to comment.