Add comments
This commit is contained in:
parent
73455674fa
commit
b5e4501940
17
main.c
17
main.c
|
@ -55,9 +55,10 @@ char UART1_READ(void)
|
|||
#define STRELOAD *((volatile uint32_t *) 0xE000E014) // reload value
|
||||
#define STCURRENT *((volatile uint32_t *) 0xE000E018) // current value
|
||||
|
||||
#define CLOCK_HZ 16000000 // CLOCK FREQUENCY OF EK-TM4C123GXL
|
||||
#define CLOCK_HZ 16000000 // CLOCK FREQUENCY
|
||||
#define SYSTICK_RELOAD_VALUE(us) ((CLOCK_HZ / 1000000) * (us) - 1) // SYSTICK RELOAD VALUE
|
||||
|
||||
|
||||
void systick_setting(void) // SYSTICK SETUP FUNCTION
|
||||
{
|
||||
STRELOAD = SYSTICK_RELOAD_VALUE(1000); // RELOAD VALUE FOR 1ms
|
||||
|
@ -81,7 +82,6 @@ void STATUS_LED(char received_data)
|
|||
{
|
||||
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)
|
||||
{
|
||||
|
@ -92,37 +92,28 @@ void STATUS_LED(char received_data)
|
|||
{
|
||||
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
|
||||
{
|
||||
//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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main(void) // MAIN FUNCTION
|
||||
{
|
||||
GPIO_PORT_F_init(); // GPIO INITIALISATION FUNCTION
|
||||
|
|
Loading…
Reference in New Issue