TP_Voilier/Drivers/MyTimer.h
2022-10-21 16:06:44 +02:00

44 lines
1.2 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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 dune structure (son adresse) contenant les
informations de base
* @Note -> Fonction à lancer systématiquement avant daller 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