I am a beginner and learning program on my own. i was trying to configure my pin F4 as input. the code i am using is given below
#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_memmap.h"
#include "inc/hw_gpio.h"
#include "inc/hw_types.h"
#include "driverlib/gpio.h"
#include "driverlib/sysctl.h"
void PortF_Init(void)
{
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
HWREG(GPIO_PORTF_BASE+GPIO_O_LOCK)=GPIO_LOCK_KEY;
HWREG(GPIO_PORTF_BASE+GPIO_O_CR) = 0x01;
HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = 0;
GPIODirModeSet(GPIO_PORTF_BASE,GPIO_PIN_2,GPIO_DIR_MODE_OUT);
GPIOPadConfigSet(GPIO_PORTF_BASE,GPIO_PIN_2,GPIO_STRENGTH_2MA,GPIO_PIN_TYPE_STD);
GPIODirModeSet(GPIO_PORTF_BASE,GPIO_PIN_0,GPIO_DIR_MODE_IN);
GPIOPadConfigSet(GPIO_PORTF_BASE,GPIO_PIN_0,GPIO_STRENGTH_4MA,GPIO_PIN_TYPE_STD_WPU);
}
int main()
{
uint32_t status;
PortF_Init();
while(1)
{
status=GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_4);
if(status)
{
GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_2,0x0);
}
else
GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_2,0x4);
}
}
there are apparently no errors but the button is irresponsive to any change. this program just however turn on the LED. i appreciate any help.