Small pimoroni_trackball.py refactors
This commit is contained in:
@@ -10,20 +10,15 @@ Declare I2C bus and add this module in your main class.
|
||||
|
||||
```python
|
||||
from kmk.modules.pimoroni_trackball import Trackball, TrackballMode
|
||||
import bitbangio as io
|
||||
|
||||
i2c = io.I2C(scl=board.D3, sda=board.D2)
|
||||
trackball = Trackball(i2c, mode=TrackballMode.MOUSE_MODE)
|
||||
```
|
||||
|
||||
Theoretically, it should work with normal IO library, but I encountered some issues on my RP2040 board.
|
||||
|
||||
```python
|
||||
import busio as io
|
||||
|
||||
i2c = io.I2C(scl=board.D3, sda=board.D2)
|
||||
trackball = Trackball(i2c, mode=TrackballMode.MOUSE_MODE)
|
||||
keyboard.modules.append(trackball)
|
||||
```
|
||||
|
||||
Module will also work when you cannot use `busio` and do `import bitbangio as io` instead.
|
||||
|
||||
Setup backlight color using below commands:
|
||||
|
||||
```python
|
||||
@@ -34,4 +29,5 @@ trackball.set_blue(brightness)
|
||||
trackball.set_white(brightness)
|
||||
```
|
||||
|
||||
This module exposes one keycode `TB_MODE`, which on hold switches between `MOUSE_MODE` and `SCROLL_MODE`.
|
||||
This module exposes one keycode `TB_MODE`, which on hold switches between `MOUSE_MODE` and `SCROLL_MODE`.
|
||||
To choose the default mode, pass it in `Trackball` constructor.
|
Reference in New Issue
Block a user