parent
cd828e7048
commit
6779a04d69
25
main.c
25
main.c
|
@ -23,3 +23,28 @@ void UART1_WRITE(char data)
|
||||||
while (UART1_FR_R & 0x20); // Wait until TX FIFO is not full
|
while (UART1_FR_R & 0x20); // Wait until TX FIFO is not full
|
||||||
UART1_DR_R = data; // Write data to UART data register
|
UART1_DR_R = data; // Write data to UART data register
|
||||||
}
|
}
|
||||||
|
void GPIOF_interruptHandler(void) // Interrupt handler for GPIO Port F
|
||||||
|
{
|
||||||
|
//delay(200000); // Debounce delay
|
||||||
|
// Check PF4 (Switch 2)
|
||||||
|
if (GPIO_PORTF_RIS_R & 0x10) // Check if PF4 caused the interrupt
|
||||||
|
{
|
||||||
|
//GPIO_PORTF_DATA_R |= 0x02; // Toggle RED LED (PF1)
|
||||||
|
//delay(500000);
|
||||||
|
UART1_WRITE(0xF0);
|
||||||
|
STATUS_LED(UART1_READ());
|
||||||
|
//GPIO_PORTF_DATA_R = 0x00; // Toggle RED LED (PF1)
|
||||||
|
GPIO_PORTF_ICR_R = 0x10; // Clear interrupt flag for PF4
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check PF0 (Switch 1)
|
||||||
|
if (GPIO_PORTF_RIS_R & 0x01) // Check if PF0 caused the interrupt
|
||||||
|
{
|
||||||
|
//GPIO_PORTF_DATA_R |= 0x04; // Toggle RED LED (PF1)
|
||||||
|
//delay(500000);
|
||||||
|
UART1_WRITE(0xAA);
|
||||||
|
//GPIO_PORTF_DATA_R = 0x00;
|
||||||
|
STATUS_LED(UART1_READ());
|
||||||
|
GPIO_PORTF_ICR_R = 0x01; // Clear interrupt flag for PF0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue