#include "Driver_Timer.h" //-----------------------INITIALISATION TIMER---------------------// void MyTimer_Base_Init(MyTimer_Struct_TypeDef * Timer){ if(Timer->Timer == TIM1){ //RCC->APB2ENR |= 0x0001<<11; RCC->APB2ENR |= RCC_APB2ENR_TIM1EN; } else if(Timer->Timer == TIM2){ //RCC->APB1ENR |= 0x0001; RCC->APB1ENR |= RCC_APB1ENR_TIM2EN; } else if(Timer->Timer == TIM3){ //RCC->APB1ENR |= 0x0001 <<1; RCC->APB1ENR |= RCC_APB1ENR_TIM3EN; } else if(Timer->Timer == TIM4){ //RCC->APB1ENR |= 0x0001 <<2; RCC->APB1ENR |= RCC_APB1ENR_TIM4EN; } Timer->Timer->ARR = Timer->ARR; Timer->Timer->PSC = Timer->PSC; } //-----------------------START----------------------// void MyTimer_Base_Start(TIM_TypeDef * Timer){ Timer->CR1 |= TIM_CR1_CEN; //Masque OU pour placer un 1 décalé avec des 0 } //------------------------STOP----------------------// void MyTimer_Base_Stop(TIM_TypeDef * Timer){ Timer->CR1 |= ~TIM_CR1_CEN; //Masque ET pour placer un 0 décalé avec des 1 (~) }