Explorar o código

add:添加ftp编译

Dozingfiretruck %!s(int64=3) %!d(string=hai) anos
pai
achega
26c2ecf5d5

+ 2 - 2
luatos/components/luat/CMakeLists.txt

@@ -68,11 +68,11 @@ idf_component_register(SRC_DIRS ${LUATOS_ROOT}/luat/modules
                                 ${LUATOS_ROOT}/components/rsa/binding
                                 ${LUATOS_ROOT}/components/network/adapter
                                 ${LUATOS_ROOT}/components/network/websocket
+                                ${LUATOS_ROOT}/components/network/libftp
                                 ${LUATOS_ROOT}/components/ethernet/common
                                 ${LUATOS_ROOT}/components/ethernet/w5500
                                 ${LUATOS_ROOT}/components/common
                                 ${LUATOS_ROOT}/components/rtos/freertos
-                                ${LUATOS_ROOT}/components/network/websocket
                                 ${LUATOS_ROOT}/components/luatfonts
                                 ${LUATOS_ROOT}/components/fskv
                                 ${LUATOS_ROOT}/components/sfd
@@ -123,11 +123,11 @@ idf_component_register(SRC_DIRS ${LUATOS_ROOT}/luat/modules
                                 ${LUATOS_ROOT}/components/nimble/inc
                                 ${LUATOS_ROOT}/components/network/adapter
                                 ${LUATOS_ROOT}/components/network/websocket
+                                ${LUATOS_ROOT}/components/network/libftp
                                 ${LUATOS_ROOT}/components/ethernet/common
                                 ${LUATOS_ROOT}/components/ethernet/w5500
                                 ${LUATOS_ROOT}/components/common
                                 ${LUATOS_ROOT}/components/network/posix
-                                ${LUATOS_ROOT}/components/network/websocket
                                 ${LUATOS_ROOT}/components/luatfonts
                                 ${LUATOS_ROOT}/components/fskv
                                 ${LUATOS_ROOT}/components/sfd

+ 3 - 0
luatos/components/luat/port/luat_base_idf5.c

@@ -211,6 +211,9 @@ static const luaL_Reg loadedlibs[] = {
 #ifdef LUAT_USE_NETWORK
   {"socket", luaopen_socket_adapter},
   {"websocket", luaopen_websocket},
+#ifdef LUAT_USE_FTP
+  {"ftp", luaopen_ftp},
+#endif
 #ifdef LUAT_USE_W5500
   {"w5500", luaopen_w5500},
 #endif

+ 9 - 10
luatos/components/luat/port/luat_spi_idf5.c

@@ -442,14 +442,13 @@ int luat_spi_config_dma(int spi_id, uint32_t tx_channel, uint32_t rx_channel) {
 }
 
 int luat_spi_change_speed(int spi_id, uint32_t speed) {
-    // 无法这样使用
-    // spi_device_interface_config_t* dev_config = &spi_config[spi_id-2];
-    // dev_config->clock_speed_hz = speed;
-    // int ret = spi_bus_remove_device(spi_handle[spi_id-2]);
-    // if (ret != 0){
-    //     return ret;
-    // }
-    // ret =  spi_bus_add_device(spi_id-1, dev_config, &spi_handle[spi_id-2]);
-    // return ret;
-    return 0;
+    spi_device_interface_config_t* dev_config = &spi_config[spi_id-2];
+    dev_config->clock_speed_hz = speed;
+    int ret = spi_bus_remove_device(spi_handle[spi_id-2]);
+    if (ret != 0){
+        return ret;
+    }
+    ret =  spi_bus_add_device(spi_id-1, dev_config, &spi_handle[spi_id-2]);
+    return ret;
+    // return 0;
 }

+ 1 - 0
luatos/include/luat_conf_bsp.h

@@ -30,6 +30,7 @@
 #define LUAT_USE_NETWORK
 #define LUAT_USE_LWIP
 #define LUAT_USE_DNS
+// #define LUAT_USE_FTP
 
 //----------------------------------
 // 使用VFS(虚拟文件系统)和内置库文件, 必须启用