Explorar el Código

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

SummerGift hace 6 años
padre
commit
116ac49e61
Se han modificado 1 ficheros con 3 adiciones y 0 borrados
  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);
 }
 }