28 lines
585 B
C
28 lines
585 B
C
#include <stm32f10x.h>
|
|
#include "Timer.h"
|
|
|
|
|
|
void MyTimer_Base_Init(TIM_TypeDef * Timer, unsigned short ValARR, unsigned short ValPSC) { // Configuration du timer
|
|
Timer -> PSC=(ValPSC);
|
|
Timer-> ARR = (ValARR);
|
|
Timer->EGR |= TIM_EGR_UG;
|
|
};
|
|
|
|
|
|
void EnableTimer(TIM_TypeDef *Timer) {
|
|
if(Timer == TIM2){
|
|
RCC -> APB1ENR |= RCC_APB1ENR_TIM2EN;
|
|
}
|
|
else if(Timer == TIM3){
|
|
RCC -> APB1ENR |= RCC_APB1ENR_TIM3EN;
|
|
}
|
|
else if(Timer == TIM4){
|
|
RCC -> APB1ENR |= RCC_APB1ENR_TIM4EN;
|
|
}
|
|
else if(Timer == TIM1){
|
|
RCC->APB2ENR |= RCC_APB2ENR_TIM1EN;
|
|
}
|
|
else{
|
|
}
|
|
}
|
|
|