Add Status LED

This commit is contained in:
Sanyog Nevase Nevase 2024-10-10 20:16:49 +05:30
parent 0b3acf37aa
commit 73455674fa
1 changed files with 21 additions and 0 deletions

21
main.c
View File

@ -75,7 +75,27 @@ void delay(int us) //DEFINING DELAY FUNCTION
STCTRL &= 0x0; // Stop the timer
}
void STATUS_LED(char received_data)
{
if (received_data == 0xAA)
{
GPIO_PORTF_DATA_R |= 0x08; // Turn on Green LED (PF3)
GPIO_PORTF_DATA_R &= ~0x04; // Turn off Blue LED (PF2)
}
else if (received_data == 0xF0)
{
GPIO_PORTF_DATA_R |= 0x04; // Turn on Blue LED (PF2)
GPIO_PORTF_DATA_R &= ~0x08; // Turn off Green LED (PF3)
}
else
{
GPIO_PORTF_DATA_R |= 0x02;
}
//delay(500000);
//GPIO_PORTF_DATA_R &= 0x00; // Turn on Green LED (PF3)
}
void GPIOF_interruptHandler(void) // Interrupt handler for GPIO Port F
@ -110,6 +130,7 @@ int main(void) // MAIN FUNCTION
systick_setting(); // SYSTICK SETUP
while (1)
{
STATUS_LED(UART1_READ());
}
}