Other Parts Discussed in Thread: EK-TM4C1294XL
Tool/software: Code Composer Studio
Hello,
My question might sound a little simple stupid:
How do I use the onboard user switches of my Tiva TM4C1294 Launchpad?
This are the lines from my Hardware setup regarding the switch (PJ1):
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOJ)
ROM_GPIOPinTypeGPIOInput(GPIO_PORTJ_AHB_BASE, GPIO_PIN_1);
and this is the code where I want to read the switches state:
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
buttonpressed = GPIOPinRead(GPIO_PORTJ_AHB_BASE, GPIO_PIN_1);
if(buttonpressed == 1){
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_0, 1);
}else{
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_0, 0);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
but it doesn´t work, the code reads from the PJ1 pin and not the switch
does anybody know how I get the state from the switch?
Thanks in advance!