Skip to main content
Visitor II
December 9, 2007
Question

Configuration and reconfiguration of GPIO

  • December 9, 2007
  • 2 replies
  • 651 views
Posted on December 09, 2007 at 10:15

Configuration and reconfiguration of GPIO

    This topic has been closed for replies.

    2 replies

    daniel7Author
    Visitor II
    December 9, 2007
    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

    daniel7Author
    Visitor II
    December 9, 2007
    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);

    }