Yeah, proper button read requires output mode and IO data set to 1. This is explained in HRM.
Joystick and mouse button line is "floating" when not pressed, grounded when pressed. Output mode with data=1 simulates pullup resistor, pulling non-pressed logic state back to 1. (This is not dangerous, IO lines are designed for this) Without pullup button releases would not work.
Note that some 3rd party joypads and some mice have internal pullup resistor. They do work without output mode. This has caused lots of confusion..
|