it is possible to change the Systick interrupt priority and the period of the interrupt, but this is not recommended because several drivers make use of the 1ms period of time
#include "bsp.h"
int main(void)
{
/*seed variable to track the last time we check the systick count*/
uint32_t tickstart;
/*Init library and the systick timer*/
HAL_Init();
/*set the new tick frequency to 10ms*/
HAL_SYSTICK_Config( SystemCoreClock / (1000u / HAL_TICK_FREQ_100HZ );
/*set priority to the lowest level*/
HAL_NVIC_SetPriority( SysTick_IRQn, 2u, 0u );
/*get the current tick for the first time*/
tickstart = HAL_GetTick();
while (1)
{
/* query if already pass 200ms (ticks) since we got the current tick value*/
if( (HAL_GetTick() - tickstart) >= 20 )
{
/*at this point 200ms has been elapsed and we need to take the current tick count again*/
tickstart = HAL_GetTick();
/*we do anything we want here and every 200ms */
}
}
}
ints.c
/*To track the tick count we need to call the function HAL_IncTick on the vector interrupt*/
void SysTick_Handler( void )
{
HAL_IncTick( );
}