Merge branch 'PWM' into Moteur

# Conflicts:
#	MDK-ARM/Project.uvoptx
#	MyDrivers/MyPWM.h
#	Src/main.c
This commit is contained in:
Neluji 2020-11-22 17:07:26 +01:00
commit 17efd9c1a2
2 changed files with 10 additions and 0 deletions

View file

@ -55,3 +55,11 @@ void MyPWM_Set_Impulse_Duration(TIM_TypeDef * Timer, uint32_t CompareValue, int
else LL_TIM_OC_SetCompareCH4(Timer, CompareValue); else LL_TIM_OC_SetCompareCH4(Timer, CompareValue);
} }
int MyPWM_Duty_Cycle_Permilles(TIM_TypeDef * Timer, int channel1, int channel2) {
if(channel1 == LL_TIM_CHANNEL_CH1 && channel2 == LL_TIM_CHANNEL_CH2) {
return LL_TIM_IC_GetCaptureCH2(Timer) / LL_TIM_IC_GetCaptureCH1(Timer) * 1000;
}
else {
return -1;
}
}

View file

@ -10,4 +10,6 @@ void MyPWM_Conf_Input(TIM_TypeDef * Timer, int channel1, int channel2);
void MyPWM_Set_Impulse_Duration(TIM_TypeDef * Timer, uint32_t CompareValue, int channel); void MyPWM_Set_Impulse_Duration(TIM_TypeDef * Timer, uint32_t CompareValue, int channel);
int MyPWM_Duty_Cycle_Permilles(TIM_TypeDef * Timer, int channel1, int channel2);
#endif #endif