requested changes
This commit is contained in:
@@ -17,10 +17,10 @@ Corne LP
|
||||
[Boardsource](https://boardsource.xyz/store/5f2efc462902de7151495057)
|
||||
|
||||
Extentions enabled by default
|
||||
- Layers
|
||||
- RGB
|
||||
- BLE_Split
|
||||
- [Layers](https://github.com/KMKfw/kmk_firmware/tree/master/docs/layers.md) Need more keys than switches? Use layers.
|
||||
- [RGB](https://github.com/KMKfw/kmk_firmware/tree/master/docs/rgb.md) Light it up
|
||||
- [BLE_Split](https://github.com/KMKfw/kmk_firmware/tree/master/docs/split.md) Connects halves without wires
|
||||
|
||||
Recommended Extentions
|
||||
- Split
|
||||
- Power
|
||||
Common Extentions
|
||||
- [Split](https://github.com/KMKfw/kmk_firmware/tree/master/docs/split.md) if using a wire to connect the halves
|
||||
- [Power](https://github.com/KMKfw/kmk_firmware/tree/master/docs/power.md) Powersaving features for battery life
|
||||
|
@@ -1,6 +1,5 @@
|
||||
import board
|
||||
|
||||
from kmk.extensions.layers import Layers
|
||||
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
from kmk.matrix import intify_coordinate as ic
|
||||
@@ -32,6 +31,3 @@ class KMKKeyboard(_KMKKeyboard):
|
||||
|
||||
# And now, to handle R3, which at this point is down to just six keys
|
||||
coord_mapping.extend(ic(3, x) for x in range(3, 9))
|
||||
|
||||
layers_ext = Layers()
|
||||
extensions = [layers_ext]
|
||||
|
@@ -1,5 +1,6 @@
|
||||
from kb import KMKKeyboard, rgb_pixel_pin
|
||||
from kmk.extensions.ble_split import BLE_Split
|
||||
from kmk.extensions.layers import Layers
|
||||
from kmk.extensions.rgb import RGB
|
||||
from kmk.keys import KC
|
||||
|
||||
@@ -22,15 +23,17 @@ RGB_VAI = KC.RGB_VAI
|
||||
RGB_VAD = KC.RGB_VAD
|
||||
|
||||
# Adding extentions
|
||||
rgb_ext = RGB(pixel_pin=rgb_pixel_pin, num_pixels=27, val_limit=100, hue_default=190, sat_default=100, val_default=5)
|
||||
rgb = RGB(pixel_pin=rgb_pixel_pin, num_pixels=27, val_limit=100, hue_default=190, sat_default=100, val_default=5)
|
||||
|
||||
# TODO Comment one of these on each side
|
||||
split_side = 'Left'
|
||||
split_side = 'Right'
|
||||
# Left is 0, Right is 1
|
||||
split_side = 0
|
||||
split_side = 1
|
||||
split = BLE_Split(split_side=split_side)
|
||||
|
||||
keyboard.extensions.append(split, rgb_ext)
|
||||
layers_ext = Layers()
|
||||
|
||||
extensions = [layers_ext, split, rgb]
|
||||
|
||||
keyboard.keymap = [
|
||||
[ #QWERTY
|
||||
|
@@ -1,29 +1,52 @@
|
||||
# Getting Started
|
||||
|
||||
## Microcontrollers
|
||||
KMK will run on most microcontrollers supported by [Circuitpython](https://circuitpython.org/downloads). Our recommended microcontrollers are found [here](Officially_Supported_Microcontrollers.md)
|
||||
KMK will run on most microcontrollers supported by
|
||||
[Circuitpython](https://circuitpython.org/downloads). Our recommended
|
||||
microcontrollers are found [here](Officially_Supported_Microcontrollers.md)
|
||||
|
||||
## Firmware
|
||||
### Circuitpython
|
||||
Circuitpython is what KMK will run on top of. Make sure that Circuitpython is installed on your
|
||||
device using the guide [here](https://learn.adafruit.com/welcome-to-circuitpython/installing-circuitpython).
|
||||
It's recommended to run the latest stable version that is at least 5.0 or higher. Beta versions may work, but expect limited support.
|
||||
## Firmware
|
||||
### KMKPython
|
||||
KMKPython is a fork of Circuitpython, but with libraries for most extensions
|
||||
built in. This saves you from having to get them all and keep them updated
|
||||
yourself. There may be other features added in the future that are exclusive to
|
||||
KMKPython. For the nice!nano, this is highly recommended, and used in place of
|
||||
Circuitpython.
|
||||
Notable differences include
|
||||
- Built in libraries for bluetooth, RGB, and more
|
||||
- Saves space as builds are optimized for keyboards
|
||||
- Microcontrollers like the nice!nano will be able to access all features out of
|
||||
the box.
|
||||
|
||||
### Circuitpython
|
||||
Circuitpython can be installed by following this guide using the guide
|
||||
[here](https://learn.adafruit.com/welcome-to-circuitpython/installing-circuitpython).
|
||||
It's recommended to run the latest stable version that is at least 5.0 or higher.
|
||||
Beta versions may work, but expect limited support.
|
||||
#### Notable differences include
|
||||
- Supports more devices
|
||||
- Less built in libraries. If using RGB, bluetooth, and more, you will have to
|
||||
add these libraries yourself
|
||||
- Some devices such as the nice!nano don't have much free space, so not all
|
||||
features can be installed at the same time
|
||||
|
||||
### KMKPython
|
||||
KMKPython is a fork of Circuitpython, but with libraries for most extensions built in. This saves you from having to get them all
|
||||
and keep them updated yourself. There may be other features added in the future that are exclusive to KMKPython.
|
||||
|
||||
## Getting KMK
|
||||
You can always find the latest releases on our CDN, in [compiled and optimized](https://cdn.kmkfw.io/kmk-latest.zip) and
|
||||
[raw, hackable text file](https://cdn.kmkfw.io/kmk-latest.unoptimized.zip) forms. These follow the `master` branch here on GitHub.
|
||||
Just get the KMK folder and drop this directly in the CIRCUITPYTHON directory (not in a sub folder). Make sure to extract the zip,
|
||||
and put the `kmk` folder on the root of the CIRCUITPY drive on the microcontroller
|
||||
## Getting KMK
|
||||
You can always find the latest releases on our CDN, in
|
||||
[compiled and optimized](https://cdn.kmkfw.io/kmk-latest.zip) and
|
||||
[raw, hackable text file](https://cdn.kmkfw.io/kmk-latest.unoptimized.zip)
|
||||
forms. These follow the `master` branch here on GitHub. Just get the KMK folder
|
||||
and drop this directly in the CIRCUITPYTHON directory (not in a sub folder).
|
||||
Make sure to extract the zip, and put the `kmk` folder on the root of the
|
||||
CIRCUITPY drive on the microcontroller
|
||||
|
||||
## Turning a controller into a keyboard
|
||||
### Supported keyboards
|
||||
If your keyboard and microcontroller are officially supported, it's as easy as visiting the page for your files, and dropping them
|
||||
on the root of the "flash drive". Those pages can be found [here](https://github.com/KMKfw/boards). You will need the `kb.py` and `main.py`. More advanced instructions
|
||||
can be found [here](config_and_keymap.md)
|
||||
If your keyboard and microcontroller are officially supported, simply visit the
|
||||
page for your files, and dropping them on the root of the "flash drive". Those
|
||||
pages can be found [here](https://github.com/KMKfw/boards). You will need the
|
||||
`kb.py` and `main.py`. More advanced instructions can be found
|
||||
[here](config_and_keymap.md). If using Curcuitpython and NOT KMKPython, you will
|
||||
also need [boot.py](https://github.com/KMKfw/kmk_firmware/blob/master/boot.py)
|
||||
|
||||
### Porting a keyboard
|
||||
If you are porting a board to KMK, check the page [here](porting_to_kmk.md).
|
||||
@@ -32,10 +55,17 @@ If you are porting a board to KMK, check the page [here](porting_to_kmk.md).
|
||||
If you are doing a hand wire, check [here](handwiring.md)
|
||||
|
||||
## Additional features
|
||||
Want to have fun features such as RGB, split keyboards and more? Check out what extensions can do [here](extensions.md)
|
||||
Want to have fun features such as RGB, split keyboards and more? Check out what
|
||||
extensions can do [here](extensions.md)
|
||||
|
||||
## Debugging
|
||||
Debugging help can be found [here](debugging.md)
|
||||
|
||||
## Additional help and support
|
||||
If you need support with KMK or just want to say hi, find us in [#kmkfw:klar.sh on Matrix](https://matrix.to/#/#kmkfw:klar.sh). This channel is bridged to Discord [here](https://discordapp.com/widget?id=493256121075761173&theme=dark) for convenience.
|
||||
If you need support with KMK or just want to say hi, find us in
|
||||
[#kmkfw:klar.sh on Matrix](https://matrix.to/#/#kmkfw:klar.sh). This channel is
|
||||
bridged to Discord [here](https://discordapp.com/widget?id=493256121075761173&theme=dark)
|
||||
for convenience. If you ask for help on chat or open a bug report, if possible
|
||||
please give us your commit SHA, found by running
|
||||
`from kmk.consts import KMK_RELEASE; print(KMK_RELEASE)` in the REPL on your
|
||||
controller.
|
||||
|
@@ -1,15 +1,17 @@
|
||||
# Officially supported microcontrollers
|
||||
While most Circuitpython devices are great for hand wired keyboards, most keyboards are designed to accept a pro micro. The boards listed below either are, or can be adapted to that pinout to use common keyboards already on the market.
|
||||
While most Circuitpython devices are great for hand wired keyboards, most
|
||||
keyboards are designed to accept a Pro Micro. The boards listed below either
|
||||
are, or can be adapted to that pinout to use common keyboards already on the market.
|
||||
|
||||
## Nice!Nano
|
||||
Features include
|
||||
- Pro-micro pinout
|
||||
- Pro Micro pinout
|
||||
- Both USB HID and Bluetooth support
|
||||
- Can do bluetooth split keyboards with no wires at all
|
||||
- Has battery support including charging
|
||||
|
||||
Downsides
|
||||
- \$25 USD per microcontroller at most retailers
|
||||
- $25 USD per microcontroller at most retailers
|
||||
|
||||
Recommended Retailers
|
||||
[Boardsource](https://boardsource.xyz/store/5f4a1733bbaa5c635b83ed67)
|
||||
@@ -17,11 +19,12 @@ Recommended Retailers
|
||||
|
||||
## ItsyBitsy M4 Express
|
||||
Features include
|
||||
- Affordable at \$15 USD
|
||||
- Affordable at $15 USD
|
||||
- Can run most features of KMK including RGB
|
||||
|
||||
Downsides
|
||||
- Needs adapted to work with pro-micro pinout keyboards. Adapter can be found [HERE](https://github.com/KMKfw/kmk_firmware/tree/master/hardware)
|
||||
- Needs adapted to work with Pro Micro pinout keyboards. Adapter can be found
|
||||
[HERE](https://github.com/KMKfw/kmk_firmware/tree/master/hardware)
|
||||
|
||||
Recommended Retailers
|
||||
[Adafruit](https://www.adafruit.com/product/3800)
|
||||
@@ -29,11 +32,13 @@ Recommended Retailers
|
||||
## Adafruit ItsyBitsy nRF52840 Express
|
||||
Features include
|
||||
- Both USB HID and Bluetooth support
|
||||
- More affordable than the Nice!Nano at only \$18
|
||||
- More affordable than the Nice!Nano at only $18
|
||||
|
||||
Downsides
|
||||
- Needs adapted to work with pro-micro pinout keyboards. Adapter can be found [HERE](https://github.com/KMKfw/kmk_firmware/tree/master/hardware)
|
||||
- No battery support without addon board found[HERE](https://www.adafruit.com/product/2124)
|
||||
- Needs adapted to work with Pro Micro pinout keyboards. Adapter can be found
|
||||
[HERE](https://github.com/KMKfw/kmk_firmware/tree/master/hardware)
|
||||
- No battery support without addon board found
|
||||
[HERE](https://www.adafruit.com/product/2124)
|
||||
|
||||
## Other microcontrollers
|
||||
What you'll need to have at minimum
|
||||
|
31
docs/ble_hid.md
Normal file
31
docs/ble_hid.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# BLE HID
|
||||
Bluetooth connections help clean up the wire mess!
|
||||
|
||||
## Circuitpython
|
||||
If not running KMKpython, this does require the adafruit_ble library from Adafruit.
|
||||
This can be downloaded
|
||||
[here](https://github.com/adafruit/Adafruit_CircuitPython_BLE/tree/master/adafruit_ble).
|
||||
It is part of the [Adafruit CircuitPython Bundle](https://github.com/adafruit/Adafruit_CircuitPython_Bundle).
|
||||
Simply put this in the "root" of your circuitpython device. If unsure, it's the folder with main.py in it, and should be the first folder you see when you open the device.
|
||||
|
||||
## Enabling BLE
|
||||
|
||||
To enable BLE hid, change the keyboard.go(). By default, the advertised name
|
||||
will be the name of the "flash drive". By default this is CIRCUITPY
|
||||
|
||||
```python
|
||||
if __name__ == '__main__':
|
||||
keyboard.go(hid_type=HIDModes.BLE)
|
||||
```
|
||||
|
||||
## Changing the advertisee name
|
||||
There are two ways to change the advertising name. The first would be to
|
||||
[change the name of the drive](https://learn.adafruit.com/welcome-to-circuitpython/the-circuitpy-drive).
|
||||
The second would be to change the keyboard.go() like this.
|
||||
|
||||
```python
|
||||
if __name__ == '__main__':
|
||||
keyboard.go(hid_type=HIDModes.BLE, ble_name='KMKeyboard')
|
||||
```
|
||||
|
||||
|
@@ -2,8 +2,8 @@
|
||||
|
||||
KMK is configured through a rather large plain-old-Python class called
|
||||
`KMKKeyboard`. Subclasses of this configuration exist which pre-fill defaults
|
||||
for various known keyboards (for example, many QMK keyboards are supported
|
||||
through our ItsyBitsy to ProMicro pinout adapter, or with a nice!nano).
|
||||
for various known keyboards (for example, many QMK, TMK, or ZMK keyboards
|
||||
are supported with a nice!nano, or through our ItsyBitsy to ProMicro pinout adapter.
|
||||
This class is the main interface between end users and the inner workings of KMK.
|
||||
Let's dive in!
|
||||
|
||||
@@ -79,6 +79,6 @@ You can further define a bunch of other stuff:
|
||||
console. This is very rarely needed, but can provide very valuable information
|
||||
if you need to open an issue.
|
||||
|
||||
- `beyboard.tap_time` which defines how long `KC.TT` and `KC.LT` will wait before
|
||||
considering a key "held" (see `keycodes.md`)
|
||||
- `keyboard.tap_time` which defines how long `KC.TT` and `KC.LT` will wait before
|
||||
considering a key "held" (see `layers.md`)
|
||||
|
||||
|
@@ -1,17 +1,21 @@
|
||||
# Extensions
|
||||
Extensions allow more features to be added ot KMK such as RGB, power saving and more. Extensions
|
||||
listed on this page are supported on KMK, though it's possible to add your own!
|
||||
Extensions allow more features to be added ot KMK such as RGB, power saving and
|
||||
more. Extensions listed on this page are supported by default on KMK, though
|
||||
it's possible to add your own!
|
||||
|
||||
## Core extensions
|
||||
These extensions are proveded in all builds and can be enabled. Currently offered extensions are
|
||||
These extensions are proveded in all builds and can be enabled. Currently offered
|
||||
xtensions are
|
||||
|
||||
- [BLE-Split](split_keyboards.md): Allows keyboards to be split in 2 with no wires
|
||||
- [International](international.md): Adds international keycodes
|
||||
- [Layers](layers.md): Adds layer support (Fn key) to allow many more keys to be put on your keyboard
|
||||
- [Layers](layers.md): Adds layer support (Fn key) to allow many more keys to be
|
||||
put on your keyboard
|
||||
- [LED](led.md): Adds backlight support. This is for monocolor backlight, not RGB
|
||||
- [MediaKeys](media_keys.md): Adds support for media keys such as volume
|
||||
- [ModTap](modtap.md): Adds support for augmented modifier keys to act as one key when tapped, and modifier
|
||||
when held.
|
||||
- [ModTap](modtap.md): Adds support for augmented modifier keys to act as one key
|
||||
when tapped, and modifier when held.
|
||||
- [Power](power.md): Power saving features. This is mostly useful when on battery power.
|
||||
- [RGB](rgb.md): RGB lighting for underglow. Will work on most matrix RGB as well treated the same as underglow.
|
||||
- [RGB](rgb.md): RGB lighting for underglow. Will work on most matrix RGB as well
|
||||
treated the same as underglow.
|
||||
- [Split](split_keyboards.md): This is for wired splits. Only use wired or wireless, not both.
|
||||
|
@@ -18,7 +18,7 @@ If you get permissions errors here, **don't run make as root or with sudo**. See
|
||||
`Troubleshooting` below.
|
||||
|
||||
```sh
|
||||
make MOUNTPOINT=/media/CIRCUITPY USER_KEYMAP=user_keymaps/nameofyourkeymap.py BOARD=board/nameofyourboar/kb.py
|
||||
make MOUNTPOINT=/media/CIRCUITPY USER_KEYMAP=user_keymaps/nameofyourkeymap.py BOARD=board/nameofyourboard/kb.py
|
||||
```
|
||||
|
||||
# Troubleshooting
|
||||
|
@@ -1,2 +1,6 @@
|
||||
# Handwire keyboards
|
||||
This guide will not talk about the physical wiring. Check out our [recommended microcontrollers](Offiially_Supported_Microcontrollers.md) and follow the amazing guide for that[here](https://docs.qmk.fm/#/hand_wire). That guide can be followed until you are setting up the firmware. After wiring the keyboard, you can refer to our porting guide [here](porting_to_kmk.md)
|
||||
This guide will not talk about the physical wiring. Check out our
|
||||
[recommended microcontrollers](Offiially_Supported_Microcontrollers.md) and
|
||||
follow the amazing guide for that[here](https://docs.qmk.fm/#/hand_wire). That
|
||||
guide can be followed until you are setting up the firmware. After wiring the
|
||||
keyboard, you can refer to our porting guide [here](porting_to_kmk.md)
|
||||
|
@@ -1,5 +1,6 @@
|
||||
# International Keycodes
|
||||
International extention adds keys for non US layouts. It can simply be added to the extentions list.
|
||||
International extention adds keys for non US layouts. It can simply be added to
|
||||
the extentions list.
|
||||
|
||||
```python
|
||||
from kmk.extensions.international import International
|
||||
|
@@ -1,5 +1,6 @@
|
||||
# Layers
|
||||
Layers extention adds keys for accessing other layers. It can simply be added to the extentions list.
|
||||
Layers extention adds keys for accessing other layers. It can simply be added to
|
||||
the extentions list.
|
||||
|
||||
```python
|
||||
from kmk.extensions.layers import Layers
|
||||
|
@@ -2,7 +2,9 @@
|
||||
Want your keyboard to shine? Add some lights!
|
||||
|
||||
## Enabling the extention
|
||||
The only required values that you need to give the LED extention would be the pixel pin, and the number of pixels/LED's. If using a split keyboard, this number is per side, and not the total of both sides.
|
||||
The only required values that you need to give the LED extention would be the
|
||||
pixel pin, and the number of pixels/LED's. If using a split keyboard, this number
|
||||
is per side, and not the total of both sides.
|
||||
```python
|
||||
from kmk.extensions.RGB import RGB
|
||||
from kb import led_pin # This can be imported or defined manually
|
||||
|
@@ -1,5 +1,6 @@
|
||||
# Media Keys
|
||||
Media keys extention adds keys for common media control keys. It can simply be added to the extentions list.
|
||||
Media keys extention adds keys for common media control keys. It can simply be
|
||||
added to the extentions list.
|
||||
|
||||
```python
|
||||
from kmk.extensions.media_keys import MediaKeys
|
||||
|
@@ -1,5 +1,6 @@
|
||||
# ModTap Keycodes
|
||||
Enabling ModTap will give you access to the following keycodes and can simply be added to the extentions list.
|
||||
Enabling ModTap will give you access to the following keycodes and can simply be
|
||||
added to the extentions list.
|
||||
|
||||
```python
|
||||
from kmk.extensions.modtap import ModTap
|
||||
|
@@ -15,7 +15,8 @@ class KMKKeyboard(_KMKKeyboard):
|
||||
```
|
||||
|
||||
## REQUIRED
|
||||
This is designed to be replaced with the defining pins of your keyboard. Rows, colums and the diode direction (if any), should be defined like this
|
||||
This is designed to be replaced with the defining pins of your keyboard. Rows,
|
||||
colums and the diode direction (if any), should be defined like this
|
||||
```python
|
||||
row_pins = [board.p0_31, board.p0_29, board.p0_02, board.p1_15]
|
||||
col_pins = [board.p0_22, board.p0_24, board.p1_00, board.p0_11, board.p1_04]
|
||||
@@ -23,10 +24,17 @@ This is designed to be replaced with the defining pins of your keyboard. Rows, c
|
||||
```
|
||||
|
||||
## Additional pins for extentions
|
||||
KMK includes built in extentions for RGB and split keyboards, and powersave. If these are applicible on your keyboard/microcontroller, the pins should be added here. Refer to the instructions on the respective extentions page on how to add them. If not adding any extentions, leave this as an empty list as shown.
|
||||
KMK includes built in extentions for RGB and split keyboards, and powersave. If
|
||||
these are applicible on your keyboard/microcontroller, the pins should be added
|
||||
here. Refer to the instructions on the respective extentions page on how to add
|
||||
them. If not adding any extentions, leave this as an empty list as shown.
|
||||
|
||||
# Coord mapping
|
||||
If your keyboard is not built electrically as a square (though most are), you can provide a mapping directly. An example of this is the[Corne](https://github.com/foostan/crkbd). That has 12 colums for 3 rows, and 6 colums for the bottom row. Split keyboards count as the total keyboard, not per side. That would look like this
|
||||
If your keyboard is not built electrically as a square (though most are), you can
|
||||
provide a mapping directly. An example of this is the
|
||||
[Corne](https://github.com/foostan/crkbd). That has 12 colums for 3 rows, and 6
|
||||
colums for the bottom row. Split keyboards count as the total keyboard, not per
|
||||
side. That would look like this
|
||||
```python
|
||||
from kmk.matrix import intify_coordinate as ic
|
||||
|
||||
@@ -40,7 +48,10 @@ from kmk.matrix import intify_coordinate as ic
|
||||
|
||||
|
||||
## Keymaps
|
||||
Keymaps are organized as a list of lists. Keycodes are added for every key on each layer. See [keycodes](keycodes.md) for more details on what keycodes are avaliable. If using layers or other extentions, also refer to the extentions page for additional keycodes.
|
||||
Keymaps are organized as a list of lists. Keycodes are added for every key on
|
||||
each layer. See [keycodes](keycodes.md) for more details on what keycodes are
|
||||
avaliable. If using layers or other extentions, also refer to the extentions
|
||||
page for additional keycodes.
|
||||
```python
|
||||
from kb import KMKKeyboard
|
||||
from kmk.keys import KC
|
||||
|
@@ -1,5 +1,6 @@
|
||||
# Power(save)
|
||||
This extention allows you to save power and is targeted to bluetooth/battery based keyboards.
|
||||
This extention allows you to save power and is targeted to bluetooth/battery
|
||||
based keyboards.
|
||||
|
||||
## Keycodes
|
||||
|Key |Description |
|
||||
@@ -20,8 +21,9 @@ keyboard.extensions.append(power)
|
||||
```
|
||||
|
||||
## Optional extra power saving
|
||||
On supported boards, such as the nice!nano, power can be cut on VCC saving extra power if OLEDS or RGBs are installed.
|
||||
These drain power even when off, so this will prevent them from doing it.
|
||||
On supported boards, such as the nice!nano, power can be cut on VCC saving extra
|
||||
power if OLEDS or RGBs are installed. These drain power even when off, so this
|
||||
will prevent them from doing so.
|
||||
|
||||
```python
|
||||
from kmk.extensions.power import Power
|
||||
@@ -35,5 +37,6 @@ keyboard.extensions.append(power)
|
||||
|
||||
```
|
||||
|
||||
Make sure that the pin is correct for your microcontroller. The example is for the nice!nano. Not all microcontrollers
|
||||
have this feature and this can be omitted if not and there will simply be less power saving.
|
||||
Make sure that the pin is correct for your microcontroller. The example is for
|
||||
the nice!nano. Not all microcontrollers have this feature and this can be omitted
|
||||
if not and there will simply be less power saving.
|
||||
|
@@ -1,8 +1,11 @@
|
||||
# RGB/Underglow/Neopixel
|
||||
Want your keyboard to shine? Add some lights!
|
||||
This does require the neopixel library from Adafruit. This can be downloaded [here](https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel/blob/6e35cd2b40575a20e2904b096508325cef4a71d3/neopixel.py).
|
||||
It is part of the [Adafruit CircuitPython Bundle](https://github.com/adafruit/Adafruit_CircuitPython_Bundle).
|
||||
|
||||
## Circuitpython
|
||||
If not running KMKpython, this does require the neopixel library from Adafruit.
|
||||
This can be downloaded
|
||||
[here](https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel/blob/6e35cd2b40575a20e2904b096508325cef4a71d3/neopixel.py).
|
||||
It is part of the [Adafruit CircuitPython Bundle](https://github.com/adafruit/Adafruit_CircuitPython_Bundle).
|
||||
Simply put this in the "root" of your circuitpython device. If unsure, it's the folder with main.py in it, and should be the first folder you see when you open the device.
|
||||
|
||||
Currently we support the following addressable LEDs:
|
||||
|
@@ -3,7 +3,8 @@ Split keyboards are mostly the same as unsplit. Wired UART and Bluetooth are sup
|
||||
|
||||
|
||||
## Wired UART
|
||||
Wired connections can use UART over 1 or 2 wires. With 2 wires, you will be able to syncronize the halves allowing additional features in some extentions.
|
||||
Wired connections can use UART over 1 or 2 wires. With 2 wires, you will be able
|
||||
to syncronize the halves allowing additional features in some extentions.
|
||||
```python
|
||||
import board
|
||||
from kmk.extensions.split import Split
|
||||
@@ -21,7 +22,7 @@ Useful config options:
|
||||
extra_data_pin=None, # Second uart pin to allow 2 way communication
|
||||
split_offset=None, # Default is column pins but allows an override
|
||||
split_flip=True, # If both halves are the same, but flipped, set this True
|
||||
split_side=None, # Sets if this is the left or right
|
||||
split_side=None, # Sets if this is to 0 if left, 1 if right, or use EE hands
|
||||
split_type=SplitType.UART, # Defaults to UART
|
||||
target_left=True, # Assumes that left will be the one on USB. Set to folse if it will be the right
|
||||
uart_flip=True, # Reverses the RX and TX pins if both are provided
|
||||
@@ -34,8 +35,9 @@ Useful config options:
|
||||
## Bluetooth split (aka no TRRS)
|
||||
Wireless splits are fully featured with 2 way communication allowing all extentions to work 100%.
|
||||
```python
|
||||
split_side = 'Left'
|
||||
split_side = 'Right'
|
||||
split_side = 0 # Left
|
||||
OR
|
||||
split_side = 1 # Right
|
||||
split = BLE_Split(split_side=split_side)
|
||||
|
||||
keyboard.extensions.append(split)
|
||||
@@ -53,15 +55,18 @@ Useful config options:
|
||||
```
|
||||
|
||||
### EE HANDS
|
||||
If you want to plug USB in on either side, or are using bluetooth, this is for you. Pick one of the 2 options but not both.
|
||||
If you want to plug USB in on either side, or are using bluetooth, this is for
|
||||
you. Pick one of the 2 options but not both.
|
||||
|
||||
## Renaming CIRCUITPY Drive
|
||||
The easiest way is to rename your CIRCUITPY drive to something. The left side must end in L, the right must in in R.
|
||||
The name must be 11 characters or less! This is a limitation of the filesystem. You will receive an error if you choose a
|
||||
name longer than 11 characters. Instructions on how to do that are [here](https://learn.adafruit.com/welcome-to-circuitpython/the-circuitpy-drive).
|
||||
The easiest way is to rename your CIRCUITPY drive to something. The left side must
|
||||
end in L, the right must is in R. The name must be 11 characters or less! This is
|
||||
a limitation of the filesystem. You will receive an error if you choose a name
|
||||
longer than 11 characters. Instructions on how to do that are
|
||||
[here](https://learn.adafruit.com/welcome-to-circuitpython/the-circuitpy-drive).
|
||||
For example on NYQUISTL for left and NYQUISTR for the right.
|
||||
|
||||
For wired connections you are done. For bluetooth, remove the `split_side` like tihs
|
||||
For wired connections you are done. For bluetooth, remove the `split_side` like this
|
||||
```python
|
||||
split = BLE_Split()
|
||||
|
||||
@@ -74,9 +79,9 @@ If you have changed the name of the drive as stated above, do not follow this se
|
||||
On each half of your keyboard make a file called kmk_side.py and add one of these lines to the file
|
||||
depending on where each piece is physically located.
|
||||
```python
|
||||
split_side = "Left"
|
||||
split_side = 0 # Left
|
||||
OR
|
||||
split_side = "Right"
|
||||
split_side = 1 # Right
|
||||
```
|
||||
|
||||
and then in your keymap, add the line
|
||||
|
@@ -1,6 +1,9 @@
|
||||
# Support
|
||||
If you are having any issues in installing, configuring, or otherwise issues with KMK, please reach out to us and
|
||||
our community here.
|
||||
If you are having any issues in installing, configuring, or otherwise issues with
|
||||
KMK, please reach out to us and our community here. If you ask for help on chat
|
||||
or open a bug report, if possible please give us your commit SHA, found by running
|
||||
`from kmk.consts import KMK_RELEASE; print(KMK_RELEASE)` in the REPL on your
|
||||
controller.
|
||||
|
||||
# Matrix
|
||||
* [Software Support](https://matrix.to/#/#kmk-support:kmkfw.io)
|
||||
@@ -9,4 +12,4 @@ our community here.
|
||||
|
||||
|
||||
# Discord
|
||||
* [General support](https://discord.gg/NDUau62)
|
||||
* [General support](https://discord.gg/NDUau62)
|
||||
|
@@ -31,19 +31,20 @@ class BLE_Split(Extension):
|
||||
self._advertising = False
|
||||
self._uart_interval = uart_interval
|
||||
self._psave_enable = False
|
||||
self._debug_enabled = False
|
||||
|
||||
def __repr__(self):
|
||||
return f'BLE_SPLIT({self._to_dict()})'
|
||||
|
||||
def _to_dict(self):
|
||||
return f'''
|
||||
BLE_Split( _ble={self._ble}
|
||||
_ble_last_scan={self._ble_last_scan}
|
||||
_is_target={self._is_target}
|
||||
_uart_buffer={self._uart_buffer}
|
||||
_split_flip={self.split_flip}
|
||||
_split_side={self.split_side} )
|
||||
'''
|
||||
return {
|
||||
'_ble': self._ble,
|
||||
'_ble_last_scan': self._ble_last_scan,
|
||||
'_is_target': self._is_target,
|
||||
'uart_buffer': self._uart_buffer,
|
||||
'_split_flip': self.split_flip,
|
||||
'_split_side': self.split_side,
|
||||
}
|
||||
|
||||
def on_runtime_enable(self, keyboard):
|
||||
return
|
||||
@@ -52,15 +53,17 @@ class BLE_Split(Extension):
|
||||
return
|
||||
|
||||
def during_bootup(self, keyboard):
|
||||
self._debug_enabled = keyboard.debug_enabled
|
||||
self._ble.name = str(getmount('/').label)
|
||||
if self._ble.name.endswith('L'):
|
||||
# If name ends in 'L' assume left and strip from name
|
||||
self._is_target = True
|
||||
elif self._ble.name.endswith('R'):
|
||||
# If name ends in 'R' assume right and strip from name
|
||||
self._is_target = False
|
||||
else:
|
||||
self._is_target = bool(self.split_side == 'Left')
|
||||
if self.split_side is None:
|
||||
if self._ble.name.endswith('L'):
|
||||
# If name ends in 'L' assume left and strip from name
|
||||
self._is_target = True
|
||||
elif self._ble.name.endswith('R'):
|
||||
# If name ends in 'R' assume right and strip from name
|
||||
self._is_target = False
|
||||
else:
|
||||
self._is_target = bool(self.split_side == 0)
|
||||
|
||||
if self.split_flip and not self._is_target:
|
||||
keyboard.col_pins = list(reversed(keyboard.col_pins))
|
||||
@@ -127,23 +130,27 @@ class BLE_Split(Extension):
|
||||
break
|
||||
|
||||
if not self._uart:
|
||||
print('Scanning')
|
||||
if self._debug_enabled:
|
||||
print('Scanning')
|
||||
self._ble.stop_scan()
|
||||
for adv in self._ble.start_scan(ProvideServicesAdvertisement, timeout=20):
|
||||
print('Scanning')
|
||||
if self._debug_enabled:
|
||||
print('Scanning')
|
||||
if UARTService in adv.services and adv.rssi > -70:
|
||||
self._uart_connection = self._ble.connect(adv)
|
||||
self._uart_connection.connection_interval = 11.25
|
||||
self._uart = self._uart_connection[UARTService]
|
||||
self._ble.stop_scan()
|
||||
print('Scan complete')
|
||||
if self._debug_enabled:
|
||||
print('Scan complete')
|
||||
break
|
||||
self._ble.stop_scan()
|
||||
|
||||
def _target_advertise(self):
|
||||
'''Advertises the target for the initiator to find'''
|
||||
self._ble.stop_advertising()
|
||||
print('Advertising')
|
||||
if self._debug_enabled:
|
||||
print('Advertising')
|
||||
# Uart must not change on this connection if reconnecting
|
||||
if not self._uart:
|
||||
self._uart = UARTService()
|
||||
@@ -156,7 +163,8 @@ class BLE_Split(Extension):
|
||||
self._connection_count = len(self._ble.connections)
|
||||
if self._connection_count > 1:
|
||||
self.ble_time_reset()
|
||||
print('Advertising complete')
|
||||
if self._debug_enabled:
|
||||
print('Advertising complete')
|
||||
break
|
||||
self._ble.stop_advertising()
|
||||
|
||||
@@ -178,8 +186,11 @@ class BLE_Split(Extension):
|
||||
try:
|
||||
self._uart.disconnect()
|
||||
except: # noqa: E722
|
||||
print('UART disconnect failed')
|
||||
print('Connection error')
|
||||
if self._debug_enabled:
|
||||
print('UART disconnect failed')
|
||||
|
||||
if self._debug_enabled:
|
||||
print('Connection error')
|
||||
self._uart_connection = None
|
||||
self._uart = None
|
||||
return update
|
||||
|
@@ -23,6 +23,12 @@ class Layers(Extension):
|
||||
|
||||
def __init__(self):
|
||||
# Layers
|
||||
self.start_time = {
|
||||
LayerType.LT: None,
|
||||
LayerType.TG: None,
|
||||
LayerType.TT: None,
|
||||
LayerType.LM: None,
|
||||
}
|
||||
make_argumented_key(
|
||||
validator=layer_key_validator,
|
||||
names=('MO',),
|
||||
@@ -57,13 +63,6 @@ class Layers(Extension):
|
||||
on_release=self._tt_released,
|
||||
)
|
||||
|
||||
start_time = {
|
||||
LayerType.LT: None,
|
||||
LayerType.TG: None,
|
||||
LayerType.TT: None,
|
||||
LayerType.LM: None,
|
||||
}
|
||||
|
||||
def on_runtime_enable(self, keyboard):
|
||||
return
|
||||
|
||||
|
@@ -64,7 +64,16 @@ class LED(Extension):
|
||||
return 'LED({})'.format(self._to_dict())
|
||||
|
||||
def _to_dict(self):
|
||||
return f'LED(_brightness={self._brightness} _pos={self._pos} brightness_step={self.brightness_step} brightness_limit={self.brightness_limit} animation_mode={self.animation_mode} animation_speed={self.animation_speed} breathe_center={self.breathe_center} val={self.val} )'
|
||||
return {
|
||||
'_brightness': self._brightness,
|
||||
'_pos': self._pos,
|
||||
'brightness_step': self.brightness_step,
|
||||
'brightness_limit': self.brightness_limit,
|
||||
'animation_mode': self.animation_mode,
|
||||
'animation_speed': self.animation_speed,
|
||||
'breathe_center': self.breathe_center,
|
||||
'val': self.val,
|
||||
}
|
||||
|
||||
def on_runtime_enable(self, keyboard):
|
||||
return
|
||||
|
@@ -31,13 +31,13 @@ class Power(Extension):
|
||||
return f'Power({self._to_dict()})'
|
||||
|
||||
def _to_dict(self):
|
||||
return f'''Power(
|
||||
enable={self.enable}
|
||||
powersave_pin={self.powersave_pin}
|
||||
_powersave_start={self._powersave_start}
|
||||
_usb_last_scan={self._usb_last_scan}
|
||||
_psp={self._psp} )
|
||||
'''
|
||||
return {
|
||||
'enable': self.enable,
|
||||
'powersave_pin': self.powersave_pin,
|
||||
'_powersave_start': self._powersave_start,
|
||||
'_usb_last_scan': self._usb_last_scan,
|
||||
'_psp': self._psp,
|
||||
}
|
||||
|
||||
def on_runtime_enable(self, keyboard):
|
||||
return
|
||||
@@ -82,7 +82,6 @@ class Power(Extension):
|
||||
|
||||
def enable_powersave(self, keyboard):
|
||||
'''Enables power saving features'''
|
||||
print('Psave True')
|
||||
if keyboard.i2c_deinit_count >= self._i2c and self.powersave_pin:
|
||||
# Allows power save to prevent RGB drain.
|
||||
# Example here https://docs.nicekeyboards.com/#/nice!nano/pinout_schematic
|
||||
@@ -96,7 +95,6 @@ class Power(Extension):
|
||||
|
||||
def disable_powersave(self):
|
||||
'''Disables power saving features'''
|
||||
print('Psave False')
|
||||
if self.powersave_pin:
|
||||
# Allows power save to prevent RGB drain.
|
||||
# Example here https://docs.nicekeyboards.com/#/nice!nano/pinout_schematic
|
||||
|
@@ -52,19 +52,20 @@ class Split(Extension):
|
||||
self._is_target = True
|
||||
except OSError:
|
||||
self._is_target = False
|
||||
l_or_r = str(getmount('/').label)
|
||||
if l_or_r.endswith('L'):
|
||||
# If name ends in 'L' assume left and strip from name
|
||||
self.split_side = 'Left'
|
||||
elif l_or_r.endswith('R'):
|
||||
# If name ends in 'R' assume right and strip from name
|
||||
self.split_side = 'Right'
|
||||
if self.split_side is None:
|
||||
l_or_r = str(getmount('/').label)
|
||||
if l_or_r.endswith('L'):
|
||||
# If name ends in 'L' assume left and strip from name
|
||||
self.split_side = 0
|
||||
elif l_or_r.endswith('R'):
|
||||
# If name ends in 'R' assume right and strip from name
|
||||
self.split_side = 1
|
||||
|
||||
if self.split_flip and not self._is_target:
|
||||
keyboard.col_pins = list(reversed(keyboard.col_pins))
|
||||
if self.split_side == 'Left':
|
||||
if self.split_side == 0:
|
||||
self.split_target_left = self._is_target
|
||||
elif self.split_side == 'Right':
|
||||
elif self.split_side == 0:
|
||||
self.split_target_left = not self._is_target
|
||||
|
||||
if self.uart_pin is not None:
|
||||
|
@@ -226,7 +226,6 @@ class USBHID(AbstractHID):
|
||||
|
||||
class BLEHID(AbstractHID):
|
||||
try:
|
||||
# TODO FIXME This is wrapped in a try block to prevent crashes on M4 devices
|
||||
from adafruit_ble import BLERadio
|
||||
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
|
||||
from adafruit_ble.services.standard.hid import HIDService
|
||||
@@ -257,7 +256,7 @@ class BLEHID(AbstractHID):
|
||||
@property
|
||||
def devices(self):
|
||||
'''Search through the provided list of devices to find the ones with the
|
||||
send_report attribute.'''
|
||||
send_report attribute.'''
|
||||
if not self.ble.connected:
|
||||
return []
|
||||
|
||||
@@ -328,4 +327,4 @@ class BLEHID(AbstractHID):
|
||||
self.ble.stop_advertising()
|
||||
|
||||
except ImportError:
|
||||
pass
|
||||
print('Bluetooth unsupported')
|
||||
|
@@ -115,11 +115,6 @@ class KMKKeyboard:
|
||||
self._on_matrix_changed(update[0], update[1], update[2])
|
||||
self.state_changed = True
|
||||
|
||||
#####
|
||||
# SPLICE: INTERNAL STATE
|
||||
# TODO FIXME CLEAN THIS
|
||||
#####
|
||||
|
||||
def _find_key_in_map(self, int_coord, row, col):
|
||||
self.state_layer_key = None
|
||||
try:
|
||||
@@ -281,11 +276,6 @@ class KMKKeyboard:
|
||||
|
||||
return self
|
||||
|
||||
#####
|
||||
# SPLICE END: INTERNAL STATE
|
||||
# TODO FIXME REMOVE THIS
|
||||
#####
|
||||
|
||||
def _init_sanity_check(self):
|
||||
'''
|
||||
Ensure the provided configuration is *probably* bootable
|
||||
@@ -310,11 +300,8 @@ class KMKKeyboard:
|
||||
and do an isinstance check, but instead do string detection
|
||||
'''
|
||||
if any(
|
||||
x.__class__.__module__ == 'kmk.extensions.split' for x in self.extensions
|
||||
):
|
||||
return
|
||||
if any(
|
||||
x.__class__.__module__ == 'kmk.extensions.ble_split'
|
||||
x.__class__.__module__
|
||||
in {'kmk.extensions.split', 'kmk.extensions.ble_split'}
|
||||
for x in self.extensions
|
||||
):
|
||||
return
|
||||
@@ -350,8 +337,8 @@ class KMKKeyboard:
|
||||
|
||||
return self
|
||||
|
||||
# Only one GC to allow for extentions to have room.
|
||||
# There are random memory allocations without this
|
||||
# Only one GC to allow for extentions to have room. There are random memory allocations
|
||||
# issues due to some devices not properly cleaning memory on reset
|
||||
gc.collect()
|
||||
|
||||
def go(self, hid_type=HIDModes.USB, **kwargs):
|
||||
@@ -366,9 +353,6 @@ class KMKKeyboard:
|
||||
ext.during_bootup(self)
|
||||
except Exception:
|
||||
print('Failed to load extention', ext)
|
||||
import time
|
||||
|
||||
time.sleep(5)
|
||||
|
||||
self._init_matrix()
|
||||
|
||||
|
@@ -29,7 +29,7 @@ keyboard.debug_enabled = False
|
||||
|
||||
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 = BLE_Split(split_side=split_side)
|
||||
split = BLE_Split()
|
||||
power = Power(powersave_pin=keyboard.powersave_pin)
|
||||
|
||||
keyboard.extensions = [split, rgb_ext, power]
|
||||
|
Reference in New Issue
Block a user