45 lines
840 B
C
45 lines
840 B
C
#include "MySysTick.h"
|
|
|
|
#include "stm32f1xx_ll_bus.h" // Pour l'activation des horloges
|
|
#include "stm32f1xx_ll_cortex.h"
|
|
|
|
|
|
void (*Ptr_ItFct_SysTick)(void);
|
|
|
|
void MySysTick_Conf(uint32_t ticks) {
|
|
|
|
//Configuration de la période
|
|
SysTick_Config(ticks);
|
|
|
|
//Désactivation des IT (à rétablir ensuite)
|
|
MySysTick_IT_Disable();
|
|
|
|
}
|
|
|
|
void MySysTick_IT_Conf (void (*IT_function)(void), int Prio) {
|
|
|
|
//Affectation de la fonction du handler
|
|
Ptr_ItFct_SysTick = IT_function;
|
|
|
|
//Désactivation des IT
|
|
LL_SYSTICK_DisableIT();
|
|
|
|
//Configuration du NVIC
|
|
NVIC_SetPriority(SysTick_IRQn, Prio);
|
|
NVIC_EnableIRQ(SysTick_IRQn);
|
|
|
|
}
|
|
|
|
void MySysTick_IT_Enable (void) {
|
|
LL_SYSTICK_EnableIT();
|
|
}
|
|
|
|
void MySysTick_IT_Disable (void) {
|
|
LL_SYSTICK_DisableIT();
|
|
}
|
|
|
|
/*========Handler d'IT==========*/
|
|
|
|
void SysTick_Handler (void) {
|
|
(*Ptr_ItFct_SysTick)();
|
|
}
|