Explorar el Código

Merge branch 'master' of https://gitee.com/openLuat/LuatOS

alienwalker hace 1 año
padre
commit
94c0aba180

+ 2 - 0
components/camera/luat_camera.h

@@ -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__
@@ -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;

+ 8 - 0
components/camera/luat_lib_camera.c

@@ -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)) {

+ 2 - 1
demo/camera/usb_cam/main.lua

@@ -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)