I was wondering, is there any good reason to define input/output pin using PinMode() outside of Setup()? Does it make sense on a useful way? I cannot figure a good reason of wanting to change a pin direction or capability for a given hardware configuration except at startup.
pinMode() is used to implement a "virtual open-collector" output mode. Given that the pin is written LOW - and not changed - then setting it as INPUT gives the open-collector logic HIGH where there is a pull-up provided and setting it as OUTPUT pulls it LOW against the pull-up.
OneWire and similar protocols (like the DHT sensors) will also require switching input/output, as does the SDA line of I2C (that'll be the open collector trick as mentioned in #4).
That gives me a lot to explore, thanks a lot for answering my question guys!
For those interested I asked because I am coding a (very small) x86 flavoured CPU emulator for arduino to be able to execute simple assembly programs uploaded on the fly, and I was wondering if providing an access to PinMode within the assembly language was useful. I guess I have my answer