diff --git a/Group21_Lab06_Task1/main.c b/Group21_Lab06_Task1/main.c index e6e041e..90792b7 100644 --- a/Group21_Lab06_Task1/main.c +++ b/Group21_Lab06_Task1/main.c @@ -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(); +} +