2007-12-09 01:15 AM
Configuration and reconfiguration of GPIO
2007-12-08 08:36 PM
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? -Daniel2007-12-09 01:15 AM
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); }