Ver Fonte

【修复】wdt 初始化失败的 bug

SummerGift há 6 anos atrás
pai
commit
116ac49e61
1 ficheiros alterados com 3 adições e 0 exclusões
  1. 3 0
      port/modules/machine/machine_wdt.c

+ 3 - 0
port/modules/machine/machine_wdt.c

@@ -79,6 +79,9 @@ STATIC mp_obj_t machine_wdt_make_new(const mp_obj_type_t *type_in, size_t n_args
     result = rt_device_control(self->wdt_device, RT_DEVICE_CTRL_WDT_SET_TIMEOUT, (void *)&timeout);
     result = rt_device_control(self->wdt_device, RT_DEVICE_CTRL_WDT_SET_TIMEOUT, (void *)&timeout);
     error_check(result == RT_EOK, "WDT set timout error");
     error_check(result == RT_EOK, "WDT set timout error");
 
 
+    result = rt_device_control(self->wdt_device, RT_DEVICE_CTRL_WDT_START, RT_NULL);
+    error_check(result == RT_EOK, "WDT start error");
+
     // return constant object
     // return constant object
     return MP_OBJ_FROM_PTR(self);
     return MP_OBJ_FROM_PTR(self);
 }
 }