Add delay function

This commit is contained in:
Sanyog Nevase Nevase 2024-10-10 20:13:18 +05:30
parent faf02b4cdd
commit 0b3acf37aa
1 changed files with 11 additions and 0 deletions

11
main.c
View File

@ -66,6 +66,17 @@ void systick_setting(void) // SYSTICK SETUP FUNCTION
} }
void delay(int us) //DEFINING DELAY FUNCTION
{
STRELOAD = SYSTICK_RELOAD_VALUE(us); // RELOAD VALUE FOR REQUIRED DELAY
STCURRENT = 0; // Clear STCURRENT
STCTRL |= (1 << 0) | (1 << 2); // Enable SysTick
while ((STCTRL & (1 << 16)) == 0); // Wait until flag is set
STCTRL &= 0x0; // Stop the timer
}
void GPIOF_interruptHandler(void) // Interrupt handler for GPIO Port F void GPIOF_interruptHandler(void) // Interrupt handler for GPIO Port F
{ {