voilier-team-1/driver/timer.h

20 lines
580 B
C
Raw Normal View History

#ifndef MYTIMER_H
#define MYTIMER_H
#include "stm32f10x.h"
typedef struct {
TIM_TypeDef * Timer;
unsigned short ARR;
unsigned short PSC;
} MyTimer_Struct_Typedef;
void MyTimer_Base_Init(MyTimer_Struct_Typedef * Timer);
void MyTimer_ActiveIT(TIM_TypeDef * Timer, char Prio, void (*IT_function) (void));
void MyTimer_PWM(TIM_TypeDef * Timer ,char Channel);
void MyTimer_DutyCycle(TIM_TypeDef * Timer, char Channel, unsigned int DutyCycle);
#define MyTimer_Base_Start(Tim) (Tim.Timer->CR1 |= TIM_CR1_CEN)
#define MyTimer_Base_Stop(Tim) (Tim.Timer->CR1 &= ~TIM_CR1_CEN)
#endif