TP_microcontroleur/timer_act2/Includes/Driver_TIMER.c
2021-09-24 16:19:06 +02:00

26 lines
471 B
C

#include "Driver_TIMER.h"
/*typedef struct {
TIM_TypeDef * Timer ;
uint16_t ARR ;
uint16_t PSC ;
} MyTimer_Struct_TypeDef ;
*/
void MyTimer_Base_Init(MyTimer_Struct_TypeDef * Timer) {
Timer -> Timer -> ARR = Timer -> ARR -1;
Timer -> Timer -> PSC = Timer -> PSC -1;
}
void Activate_TIM(int i) {
if (i==1) {
//le timer1 est sur apb2enr
RCC-> APB2ENR |= 0x01 << 11 ;
}
else {
//les autres timers sont sur apb1enr
RCC-> APB1ENR |= 0x01 << (i-2) ;
}
}