IOPin correction: external state is only applied if the pin is an input