Merge branch 'PWM' into Moteur
# Conflicts: # MDK-ARM/Project.uvoptx # MyDrivers/MyPWM.h # Src/main.c
This commit is contained in:
commit
17efd9c1a2
2 changed files with 10 additions and 0 deletions
|
@ -55,3 +55,11 @@ void MyPWM_Set_Impulse_Duration(TIM_TypeDef * Timer, uint32_t CompareValue, int
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
int MyPWM_Duty_Cycle_Permilles(TIM_TypeDef * Timer, int channel1, int channel2);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue