add GPIO interrupt Handler

This commit is contained in:
Sanyog Nevase Nevase 2024-09-22 20:26:32 +05:30
parent e10fba555b
commit 34d0ad34a2
1 changed files with 21 additions and 0 deletions

View File

@ -67,3 +67,24 @@ void SystickHandler(void)
} }
} }
void GPIOF_interruptHandler(void)
{
delay(200000); // Debounce delay
if (GPIO_PORTF_RIS_R & 0x01) // Check if PF0 caused the interrupt (Switch 1)
{
duty += 5; // Increase duty cycle
if (duty > 100) duty = 100; // Limit to max 100%
GPIO_PORTF_ICR_R = 0x01; // Clear interrupt flag for PF0
// systick_setting();
}
if (GPIO_PORTF_RIS_R & 0x10)
{ // Check if PF0 caused the interrupt (Switch 1)
duty -= 5; // Increase duty cycle
if (duty < 0) duty = 0; // Limit to max 100%
GPIO_PORTF_ICR_R = 0x10; // Clear interrupt flag for PF0
//systick_setting();
}
systick_setting();
}