add GPIOF interrupt handler
This commit is contained in:
		
							parent
							
								
									4fd7019fd3
								
							
						
					
					
						commit
						fa41ddb977
					
				
							
								
								
									
										16
									
								
								main.c
								
								
								
								
							
							
						
						
									
										16
									
								
								main.c
								
								
								
								
							| 
						 | 
				
			
			@ -38,3 +38,19 @@ void delay(int us)                              //DEFINING DELAY FUNCTION
 | 
			
		|||
    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
 | 
			
		||||
{
 | 
			
		||||
    delay(200000);                           // DEBOUNCE DELAY
 | 
			
		||||
    if (GPIO_PORTF_RIS_R & 0x10)             // CHECK IF SWITCH 1 CAUSED INTERRUPT
 | 
			
		||||
    {
 | 
			
		||||
        GPIO_PORTF_DATA_R ^= 0x02;           // TOGGLE RED LED
 | 
			
		||||
        GPIO_PORTF_ICR_R = 0x10;             // CLEAR INTERRUPT FLAG FOR SWITCH 1
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (GPIO_PORTF_RIS_R & 0x01)             // CHECK IF SWITCH 2 CAUSED INTERRUPT
 | 
			
		||||
    {
 | 
			
		||||
        GPIO_PORTF_DATA_R ^= 0x02;           // TOGGLE RED LED
 | 
			
		||||
        GPIO_PORTF_ICR_R = 0x01;             // CLEAR INTERRUPT FLAG FOR SWITCH 1
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue