Change to be an extension
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
|
||||
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, TMK, or ZMK keyboards
|
||||
are supported with a nice!nano, or through our ItsyBitsy to Pro Micro pinout adapter.
|
||||
This class is the main interface between end users and the inner workings of KMK.
|
||||
for various known keyboards (for example, many QMK, TMK, or ZMK keyboards
|
||||
are supported with a nice!nano, or through our ItsyBitsy to Pro Micro pinout adapter.
|
||||
This class is the main interface between end users and the inner workings of KMK.
|
||||
Let's dive in!
|
||||
|
||||
- Edit or create a file called `main.py` on your `CIRCUITPY` drive. You can also
|
||||
@@ -73,13 +73,6 @@ print(dir(board))
|
||||
keyboard.keymap = [[KC.A, KC.B]]
|
||||
```
|
||||
|
||||
- You can also define the keymap with strings. They get replaced with `Key` objects
|
||||
when the keyboard is started:
|
||||
|
||||
```python
|
||||
keyboard.keymap = [['A', 'B']]
|
||||
```
|
||||
|
||||
You can further define a bunch of other stuff:
|
||||
|
||||
- `keyboard.debug_enabled` which will spew a ton of debugging information to the serial
|
||||
|
29
docs/extension_keymap_string_keynames.md
Normal file
29
docs/extension_keymap_string_keynames.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# Keymap String KeyNames
|
||||
|
||||
Enables referring to keys by 'NAME' rather than KC.NAME.
|
||||
|
||||
For example:
|
||||
|
||||
```python
|
||||
from kmk.extensions.keymap_string_keynames import keymap_string_keynames
|
||||
|
||||
# Normal
|
||||
# keyboard.keymap = [[ KC.A, KC.B, KC.RESET ]]
|
||||
|
||||
# Indexed
|
||||
# keyboard.keymap = [[ KC['A'], KC['B'], KC['RESET'] ]]
|
||||
|
||||
# String names
|
||||
keyboard.keymap = [[ 'A' , 'B', 'RESET' ]]
|
||||
|
||||
keymap_string_keynames = keymap_string_keynames()
|
||||
|
||||
# Enabling debug will show each replacement or failure.
|
||||
# This is recommended during the initial development of a keyboard.
|
||||
# keymap_string_keynames.debug_enable = True
|
||||
|
||||
keyboard.extensions.append(keymap_string_keynames)
|
||||
```
|
||||
|
||||
It should be noted that these are **not** ASCII. The string is **not** what
|
||||
will be sent to the computer. The examples above have no functional difference.
|
@@ -1,9 +1,11 @@
|
||||
# Extensions
|
||||
|
||||
Extensions add features that change the experience, but not the core features of
|
||||
the keyboard. They are meant to be easy to add, and create your own. These live in
|
||||
a sandbox to help prevent any bad code from crashing your keyboard.
|
||||
|
||||
## Core Extensions
|
||||
|
||||
These extensions are provided in all builds and can be enabled. Currently offered
|
||||
extensions are
|
||||
|
||||
@@ -12,5 +14,6 @@ extensions are
|
||||
- [LockStatus](lock_status.md): Exposes host-side locks like caps or num lock.
|
||||
- [MediaKeys](media_keys.md): Adds support for media keys such as volume
|
||||
- [RGB](rgb.md): RGB lighting for underglow. Will work on most matrix RGB as will
|
||||
be treated the same as underglow.
|
||||
be treated the same as underglow.
|
||||
- [Status LED](extension_statusled.md): Indicates which layer you are on with an array of single leds.
|
||||
- [KeyMap String KeyNames](extension_keymap_string_keynames): Enables referring to keys by 'NAME' rather than KC.NAME
|
||||
|
@@ -19,11 +19,11 @@ mergulhar!
|
||||
ter problemas de corrupção. ou você pode estar em um dia ruim e apagar o
|
||||
arquivo errado.
|
||||
|
||||
- Atribuir uma instância `KMKKeyboard` a uma variável, por exemplo,
|
||||
`keyboard = KMKKeyboard()` (note os parênteses).
|
||||
- Atribuir uma instância `KMKKeyboard` a uma variável, por exemplo, `keyboard =
|
||||
KMKKeyboard()` (note os parênteses).
|
||||
|
||||
- Certificar-se quie esta instância de `KMKKeyboard` é realmente executada ao
|
||||
fim do arquivo usando um bloco como este:
|
||||
fim do arquivo usando um bloco como este:
|
||||
|
||||
```python
|
||||
if __name__ == '__main__':
|
||||
@@ -75,13 +75,6 @@ print(dir(board))
|
||||
keyboard.keymap = [[KC.A, KC.B]]
|
||||
```
|
||||
|
||||
- Você também pode definir o mapa de teclas com strings. Eles são substituídos por
|
||||
`Key` objetos quando o teclado é iniciado:
|
||||
|
||||
```python
|
||||
keyboard.keymap = [['A', 'B']]
|
||||
```
|
||||
|
||||
Você pode definir um monte de outras coisas
|
||||
|
||||
- `keyboard.debug_enabled` que vai atirar um monte de informação de depuração
|
||||
|
Reference in New Issue
Block a user