Projet_voilier2/Drivers/Inc/TIMER.h
2023-03-22 14:27:07 +01:00

36 lines
1.2 KiB
C
Raw 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 * Timer);
/*
*****************************************************************************************
* @brief
* @param -> - TIM_TypeDef * Timer : Timer concerne
- char Prio : de 0 a 15
* @Note -> La fonction MyTimer_Base_Init doit avoir ete lancee au prealable
*************************************************************************************************
*/
void MyTimer_ActiveIT (TIM_TypeDef * Timer, char Prio, void (*IT_function)(void));
#define MyTimer_Base_Start(Timer) (Timer->CR1 |= 0x01)
#define MyTimer_Base_Stop(Timer) (Timer->CR1 &= ~0x01)
#endif