You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
2.0 KiB

1 year ago
//#############################################################################################################################################################################################################
#include "SYSTEM.h"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
volatile uint32_t SystemSystickCounter;
uint32_t System_GetSysTick(void)
{
cli();
uint32_t SystemSysTick_Temp = SystemSystickCounter;
sei();
return SystemSysTick_Temp;
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
uint32_t HAL_GetTick(void) // redefine _weak HAL function For HAL Inits
{
cli();
uint32_t SystemSysTick_Temp = SystemSystickCounter;
sei();
return SystemSysTick_Temp;
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
uint32_t System_GetSysTickDifference(uint32_t TimeInstance)
{
cli();
uint32_t SystemSysTick_Temp = SystemSystickCounter;
sei();
if (TimeInstance<=SystemSysTick_Temp ) { return (uint32_t)(SystemSysTick_Temp-TimeInstance); }
else { return (uint32_t)(0xFFFFFFFF-TimeInstance+SystemSysTick_Temp); }
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
void System_SWReboot(void){
cli();
wdt_enable(WDTO_15MS);
while(1); //Dumb reset
}
//#############################################################################################################################################################################################################