Просмотр исходного кода

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

Wendal Chen 9 месяцев назад
Родитель
Сommit
e5743b4ba7

+ 11 - 7
components/bluetooth/include/luat_ble.h

@@ -122,9 +122,10 @@ typedef enum{
     LUAT_BLE_EVENT_DISCONN,     // BLE断开连接
     LUAT_BLE_EVENT_GATT_DONE,     // BLE GATT
 
-    // WRITE
-    LUAT_BLE_EVENT_WRITE,       // BLE写数据
-    LUAT_BLE_EVENT_READ,        // BLE读数据
+    // WRITE/READ
+    LUAT_BLE_EVENT_WRITE,         // BLE从模式下,主设备写操作事件
+    LUAT_BLE_EVENT_READ,         // BLE从模式下,主设备读操作事件
+    LUAT_BLE_EVENT_READ_VALUE,      // BLE读value数据回调
 
     LUAT_BLE_EVENT_MAX,
 
@@ -179,8 +180,8 @@ typedef struct {
 typedef enum{
     LUAT_BLE_ADDR_MODE_PUBLIC,   // 控制器的公共地址
     LUAT_BLE_ADDR_MODE_RANDOM,   // 生成的静态地址
-    LUAT_BLE_ADDR_MODE_RPA,      // 可解析的私有地址
-    LUAT_BLE_ADDR_MODE_NRPA,     // 不可解析的私有地址
+    LUAT_BLE_ADDR_MODE_RPA,    // 可解析的私有地址
+    LUAT_BLE_ADDR_MODE_NRPA,    // 不可解析的私有地址
 }luat_ble_addr_mode_t;
 
 typedef enum{
@@ -233,8 +234,11 @@ typedef struct{
 
 typedef struct{
     uint16_t handle;       /**< The index of the attribute */
+    luat_ble_uuid_t uuid_service;
+    luat_ble_uuid_t uuid_characteristic;
+    luat_ble_uuid_t uuid_descriptor;
     uint8_t *value;         /**< The attribute value */
-    uint16_t len;           /**< The data length read */
+    uint16_t value_len;           /**< The data length read */
     uint16_t size;          /**< The size of attribute value to read */
 } luat_ble_read_req_t;
 
@@ -278,7 +282,7 @@ typedef struct{
     union {
         luat_ble_device_info_t luat_ble_device_info;
         luat_ble_write_req_t write_req;
-        // luat_ble_read_req_t read_req;
+        luat_ble_read_req_t read_req;
         luat_ble_adv_req_t adv_req;
         luat_ble_conn_ind_t conn_ind;
         luat_ble_disconn_ind_t disconn_ind;

+ 100 - 69
components/bluetooth/src/luat_lib_ble.c

@@ -102,39 +102,44 @@ int l_ble_callback(lua_State *L, void *ptr)
         break;
     }
     case LUAT_BLE_EVENT_READ:
-    {
-        // luat_ble_read_req_t *read_req = &(param->read_req);
-        // lua_createtable(L, 0, 5);
-        // lua_pushliteral(L, "handle");
-        // lua_pushinteger(L, read_req->handle);
-        // lua_settable(L, -3);
-
-        // luat_ble_uuid_t uuid_service = {0};
-        // luat_ble_uuid_t uuid_characteristic = {0};
-        // luat_ble_uuid_t uuid_descriptor = {0};
-        // luat_ble_handle2uuid(read_req->handle, &uuid_service, &uuid_characteristic, &uuid_descriptor);
-        // // LLOGD("service:0x%02X %d characteristic:0x%02X %d descriptor:0x%02X %d",
-        // //     uuid_service.uuid[0]<<8|uuid_service.uuid[1],uuid_service.uuid_type,
-        // //     uuid_characteristic.uuid[0]<<8|uuid_characteristic.uuid[1],uuid_characteristic.uuid_type,
-        // //     uuid_descriptor.uuid[0]<<8|uuid_descriptor.uuid[1],uuid_descriptor.uuid_type);
-        // lua_pushliteral(L, "uuid_service");
-        // lua_pushlstring(L, (const char *)uuid_service.uuid, uuid_service.uuid_type);
-        // lua_settable(L, -3);
-        // lua_pushliteral(L, "uuid_characteristic");
-        // lua_pushlstring(L, (const char *)uuid_characteristic.uuid, uuid_characteristic.uuid_type);
-        // lua_settable(L, -3);
-        // if (uuid_descriptor.uuid[0] != 0 || uuid_descriptor.uuid[1] != 0){
-        //     lua_pushliteral(L, "uuid_descriptor");
-        //     lua_pushlstring(L, (const char *)uuid_descriptor.uuid, uuid_descriptor.uuid_type);
-        //     lua_settable(L, -3);
-        // }
-
-        // lua_call(L, 3, 0);
+    case LUAT_BLE_EVENT_READ_VALUE:{
+        luat_ble_read_req_t *read_req = &(param->read_req);
+        lua_createtable(L, 0, 5);
+        lua_pushliteral(L, "handle");
+        lua_pushinteger(L, read_req->handle);
+        lua_settable(L, -3);
 
+        luat_ble_uuid_t uuid_service = {0};
+        luat_ble_uuid_t uuid_characteristic = {0};
+        luat_ble_uuid_t uuid_descriptor = {0};
+        luat_ble_handle2uuid(read_req->handle, &uuid_service, &uuid_characteristic, &uuid_descriptor);
+        // LLOGD("service:0x%02X %d characteristic:0x%02X %d descriptor:0x%02X %d",
+        //     uuid_service.uuid[0]<<8|uuid_service.uuid[1],uuid_service.uuid_type,
+        //     uuid_characteristic.uuid[0]<<8|uuid_characteristic.uuid[1],uuid_characteristic.uuid_type,
+        //     uuid_descriptor.uuid[0]<<8|uuid_descriptor.uuid[1],uuid_descriptor.uuid_type);
+        lua_pushliteral(L, "uuid_service");
+        lua_pushlstring(L, (const char *)uuid_service.uuid, uuid_service.uuid_type);
+        lua_settable(L, -3);
+        lua_pushliteral(L, "uuid_characteristic");
+        lua_pushlstring(L, (const char *)uuid_characteristic.uuid, uuid_characteristic.uuid_type);
+        lua_settable(L, -3);
+        if (uuid_descriptor.uuid[0] != 0 || uuid_descriptor.uuid[1] != 0){
+            lua_pushliteral(L, "uuid_descriptor");
+            lua_pushlstring(L, (const char *)uuid_descriptor.uuid, uuid_descriptor.uuid_type);
+            lua_settable(L, -3);
+        }
+        if (evt == LUAT_BLE_EVENT_READ_VALUE){
+            lua_pushliteral(L, "data");
+            lua_pushlstring(L, (const char *)read_req->value, read_req->value_len);
+            lua_settable(L, -3);
+        }
+        lua_call(L, 3, 0);
+        if (read_req->value){
+            luat_heap_free(read_req->value);
+            read_req->value = NULL;
+        }
         break;
-    }
-    case LUAT_BLE_EVENT_SCAN_REPORT:
-    {
+    }case LUAT_BLE_EVENT_SCAN_REPORT:{
         luat_ble_adv_req_t *adv_req = &(param->adv_req);
         lua_createtable(L, 0, 4);
 
@@ -155,8 +160,7 @@ int l_ble_callback(lua_State *L, void *ptr)
 
         lua_call(L, 3, 0);
         break;
-    }
-    case LUAT_BLE_EVENT_GATT_DONE:{
+    }case LUAT_BLE_EVENT_GATT_DONE:{
         luat_ble_gatt_service_t **gatt_services = param->gatt_done_ind.gatt_service;
         uint8_t gatt_service_num = param->gatt_done_ind.gatt_service_num;
         lua_createtable(L, gatt_service_num, 0);
@@ -183,9 +187,7 @@ int l_ble_callback(lua_State *L, void *ptr)
         }
         lua_call(L, 3, 0);
         break;
-    }
-    case LUAT_BLE_EVENT_CONN:
-    {
+    }case LUAT_BLE_EVENT_CONN:{
         luat_ble_conn_ind_t *conn = &(param->conn_ind);
         lua_newtable(L);
         memcpy(tmpbuff, conn->peer_addr, 6);
@@ -196,9 +198,7 @@ int l_ble_callback(lua_State *L, void *ptr)
         lua_setfield(L, -2, "addr_type");
         lua_call(L, 3, 0);
         break;
-    }
-    case LUAT_BLE_EVENT_DISCONN:
-    {
+    }case LUAT_BLE_EVENT_DISCONN:{
         luat_ble_disconn_ind_t *disconn = &(param->disconn_ind);
         lua_newtable(L);
         lua_pushinteger(L, disconn->reason);
@@ -231,26 +231,20 @@ exit:
     return 0;
 }
 
-void luat_ble_cb(luat_ble_t *args, luat_ble_event_t ble_event, luat_ble_param_t *ble_param)
-{
+void luat_ble_cb(luat_ble_t *args, luat_ble_event_t ble_event, luat_ble_param_t *ble_param){
     // LLOGD("ble event: %d param: %p", ble_event, ble_param);
     luat_ble_param_t *luat_ble_param = NULL;
-    if (ble_param)
-    {
+    if (ble_param){
         // LLOGD("ble param: %p", ble_param);
         luat_ble_param = luat_heap_malloc(sizeof(luat_ble_param_t));
         memcpy(luat_ble_param, ble_param, sizeof(luat_ble_param_t));
-        if (ble_event == LUAT_BLE_EVENT_WRITE && ble_param->write_req.value_len)
-        {
+        if (ble_event == LUAT_BLE_EVENT_WRITE && ble_param->write_req.value_len){
             luat_ble_param->write_req.value = luat_heap_malloc(ble_param->write_req.value_len);
             memcpy(luat_ble_param->write_req.value, ble_param->write_req.value, ble_param->write_req.value_len);
-        }
-        // else if (ble_event == LUAT_BLE_EVENT_READ && ble_param->read_req.value_len)
-        // {
-        //     LLOGD("ble read read_req value: %p", ble_param->read_req.value);
-        // }
-        else if (ble_event == LUAT_BLE_EVENT_SCAN_REPORT && ble_param->adv_req.data_len)
-        {
+        }else if (ble_event == LUAT_BLE_EVENT_READ_VALUE && ble_param->read_req.value_len){
+            luat_ble_param->read_req.value = luat_heap_malloc(ble_param->read_req.value_len);
+            memcpy(luat_ble_param->read_req.value, ble_param->read_req.value, ble_param->read_req.value_len);
+        }else if (ble_event == LUAT_BLE_EVENT_SCAN_REPORT && ble_param->adv_req.data_len){
             luat_ble_param->adv_req.data = luat_heap_malloc(ble_param->adv_req.data_len);
             memcpy(luat_ble_param->adv_req.data, ble_param->adv_req.data, ble_param->adv_req.data_len);
         }
@@ -606,7 +600,6 @@ static int l_ble_advertising_stop(lua_State *L){
 ble_device:write_notify({
     uuid_service = "FA00", -- 服务的UUID, 可以是16位、32位或128位
     uuid_characteristic = "EA01", -- 特征的UUID值, 可以是16位、32位或128位
-    uuid_descriptor = "2902" -- 可选, 描述符的UUID值, 可以是16位、32位或128位
 }, "Hello BLE") -- 要写入的值
 */
 static int l_ble_write_notify(lua_State *L){
@@ -627,7 +620,7 @@ static int l_ble_write_notify(lua_State *L){
             service_uuid = luaL_checklstring(L, -1, &tmp);
             service.uuid_type = tmp;
             memcpy(service.uuid, service_uuid, service.uuid_type);
-            LLOGD("uuid_service: %02X %02X", service.uuid[0], service.uuid[1]);
+            // LLOGD("uuid_service: %02X %02X", service.uuid[0], service.uuid[1]);
         }
         else{
             LLOGW("缺失 uuid_service 参数");
@@ -640,7 +633,7 @@ static int l_ble_write_notify(lua_State *L){
             characteristic_uuid = luaL_checklstring(L, -1, &tmp);
             characteristic.uuid_type = tmp;
             memcpy(characteristic.uuid, characteristic_uuid, characteristic.uuid_type);
-            LLOGD("uuid_characteristic: %02X %02X", characteristic.uuid[0], characteristic.uuid[1]);
+            // LLOGD("uuid_characteristic: %02X %02X", characteristic.uuid[0], characteristic.uuid[1]);
         }
         else{
             LLOGW("缺失 uuid_characteristic 参数");
@@ -653,7 +646,7 @@ static int l_ble_write_notify(lua_State *L){
             descriptor_uuid = luaL_checklstring(L, -1, &tmp);
             descriptor.uuid_type = tmp;
             memcpy(descriptor.uuid, descriptor_uuid, descriptor.uuid_type);
-            LLOGD("uuid_descriptor: %02X %02X", descriptor.uuid[0], descriptor.uuid[1]);
+            // LLOGD("uuid_descriptor: %02X %02X", descriptor.uuid[0], descriptor.uuid[1]);
             ret = luat_ble_write_notify_value(&service, &characteristic, &descriptor, (uint8_t *)value, len);
         }else{
             ret = luat_ble_write_notify_value(&service, &characteristic, NULL, (uint8_t *)value, len);
@@ -680,7 +673,6 @@ end_error:
 ble_device:write_indicate({
     uuid_service = "FA00", -- 服务的UUID, 可以是16位、32位或128位
     uuid_characteristic = "EA01", -- 特征的UUID值, 可以是16位、32位或128位
-    uuid_descriptor = "2902" -- 可选, 描述符的UUID值, 可以是16位、32位或128位
 }, "Hello BLE") -- 要写入的值
 */
 static int l_ble_write_indicate(lua_State *L){
@@ -754,7 +746,6 @@ end_error:
 ble_device:write_value({
     uuid_service = "FA00", -- 服务的UUID, 可以是16位、32位或128位
     uuid_characteristic = "EA01", -- 特征的UUID值, 可以是16位、32位或128位
-    uuid_descriptor = "2902" -- 可选, 描述符的UUID值, 可以是16位、32位或128位
 }, "Hello BLE") -- 要写入的值
 */
 static int l_ble_write_value(lua_State *L){
@@ -775,7 +766,7 @@ static int l_ble_write_value(lua_State *L){
             service_uuid = luaL_checklstring(L, -1, &tmp);
             service.uuid_type = tmp;
             memcpy(service.uuid, service_uuid, service.uuid_type);
-            LLOGD("uuid_service: %02X %02X", service.uuid[0], service.uuid[1]);
+            // LLOGD("uuid_service: %02X %02X", service.uuid[0], service.uuid[1]);
         }
         else{
             LLOGW("缺失 uuid_service 参数");
@@ -788,7 +779,7 @@ static int l_ble_write_value(lua_State *L){
             characteristic_uuid = luaL_checklstring(L, -1, &tmp);
             characteristic.uuid_type = tmp;
             memcpy(characteristic.uuid, characteristic_uuid, characteristic.uuid_type);
-            LLOGD("uuid_characteristic: %02X %02X", characteristic.uuid[0], characteristic.uuid[1]);
+            // LLOGD("uuid_characteristic: %02X %02X", characteristic.uuid[0], characteristic.uuid[1]);
         }
         else{
             LLOGW("缺失 uuid_characteristic 参数");
@@ -801,7 +792,7 @@ static int l_ble_write_value(lua_State *L){
             descriptor_uuid = luaL_checklstring(L, -1, &tmp);
             descriptor.uuid_type = tmp;
             memcpy(descriptor.uuid, descriptor_uuid, descriptor.uuid_type);
-            LLOGD("uuid_descriptor: %02X %02X", descriptor.uuid[0], descriptor.uuid[1]);
+            // LLOGD("uuid_descriptor: %02X %02X", descriptor.uuid[0], descriptor.uuid[1]);
             ret = luat_ble_write_value(&service, &characteristic, &descriptor, (uint8_t *)value, len);
 
         }else{
@@ -818,6 +809,18 @@ end_error:
     return 0;
 }
 
+/*
+读取特征值
+@api ble.read_value(opts)
+@table 特征值的描述信息
+@return boolean 是否成功
+@usage
+-- 读取特征值,通过回调中的 EVENT_READ_VALUE 事件返回读取的value值
+ble_device:read_value({
+    uuid_service = "FA00", -- 服务的UUID, 可以是16位、32位或128位
+    uuid_characteristic = "EA01", -- 特征的UUID值, 可以是16位、32位或128位
+})
+*/
 static int l_ble_read_value(lua_State *L){
     uint16_t ret = 0;
     const char *service_uuid = NULL;
@@ -836,7 +839,7 @@ static int l_ble_read_value(lua_State *L){
             service_uuid = luaL_checklstring(L, -1, &tmp);
             service.uuid_type = tmp;
             memcpy(service.uuid, service_uuid, service.uuid_type);
-            LLOGD("uuid_service: %02X %02X", service.uuid[0], service.uuid[1]);
+            // LLOGD("uuid_service: %02X %02X", service.uuid[0], service.uuid[1]);
         }
         else{
             LLOGW("缺失 uuid_service 参数");
@@ -849,7 +852,7 @@ static int l_ble_read_value(lua_State *L){
             characteristic_uuid = luaL_checklstring(L, -1, &tmp);
             characteristic.uuid_type = tmp;
             memcpy(characteristic.uuid, characteristic_uuid, characteristic.uuid_type);
-            LLOGD("uuid_characteristic: %02X %02X", characteristic.uuid[0], characteristic.uuid[1]);
+            // LLOGD("uuid_characteristic: %02X %02X", characteristic.uuid[0], characteristic.uuid[1]);
         }
         else{
             LLOGW("缺失 uuid_characteristic 参数");
@@ -862,7 +865,7 @@ static int l_ble_read_value(lua_State *L){
             descriptor_uuid = luaL_checklstring(L, -1, &tmp);
             descriptor.uuid_type = tmp;
             memcpy(descriptor.uuid, descriptor_uuid, descriptor.uuid_type);
-            LLOGD("uuid_descriptor: %02X %02X", descriptor.uuid[0], descriptor.uuid[1]);
+            // LLOGD("uuid_descriptor: %02X %02X", descriptor.uuid[0], descriptor.uuid[1]);
             ret = luat_ble_read_value(&service, &characteristic, &descriptor, &value, &len);
 
         }else{
@@ -949,17 +952,35 @@ static int l_ble_scanning_stop(lua_State *L){
     return 1;
 }
 
+/*
+BLE连接
+@api ble.connect()
+@string mac 地址
+@int 地址类型 ble.PUBLIC ble.RANDOM
+@return boolean 是否成功
+@usage
+-- BLE连接
+ble_device:connect(string.fromHex("C8478C4E027D"),0)
+*/
 static int l_ble_connect(lua_State *L){
     size_t len;
     uint8_t *adv_addr = luaL_checklstring(L, 2, &len);
     uint8_t adv_addr_type = luaL_checknumber(L, 3);
-    LLOGD(" adv_addr_type:%d, adv_addr:%02x:%02x:%02x:%02x:%02x:%02x",
-          adv_addr_type, adv_addr[0], adv_addr[1], adv_addr[2],
-          adv_addr[3], adv_addr[4], adv_addr[5]);
+    // LLOGD(" adv_addr_type:%d, adv_addr:%02x:%02x:%02x:%02x:%02x:%02x",
+    //       adv_addr_type, adv_addr[0], adv_addr[1], adv_addr[2],
+    //       adv_addr[3], adv_addr[4], adv_addr[5]);
     lua_pushboolean(L, luat_ble_connect(NULL, adv_addr, adv_addr_type) ? 0 : 1);
     return 1;
 }
 
+/*
+BLE断开连接
+@api ble.disconnect()
+@return boolean 是否成功
+@usage
+-- BLE断开连接
+ble_device:disconnect()
+*/
 static int l_ble_disconnect(lua_State *L){
     lua_pushboolean(L, luat_ble_disconnect(NULL) ? 0 : 1);
     return 1;
@@ -1013,26 +1034,36 @@ static const rotable_Reg_t reg_ble[] = {
     {"EVENT_CONN", ROREG_INT(LUAT_BLE_EVENT_CONN)},
     {"EVENT_DISCONN", ROREG_INT(LUAT_BLE_EVENT_DISCONN)},
     {"EVENT_WRITE", ROREG_INT(LUAT_BLE_EVENT_WRITE)},
-    {"EVENT_WRITE_REQ", ROREG_INT(LUAT_BLE_EVENT_WRITE)},
     {"EVENT_READ", ROREG_INT(LUAT_BLE_EVENT_READ)},
-    {"EVENT_READ_REQ", ROREG_INT(LUAT_BLE_EVENT_READ)},
+    {"EVENT_READ_VALUE", ROREG_INT(LUAT_BLE_EVENT_READ_VALUE)},
 
     // ADV_ADDR_MODE
+    // @const PUBLIC 控制器的公共地址
     {"PUBLIC", ROREG_INT(LUAT_BLE_ADDR_MODE_PUBLIC)},
+    // @const RANDOM 生成的静态地址
     {"RANDOM", ROREG_INT(LUAT_BLE_ADDR_MODE_RANDOM)},
     {"RPA", ROREG_INT(LUAT_BLE_ADDR_MODE_RPA)},
     {"NRPA", ROREG_INT(LUAT_BLE_ADDR_MODE_NRPA)},
+
     // ADV_CHNL
+    //@const CHNL_37 37通道
     {"CHNL_37", ROREG_INT(LUAT_BLE_ADV_CHNL_37)},
+    //@const CHNL_38 38通道
     {"CHNL_38", ROREG_INT(LUAT_BLE_ADV_CHNL_38)},
+    //@const CHNL_39 39通道
     {"CHNL_39", ROREG_INT(LUAT_BLE_ADV_CHNL_39)},
+    //@const CHNLS_ALL 所有通道(37 38 39)
     {"CHNLS_ALL", ROREG_INT(LUAT_BLE_ADV_CHNLS_ALL)},
+
     // Permission
+    //@const READ 读权限
     {"READ", ROREG_INT(LUAT_BLE_GATT_PERM_READ)},
+    //@const READ 写权限
     {"WRITE", ROREG_INT(LUAT_BLE_GATT_PERM_WRITE)},
     {"IND", ROREG_INT(LUAT_BLE_GATT_PERM_IND)},
     {"NOTIFY", ROREG_INT(LUAT_BLE_GATT_PERM_NOTIFY)},
     {"WRITE_CMD", ROREG_INT(LUAT_BLE_GATT_PERM_WRITE_CMD)},
+
     // FLAGS
     {"FLAGS", ROREG_INT(LUAT_ADV_TYPE_FLAGS)},
     {"COMPLETE_LOCAL_NAME", ROREG_INT(LUAT_ADV_TYPE_COMPLETE_LOCAL_NAME)},

+ 0 - 2
module/Air780EGH/demo/u8g2/main.lua

@@ -25,8 +25,6 @@ sys.timerLoopStart(wdt.feed, 3000) -- 3s喂一次狗
 -- gpio.setup(14, nil) -- 关闭GPIO14,防止camera复用关系出问题
 -- gpio.setup(15, nil) -- 关闭GPIO15,防止camera复用关系出问题
 
--- mcu.altfun(mcu.I2C, 4, 67, 3, nil)
--- mcu.altfun(mcu.I2C, 4, 66, 3, nil)
 
 local rtos_bsp = rtos.bsp()
 

+ 1 - 2
module/Air780EHM/demo/camera/spi_cam/main.lua

@@ -10,8 +10,7 @@ log.style(1)
 
 pm.ioVol(pm.IOVOL_ALL_GPIO, 3000)
 
---  mcu.altfun(mcu.I2C, 0, 66, 2, nil)
---  mcu.altfun(mcu.I2C, 0, 67, 2, nil)
+
 
 gpio.setup(2,1)--GPIO2打开给camera_3.3V供电
 

+ 0 - 4
module/Air780EHM/demo/onewire/onewire_single_18b20/main.lua

@@ -15,10 +15,6 @@ log.style(1)
 2. ONEWIRE功能支持在4个引脚使用, 但硬件通道只有一个, 默认是GPIO2
 3. 如需切换到其他脚, 参考如下切换逻辑, 选其中一种
 
-mcu.altfun(mcu.ONEWIRE, 0, 17, 4, 0) -- GPIO2, 也就是默认值
-mcu.altfun(mcu.ONEWIRE, 0, 18, 4, 0) -- GPIO3
-mcu.altfun(mcu.ONEWIRE, 0, 22, 4, 0) -- GPIO7
-mcu.altfun(mcu.ONEWIRE, 0, 53, 4, 0) -- GPIO28
 ]]
 
 local function read_ds18b20(id)

+ 0 - 2
module/Air780EHM/demo/u8g2/main.lua

@@ -25,8 +25,6 @@ sys.timerLoopStart(wdt.feed, 3000) -- 3s喂一次狗
 -- gpio.setup(14, nil) -- 关闭GPIO14,防止camera复用关系出问题
 -- gpio.setup(15, nil) -- 关闭GPIO15,防止camera复用关系出问题
 
--- mcu.altfun(mcu.I2C, 4, 67, 3, nil)
--- mcu.altfun(mcu.I2C, 4, 66, 3, nil)
 
 local rtos_bsp = rtos.bsp()
 

+ 0 - 2
module/Air780EHV/DEMO/u8g2/main.lua

@@ -25,8 +25,6 @@ sys.timerLoopStart(wdt.feed, 3000) -- 3s喂一次狗
 -- gpio.setup(14, nil) -- 关闭GPIO14,防止camera复用关系出问题
 -- gpio.setup(15, nil) -- 关闭GPIO15,防止camera复用关系出问题
 
--- mcu.altfun(mcu.I2C, 4, 67, 3, nil)
--- mcu.altfun(mcu.I2C, 4, 66, 3, nil)
 
 local rtos_bsp = rtos.bsp()
 

+ 0 - 2
module/Air780EPM/demo/camera/spi_cam/main.lua

@@ -10,8 +10,6 @@ log.style(1)
 
 pm.ioVol(pm.IOVOL_ALL_GPIO, 3000)
 
---  mcu.altfun(mcu.I2C, 0, 66, 2, nil)
---  mcu.altfun(mcu.I2C, 0, 67, 2, nil)
 
 gpio.setup(2,1)--GPIO2打开给camera_3.3V供电
 

+ 1 - 6
module/Air780EPM/demo/onewire/onewire_single_18b20/main.lua

@@ -13,12 +13,7 @@ log.style(1)
 注意:
 1. 3.3v在老版本的开发板上没有引脚, 所以需要外接, 一定要确保共地
 2. ONEWIRE功能支持在4个引脚使用, 但硬件通道只有一个, 默认是GPIO2
-3. 如需切换到其他脚, 参考如下切换逻辑, 选其中一种
-
-mcu.altfun(mcu.ONEWIRE, 0, 17, 4, 0) -- GPIO2, 也就是默认值
-mcu.altfun(mcu.ONEWIRE, 0, 18, 4, 0) -- GPIO3
-mcu.altfun(mcu.ONEWIRE, 0, 22, 4, 0) -- GPIO7
-mcu.altfun(mcu.ONEWIRE, 0, 53, 4, 0) -- GPIO28
+3. 如需切换到其他脚, 参考上一级目录下的onewire_multi_18b20_swich_read
 ]]
 
 local function read_ds18b20(id)

+ 0 - 2
module/Air780EPM/demo/u8g2/main.lua

@@ -25,8 +25,6 @@ sys.timerLoopStart(wdt.feed, 3000) -- 3s喂一次狗
 -- gpio.setup(14, nil) -- 关闭GPIO14,防止camera复用关系出问题
 -- gpio.setup(15, nil) -- 关闭GPIO15,防止camera复用关系出问题
 
--- mcu.altfun(mcu.I2C, 4, 67, 3, nil)
--- mcu.altfun(mcu.I2C, 4, 66, 3, nil)
 
 local rtos_bsp = rtos.bsp()
 

+ 1 - 6
module/Air8000/demo/onewire/main.lua

@@ -20,12 +20,7 @@ log.style(1)
 
 注意:
 1. ONEWIRE功能支持在4个引脚使用, 但硬件通道只有一个, 默认是GPIO2
-2. 如需切换到其他脚, 参考如下切换逻辑, 选其中一种
-
-mcu.altfun(mcu.ONEWIRE, 0, 17, 4, 0) -- GPIO2, 也就是默认值
-mcu.altfun(mcu.ONEWIRE, 0, 18, 4, 0) -- GPIO3
-mcu.altfun(mcu.ONEWIRE, 0, 22, 4, 0) -- GPIO7
-mcu.altfun(mcu.ONEWIRE, 0, 53, 4, 0) -- GPIO28
+2. 如需切换到其他脚, 参考Air780EPM目录下的onewire_multi_18b20_swich_read
 ]]
 
 local function read_ds18b20(id)

+ 1 - 4
module/Air8000/project/School_To_Home/code/test.lua

@@ -70,10 +70,7 @@ audio.on(0, function(id, event, buff)
 end)
 
 sys.taskInit(function()
-    mcu.altfun(mcu.I2C, Gsensori2cId, 23, 2, 0)
-    mcu.altfun(mcu.I2C, Gsensori2cId, 24, 2, 0)
-    mcu.altfun(mcu.I2C, es8311i2cId, 13, 2, 0)
-    mcu.altfun(mcu.I2C, es8311i2cId, 14, 2, 0)
+
     local codecIsInit = false
     while true do
         local result, param1, param2 = sys.waitUntil("CONTROL")