Skip to content

Instantly share code, notes, and snippets.

@hocarm
Created November 1, 2017 12:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hocarm/542f2b884dc47fa44c6d5a904fc168ae to your computer and use it in GitHub Desktop.
Save hocarm/542f2b884dc47fa44c6d5a904fc168ae to your computer and use it in GitHub Desktop.
uint32_t counter_1ms;
void Delay_ns(__IO uint32_t nCount)
{
while(nCount--)
{
}
}
void Delay_us(__IO uint32_t nCount)
{
while(nCount--)
{
Delay_ns(35);
}
}
void __delay_ms(uint32_t ms)
{
counter_1ms = 0;
while(counter_1ms < ms);
}
void System_Init(void)
{
//cau hinh systick
SysTick_Config(SystemCoreClock/1000);
//cau hinh 1ms ngat 1 lan
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment