Update Tiemr Drivers
This commit is contained in:
parent
d95839cb79
commit
16eacd6380
2 changed files with 32 additions and 0 deletions
|
@ -278,6 +278,28 @@ void Set_PWM_PRCT(TIM_TypeDef * Timer, char Channel, int percent){
|
|||
|
||||
|
||||
}
|
||||
void Set_Duty_Cycle(TIM_TypeDef * Timer , char Channel,uint16_t crr){
|
||||
switch(Channel){
|
||||
case 1:
|
||||
Timer->CCR1 = crr;
|
||||
break;
|
||||
case 2:
|
||||
Timer->CCR2 = crr;
|
||||
break;
|
||||
case 3:
|
||||
Timer->CCR3 = crr;
|
||||
break;
|
||||
case 4:
|
||||
Timer->CCR4 = crr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint16_t Get_Max_Duty(TIM_TypeDef * Timer){
|
||||
return Timer->ARR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -28,6 +28,16 @@ void MyTimer_Base_Stop(TIM_TypeDef * Timer );
|
|||
void MyTimer_ActiveIT (TIM_TypeDef * Timer, char Prio, void (* IT_function) (void));
|
||||
|
||||
void MyTimer_PWM(TIM_TypeDef * Timer, char Channel);
|
||||
/**
|
||||
* alpha = CRR/ARR, use Get_Max_Duty(Timer) to get ARR
|
||||
*/
|
||||
void Set_Duty_Cycle(TIM_TypeDef * Timer , char Channel,uint16_t crr);
|
||||
|
||||
/**
|
||||
* Returns ARR
|
||||
*/
|
||||
uint16_t Get_Max_Duty(TIM_TypeDef * Timer);
|
||||
|
||||
|
||||
void Set_PWM_PRCT(TIM_TypeDef * Timer, char Channel, int percent);
|
||||
|
||||
|
|
Loading…
Reference in a new issue