add comments
This commit is contained in:
parent
896914490e
commit
7169a51106
14
main.c
14
main.c
|
@ -1,3 +1,9 @@
|
||||||
|
/*
|
||||||
|
Problem Statement:
|
||||||
|
Write a program where the press of a switch is detected by a GPIO interrupt. On each button press the interrupt handler should toggle the state of RED LED.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "tm4c123gh6pm.h"
|
#include "tm4c123gh6pm.h"
|
||||||
|
@ -18,10 +24,10 @@ void GPIO_PORT_F_init(void)
|
||||||
GPIO_PORTF_PUR_R = 0x11; // PORTF PF0 and PF4 IS PULLED UP
|
GPIO_PORTF_PUR_R = 0x11; // PORTF PF0 and PF4 IS PULLED UP
|
||||||
|
|
||||||
NVIC_EN0_R |= 1 << 30;
|
NVIC_EN0_R |= 1 << 30;
|
||||||
GPIO_PORTF_IS_R = 0x00; // Make it edge-sensitive
|
GPIO_PORTF_IS_R = 0x00; // INTERRUPT SENSE EDGE SENSITIVE
|
||||||
GPIO_PORTF_IBE_R = 0x00; // Trigger on one edge
|
GPIO_PORTF_IBE_R = 0x00; // INTERRUPT GENERATION IS CONTROLLED BY THE GPIO INTERRUPT EVENT
|
||||||
GPIO_PORTF_IEV_R = 0x00; // Falling edge event
|
GPIO_PORTF_IEV_R = 0x00; // INTERRUPT EVENT FALLING EDGE
|
||||||
GPIO_PORTF_IM_R |= 0x11; // Unmask interrupts for PF0 and PF4
|
GPIO_PORTF_IM_R |= 0x11; // INTERRUPT MASK ENABLE FOR SWITCH1 AND SWITCH2
|
||||||
}
|
}
|
||||||
void systick_setting(void) // SYSTICK SETUP FUNCTION
|
void systick_setting(void) // SYSTICK SETUP FUNCTION
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue