Allow pin overrides on splits

This commit is contained in:
Kyle Brown
2020-11-13 23:20:41 -08:00
parent 999a9507b5
commit 659201439f
3 changed files with 10 additions and 4 deletions

View File

@@ -9,7 +9,7 @@ to syncronize the halves allowing additional features in some extentions.
from kb import data_pin from kb import data_pin
:from kmk.modules.split import Split, SplitType :from kmk.modules.split import Split, SplitType
split = Split(split_type=Split.UART, data_pin=data_pin, split_side=SplitSide.LEFT) split = Split(split_side=SplitSide.LEFT)
keyboard.modules.append(split) keyboard.modules.append(split)
``` ```
@@ -54,8 +54,10 @@ longer than 11 characters. Instructions on how to do that are
[here](https://learn.adafruit.com/welcome-to-circuitpython/the-circuitpy-drive). [here](https://learn.adafruit.com/welcome-to-circuitpython/the-circuitpy-drive).
For example on NYQUISTL for left and NYQUISTR for the right. For example on NYQUISTL for left and NYQUISTR for the right.
For wired connections you are done. For bluetooth, remove the `split_side` like this For wired connections you don't need to pass anything. For bluetooth, remove the `split_side` like this
```python ```python
split = Split(split_type=Split.UART, data_pin=data_pin) # Wired
split = Split()
# Wireless
split = Split(split_type=Split.BLE) split = Split(split_type=Split.BLE)
``` ```

View File

@@ -89,6 +89,10 @@ class Split(Module):
name = str(getmount('/').label) name = str(getmount('/').label)
if self.split_type == SplitType.BLE: if self.split_type == SplitType.BLE:
self._ble.name = name self._ble.name = name
else:
# Try to guess data pins if not supplied
if not self.data_pin:
self.data_pin = keyboard.data_pin
# Detect split side from name # Detect split side from name
if self.split_side is None: if self.split_side is None:

View File

@@ -16,7 +16,7 @@ keyboard.tap_time = 150
layers = Layers() layers = Layers()
modtap = ModTap() modtap = ModTap()
rgb_ext = RGB(pixel_pin=keyboard.rgb_pixel_pin, num_pixels=27, val_limit=100, hue_default=190, sat_default=100, val_default=5) rgb_ext = RGB(pixel_pin=keyboard.rgb_pixel_pin, num_pixels=27, val_limit=100, hue_default=190, sat_default=100, val_default=5)
split = Split(data_pin=keyboard.data_pin) split = Split()
keyboard.modules = [modtap, layers, split] keyboard.modules = [modtap, layers, split]
keyboard.extensions = [rgb_ext] keyboard.extensions = [rgb_ext]