Compare commits
No commits in common. "b22b75ca8b73970fa569db888735c956fb694e90" and "e7210441cf8769379bd0094dc97dd46330b717f9" have entirely different histories.
b22b75ca8b
...
e7210441cf
1 changed files with 2 additions and 3 deletions
|
|
@ -178,14 +178,13 @@ int getArrFromFreq(float freq_khz)
|
|||
|
||||
void PWMo_conf(TIM_TypeDef * timer, int channel, float freq_khz, float dutyCycle)
|
||||
{
|
||||
const int arr = getArrFromFreq(freq_khz);
|
||||
Timer_conf(timer, arr, 0);
|
||||
Timer_conf(timer, getArrFromFreq(freq_khz), 0);
|
||||
LL_TIM_OC_InitTypeDef init_struct;
|
||||
LL_TIM_OC_StructInit(&init_struct);
|
||||
|
||||
init_struct.OCMode = LL_TIM_OCMODE_PWM1;
|
||||
init_struct.OCState = LL_TIM_OCSTATE_ENABLE;
|
||||
init_struct.CompareValue= dutyCycle * arr;
|
||||
init_struct.CompareValue= dutyCycle * getArrFromFreq(freq_khz);
|
||||
|
||||
LL_TIM_OC_Init(timer, channel, &init_struct);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue