PORT F initialization for LED indication

This commit is contained in:
Sanyog Nevase Nevase 2024-11-07 13:15:34 +05:30
parent 2c6e393ac8
commit 1a6248ef11
1 changed files with 19 additions and 6 deletions

25
main.c
View File

@ -1,9 +1,22 @@
#include <stdint.h>
#include <stdbool.h>
#include "tm4c123gh6pm.h"
/**
* main.c
*/
int main(void)
void GPIO_PORT_F_init(void)
{
return 0;
SYSCTL_RCGC2_R |= 0x00000020; // ENABLE CLOCK TO GPIOF
GPIO_PORTF_LOCK_R = 0x4C4F434B; // UNLOCK COMMIT REGISTER
GPIO_PORTF_CR_R = 0x1F; // MAKE PORTF0 CONFIGURABLE
GPIO_PORTF_DEN_R = 0x1F; // SET PORTF DIGITAL ENABLE
GPIO_PORTF_DIR_R = 0x0E; // SET PF0, PF4 as input and PF1, PF2 and PF3 as output
GPIO_PORTF_PUR_R = 0x11; // PORTF PF0 and PF4 IS PULLED UP
NVIC_EN0_R |= 1 << 30;
GPIO_PORTF_IS_R = 0x00; // EDGE SENSITIVE
GPIO_PORTF_IBE_R = 0x00; // ONE EDGE
GPIO_PORTF_IEV_R = 0x00; // INTERRUPT EVENT FALLING
GPIO_PORTF_IM_R |= 0x11; // UNMASK INTERRUPT
}