relative pwm input
This commit is contained in:
parent
60944f55dd
commit
4dd931d8fc
1 changed files with 8 additions and 2 deletions
|
@ -60,12 +60,18 @@ void RF_INPUT_Init(void)
|
||||||
LL_TIM_EnableCounter(TIM4);
|
LL_TIM_EnableCounter(TIM4);
|
||||||
}
|
}
|
||||||
|
|
||||||
int RF_INPUT_GetValue1(void)
|
int RF_INPUT_GetPeriodUs(void)
|
||||||
{
|
{
|
||||||
return LL_TIM_ReadReg(TIM4, CCR1);
|
return LL_TIM_ReadReg(TIM4, CCR1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int RF_INPUT_GetValue2(void)
|
int RF_INPUT_GetDutyTimeUs(void)
|
||||||
{
|
{
|
||||||
return LL_TIM_ReadReg(TIM4, CCR2);
|
return LL_TIM_ReadReg(TIM4, CCR2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int RF_INPUT_GetDutyTimeRelative(void)
|
||||||
|
{
|
||||||
|
int d = RF_INPUT_GetDutyTimeUs();
|
||||||
|
return (d - 1500) / 5;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue