|
Re: Using a GPIO pin for both input and output.
We don't have a spare cRIO so I'm not doing any coding now. Often I2C is a special hardware module in the microcontroller and that module takes care of the I2C data line direction. Also, I2C data and clock are open drain connections.
For our robot, it would be great to have a direction controllable pin. Call it whatever, maybe DigitalPin, with a method to control the pin drive mode.
Get() to read the pin.
Set() to set the pin. (the pin needs to be set to drive for the pin to change).
DriveMode() to drive or float the pin.
If there is no FPGA constraint to changing drive mode at run time, the DigitalInput and DigitalOutput classes could be obsoleted by DigitalPin.
|