brettmclean / pad4pi

Interrupt-based matrix keypad library for Raspberry Pi
GNU Lesser General Public License v3.0
51 stars 19 forks source link

Add key repeat #4

Closed antogg closed 6 years ago

antogg commented 6 years ago

Add support for key repeat using threading.Timer. Additional arguments to constructor:

key_delay may conflict with repeat_delay. Set key_delay to less than 1/repeat_rate * 1000 to avoid conflict.

antogg commented 6 years ago

I forgot to mention that I added test code at the bottom, specific to my test environment. I'm using RasPI3 running Raspbian Stretch with a 4x5 keypad.

Also, setting repeat_delay or repeat_rate is sufficient to enable key repeat (no need to also set repeat=True)

brettmclean commented 6 years ago

Thanks for the contribution @antogg. I've released your changes to PyPI as pad4pi 1.1.3.