makerdiary / python-keyboard

A hand-wired USB & Bluetooth keyboard powered by Python and more
https://makerdiary.com/m60
MIT License
486 stars 61 forks source link

TAP Key Delay #6

Closed mehalter closed 4 years ago

mehalter commented 4 years ago

What is the current tap key delay? Would it be possible to add a feature to adjust this time?

xiongyihui commented 4 years ago

The max delay is 500 milliseconds. However, the tap key will be activated quicker when another key is pressed afterwards. The implementation is at https://github.com/makerdiary/python-keyboard/blob/ed762e7ffd25137e41697f5afbda35af017b9577/keyboard/__init__.py#L85-L102

It is a good idea to add an option to adjust the time. Maybe move is_tapped into Keyboard class and use a property as the delay.

mehalter commented 4 years ago

Yeah I can give this a shot an open a PR! Would love to contribute. Is there documentation on setting up a development environment to test it the code on the board?

xiongyihui commented 4 years ago

Setting up a dev environment is easy:

  1. copy keyboard directory of this repo to lib folder of the CIRCUITPY USB drive.
  2. replace from PYKB import * with from keyboard import * in the code.py of the USB drive.

PYKB is a frozen version of keyboard and is compiled into the CircuitPython firmware. adafruit_ble is also compiled into the firmware.

mehalter commented 4 years ago

This has been addressed with #7 along with being able to adjust pair key delay as well