add documentation

This commit is contained in:
xs5871 2022-04-16 20:26:30 +00:00 committed by Kyle Brown
parent 7ff77b97bb
commit f7dac9e96e

View File

@ -126,3 +126,25 @@ If you require a different type of scanner, you can create your own by
providing a subclass of `Scanner`. This is a very simple interface, it only
contains a single method, `scan_for_changes(self)` which returns a key report
if one exists, or `None` otherwise.
## Advanced Configuration
### Multiple Scanners
Sometimes a single scanner doesn't cover all hardware configurations. For
example: The bulk of the keyboard may be scanned with a matrix scanner, but a
couple of additional keys are directly connected to GPIOs.
In that case KMK allows you to define multiple scanners. The `KMKKeyboard.matrix` attribute can either be assigned a single scanner, or a list of scanners.
KMK assumes that successive scanner keys are consecutive, and populates
`KMKKeyboard.coord_mapping` accordingly; for convenience you may have to supply a `coord_mapping` that resembles your physical layout more closely.
Example:
```python
class MyKeyboard(KMKKeyboard):
self.matrix = [
MatrixScanner(...),
KeysScanner(...),
# etc...
]
```