What is the statement to toggle an output pin ? I know how to set a pin high and set a pin low but don't see how a toggle would work. I have seen where the ~ is used to flip the bit on the port. Is there a trick like that that can be used or must you do it the old fashion way ?? Using LM3S811 EVB.
Thanks
Post edited by: ringram2077, at: 2006/12/24 08:16
login or register to reply
ringram2077
Expert Boarder
2006/12/24 09:51
Re:How to toggle GPIO pin ?
This works and is pretty simple I suppose:
Code:
if(GPIOPinRead(GPIO_PORTC_BASE, Status_LED)) //toggle led
GPIOPinWrite(GPIO_PORTC_BASE, Status_LED, 0); //set to zero
else
GPIOPinWrite(GPIO_PORTC_BASE, Status_LED, Status_LED);//set to one
login or register to reply
orinem
Expert Boarder
2006/12/24 13:57
Re:How to toggle GPIO pin ?
If you want to avoid the if, the following should do the trick: