Add ScrollDirection class for the Pimoroni Trackball

Signed-off-by: Salvatore La Bua <slabua@gmail.com>
This commit is contained in:
Salvatore La Bua
2022-07-22 09:22:58 +09:00
committed by xs5871
parent f674ac6b13
commit 5ba865e4c6
2 changed files with 12 additions and 5 deletions

View File

@@ -25,15 +25,15 @@ If you have used this thing on a mobile device, you will know it excels at curso
```python
from kmk.modules.pimoroni_trackball import Trackball, TrackballMode, PointingHandler, KeyHandler, ScrollHandler
from kmk.modules.pimoroni_trackball import Trackball, TrackballMode, PointingHandler, KeyHandler, ScrollHandler, ScrollDirection
trackball = Trackball(i2c, mode=TrackballMode.MOUSE_MODE, handlers=[
# act like an encoder, input arrow keys
KeyHandler(KC.UP, KC.RIGHT, KC.DOWN, KC.LEFT, KC.ENTER),
# on layer 1 and above use the default pointing behavior
PointingHandler(),
# use scrolling='natural' (default) or 'reverse' to change the scrolling direction
ScrollHandler(scrolling='natural')
# use scrolling=ScrollDirection.NATURAL (default) or REVERSE to change the scrolling direction
ScrollHandler(scrolling=ScrollDirection.NATURAL)
])
# now you can use these KeyCodes: