http://mbed.org/users/AjK/code/DebounceIn/#91a2e988ba9d