TP_Voilier/FileInclude/MyTimer.h
Newg b0ee0b6acd Merge remote-tracking branch 'origin/Telecommande-Plateau'
# Conflicts:
#	FileInclude/MyTimer.c
#	FileInclude/MyTimer.h
#	Objects/main.crf
#	Objects/main.d
#	Objects/main.o
#	Projet1.uvoptx
#	Projet1.uvprojx
2022-11-14 18:34:28 +01:00

46 lines
1.2 KiB
C
Raw Blame History

#ifndef __MYTIMER_H
#define __MYTIMER_H
#include "stm32f10x.h"
typedef struct
{
TIM_TypeDef * Timer ; // TIM1 <20> TIM4
unsigned short ARR ;
unsigned short PSC ;
} MyTimer_Struct_TypeDef ;
/*
*****************************************************************************************
* @brief
* @param -> Param<61>tre sous forme d<>une structure (son adresse) contenant les
informations de base
* @Note -> Fonction <20> lancer syst<73>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);
uint16_t Get_Timer_Count(TIM_TypeDef * Timer);
#endif