26 lines
754 B
C
26 lines
754 B
C
#ifndef MYTIMER_H
|
|
#define MYTIMER_H
|
|
|
|
#include "stm32f10x.h"
|
|
|
|
typedef struct {
|
|
TIM_TypeDef * Timer ;
|
|
uint16_t ARR ;
|
|
uint16_t PSC ;
|
|
} MyTimer_Struct_TypeDef ;
|
|
|
|
void MyTimer_Base_Init(MyTimer_Struct_TypeDef * Timer) ;
|
|
void Activate_TIM(int) ;
|
|
void MyTimer_Active_IT ( TIM_TypeDef * , char , void (*) (void)) ;
|
|
void TIM1_TRG_COM_IRQHandler(void) ;
|
|
void TIM2_IRQHandler(void) ;
|
|
void TIM3_IRQHandler(void) ;
|
|
void TIM4_IRQHandler(void) ;
|
|
void MyTimer_PWM( TIM_TypeDef *, char) ;
|
|
void MyTimer_PWM_set_cycle(TIM_TypeDef *, float, char) ;
|
|
|
|
|
|
#define MyTimer_Base_Start(Timer) (Timer->CR1 |= 0x1)
|
|
#define MyTimer_Base_Stop(Timer) (Timer->CR1 &= ~0x1)
|
|
//#define MyTimer_PWM_set_cycle(Timer, prop, channel) (Timer->CCRchannel = (int) (Timer -> ARR * prop)
|
|
#endif
|