44 lines
1.2 KiB
C
44 lines
1.2 KiB
C
#ifndef __MYTIMER_H
|
||
#define __MYTIMER_H
|
||
#include "stm32f10x.h"
|
||
|
||
typedef struct
|
||
{
|
||
TIM_TypeDef * Timer ; // TIM1 à TIM4
|
||
unsigned short ARR ;
|
||
unsigned short PSC ;
|
||
} MyTimer_Struct_TypeDef ;
|
||
|
||
/*
|
||
*****************************************************************************************
|
||
* @brief
|
||
* @param -> Paramètre sous forme d’une structure (son adresse) contenant les
|
||
informations de base
|
||
* @Note -> Fonction à lancer systématiquement avant d’aller plus en détail dans les
|
||
conf plus fines (PWM, codeur inc ...)
|
||
*************************************************************************************************
|
||
*/
|
||
|
||
|
||
void MyTimer_Base_Init (MyTimer_Struct_TypeDef* Data) ;
|
||
|
||
void MyTimer_Base_Start(TIM_TypeDef * Timer );
|
||
void MyTimer_Base_Stop(TIM_TypeDef * Timer );
|
||
|
||
void MyTimer_ActiveIT (TIM_TypeDef * Timer, char Prio, void (* IT_function) (void));
|
||
|
||
void MyTimer_PWM(TIM_TypeDef * Timer, char Channel);
|
||
/**
|
||
* alpha = CRR/ARR, use Get_Max_Duty(Timer) to get ARR
|
||
*/
|
||
void Set_Duty_Cycle(TIM_TypeDef * Timer , char Channel,uint16_t crr);
|
||
|
||
/**
|
||
* Returns ARR
|
||
*/
|
||
uint16_t Get_Max_Duty(TIM_TypeDef * Timer);
|
||
|
||
|
||
void Set_PWM_PRCT(TIM_TypeDef * Timer, char Channel, int percent);
|
||
|
||
#endif
|