Add Status LED
This commit is contained in:
parent
0b3acf37aa
commit
73455674fa
21
main.c
21
main.c
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue