Ver Fonte

mc_stop 处理需要关闭中断

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui há 3 anos atrás
pai
commit
d0dbbeedc7
1 ficheiros alterados com 4 adições e 1 exclusões
  1. 4 1
      Applications/foc/motor/motor.c

+ 4 - 1
Applications/foc/motor/motor.c

@@ -175,12 +175,15 @@ bool mc_stop(void) {
 		PMSM_FOC_SetErrCode(FOC_Throttle_Err);
 		return false;
 	}
+
+	u32 mask = cpu_enter_critical();
 	_mc_internal_init(CTRL_MODE_OPEN, false);
 	adc_stop_convert();
 	pwm_stop();
 	PMSM_FOC_Stop();
 	pwm_up_enable(true);
-	
+	cpu_exit_critical(mask);
+
 	return true;
 }