Commit aaa5def9 authored by Matthias Wenzl's avatar Matthias Wenzl
Browse files

fixed gpiopadconfig parameter bug and gpio init ordering bug

GPIOPadConfigGet() requires pin number as second parameter instead of
bit packed representation

Reordered GPIOPadConfig*() and GPIOPinTypeOutput() to let GPIOPadConfig*
() take effect
parent 908898c1
......@@ -34,13 +34,14 @@ void main (void) {
/*activate gpio port n*/
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION);
/*configure GPIO_PIN_1 on port N as std pin*/
GPIOPadConfigGet(GPIO_PORTN_BASE, GPIO_PIN_1, &ui32Strength, &ui32PinType);
GPIOPadConfigSet(GPIO_PORTN_BASE, GPIO_PIN_1,ui32Strength,GPIO_PIN_TYPE_STD);
/*set pin 1 of gpio port n to output*/
GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE,GPIO_PIN_1);
/*configure GPIO_PIN_1 on port N as std pin*/
GPIOPadConfigGet(GPIO_PORTN_BASE, 1/*api requires pin number [0-7] instead of bit packed representation (e.g., GPIO_PIN_1 )*/, &ui32Strength, &ui32PinType);
GPIOPadConfigSet(GPIO_PORTN_BASE, GPIO_PIN_1,ui32Strength,GPIO_PIN_TYPE_STD);
for(;;) {
ui8val = ui8val ^ 2;/*toggle bit 1 in variable val*/
/*write value of val to pin 1 of port n*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment