cancel
Showing results for 
Search instead for 
Did you mean: 

Configuration and reconfiguration of GPIO

daniel7
Associate II
Posted on December 09, 2007 at 10:15

Configuration and reconfiguration of GPIO

2 REPLIES 2
daniel7
Associate II
Posted on December 09, 2007 at 05:36

Hi

I’m working on a project where I use the STR750 as the host when programming a powerline modem. I need the GPIO to be configured as output and then reconfigure it to be input because the modem sends back an acknowledge when receiving data and that happens on the same port. Should configuring and reconfiguring be possible in the same program?

-Daniel

daniel7
Associate II
Posted on December 09, 2007 at 10:15

My test code:

GPIO_InitTypeDef GPIO_InitStructureIn;

GPIO_InitTypeDef GPIO_InitStructureOut;

//Output

GPIO_InitStructureOut.GPIO_Mode = GPIO_Mode_Out_PP;

GPIO_InitStructureOut.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_4;

//Input

GPIO_InitStructureIn.GPIO_Mode = GPIO_Mode_IPD;

GPIO_InitStructureIn.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_4;

while(1){

//Output

GPIO_Init(GPIO2, &GPIO_InitStructureOut);

write(0xFF);

delay(10000);

//Input

GPIO_Init(GPIO2, &GPIO_InitStructureIn);

delay(10000);

}