I’m working on a driver for a dual motor control board. This board has an enable line, I would like to be able to share the enable line between multiple driver board. There is no problem electrically with that but there is a configuration problem.
It would be best to be able to pass the pin used for the enable signal and have the driver figure out if that pin has already been configured as an OutputPort. If the pin is already an output port than the driver instance would only need to keep a reference to the OutputPort object.
So far I have not been able to find a way to do this.
I could always kludge it by creating a static ArrayList of the pins passed for use as Enable and the corresponding objects but that seems like poor style. I settled on creating a second constructor that takes an OuputPort object instead of just the Cpu.Pin. That is not ideal though as it requires the uses of the driver to know how the OutputPort should be configured (high or low).