From 0b3acf37aa5425922b78054b570c50d57024ec88 Mon Sep 17 00:00:00 2001 From: Sanyog Date: Thu, 10 Oct 2024 20:13:18 +0530 Subject: [PATCH] Add delay function --- main.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/main.c b/main.c index 191f656..b20c266 100644 --- a/main.c +++ b/main.c @@ -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 {