소스 검색

mc_stop 处理需要关闭中断

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui 3 년 전
부모
커밋
d0dbbeedc7
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  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;
 }