voilier-team-1/driver-algu/inc/timer.h

19 lines
581 B
C

#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 char DutyCycle);
#define MyTimer_Base_Start(Tim) (Tim.Timer->CR1 |= TIM_CR1_CEN)
#define MyTimer_Base_Stop(Tim) (Tim.Timer->CR1 &= ~TIM_CR1_CEN)
#endif