Merge pull request #132 from KMKfw/revert-115-topic-led

Revert "Monocolor LED backlight added"
This commit is contained in:
Josh Klar 2019-07-07 15:41:53 -07:00 committed by GitHub
commit edcb681169
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
52 changed files with 211 additions and 1797 deletions

View File

@ -1,6 +1,6 @@
# Debugging
Debug will output most of the useful state to the console. This can be enable in your firmware
by setting this in your keymap. NOTE that it will be slower, so only enable this when you
by setting this in your keymap. NOTE that it will be MUCH slower, so only enable this when you
need debugging.
```python
DEBUG_ENABLE = True

View File

@ -1,16 +0,0 @@
# Examples
Here you can find some examples of what some users have created in their personal keyboard configs. These are here to
help you understand how some of the tools may be used.
## Changing LED color based on layers
This allows you to create a layer key that also changes colors when pushing a layer key, and restore turn off the lights
when you release the layer key. The example uses the MO though any layer switch keys can be used if imported. Just use the
LAYER_1 key in your keymap, and it's ready to go! You can change animations, colors, or anything in there.
```python
LAYER_1 = KC.MO(1)
LAYER_1.after_press_handler(lambda *args, **kwargs: keyboard.pixels.set_hsv_fill(100, 100, 100))
LAYER_1.after_release_handler(lambda *args, **kwargs: keyboard.pixels.set_hsv_fill(0, 0, 0))
keyboard.keymap = [ ....... LAYER_1 ....... ]
```

View File

@ -5,41 +5,22 @@ as appropriate (see [Adafruit's
documentation](https://learn.adafruit.com/welcome-to-circuitpython/installing-circuitpython),
though it doesn't cover all CircuitPython boards - you may need to glance around
the CircuitPython source or ask on Discord). We primarily target CircuitPython
4.0-alpha1 to 4.0-alpha2. You'll only need
4.0-alpha1 and above, though many features should work on 3.x. You'll only need
to flash CircuitPython once (unless we update our baseline supported version).
After CircuitPython has been flashed, a `CIRCUITPY` drive should show up on your
computer most likely. If not, check out the troubleshooting section below.
computer (some Linux/BSD users without drive automounting will want to poke
around `dmesg` to find the drive identifier and mount this drive manually
somewhere - ex. `mkdir -p ~/mnt && sudo mount -o uid=1000,gid=1000 /dev/sdf1
~/mnt`, where `uid` and `gid` are your user ID and primary group ID, as found in
`id -u` and `id -g`). Take note of the path that this is mounted to (for MacOS
users, this will probably look something like `/Volumes/CIRCUITPY`).
# Windows
Currently, we do not have an official "flasher" for windows. You can manually install it fairly easily and we recommend
checking out the support page to join the community if you have any questions. An actual tool is in development.
Alternatively, you can flash from any linux like tool set (Cygwin, WSL, ect) using the Linux guide below.
# Mac
Until an interactive installer is created, please follow the linux instructions replacing /mnt with /Volumes
# Linux
While in the directory for kmk, simply run this, changing the mount point and keymap name to whatever is appropriate.
To "flash" all of KMK, your keymap, and a basic `main.py` that will start
everything up, run `make MOUNTPOINT=/path/to/wherever
USER_KEYMAP=path/to/keymap.py`. For example, if my `CIRCUITPY` volume is mounted
to `~/mnt`, I might flash my development breadboard with the following:
```sh
make MOUNTPOINT=/mnt/CIRCUITPY USER_KEYMAP=user_keymaps/nameofyourkeymap.py
make MOUNTPOINT=~/mnt USER_KEYMAP=user_keymaps/klardotsh/itsybitsy_m4_express/threethree.py
```
# Troubleshooting
## Windows
Please check out our support page to get in contact with us and the community and we can gladly help you out.
## Mac
Please check out our support page to get in contact with us and the community and we can gladly help you out.
## Linux/BSD
Check to see if your drive may have mounted elsewhere with a gui tool. Most will give you the directory in the GUI.
If it's not mounted, you can read up on how to mount a drive manually [here](https://wiki.archlinux.org/index.php/File_systems#Mount_a_file_system)
It would look something like this
`sudo mount -o uid=1000,gid=1000 /dev/sdf1 ~/mnt`
If you still are having issues, check out our support page to see where you can come say hi and the community will gladly help you out.

View File

@ -4,32 +4,45 @@
| ----- | ------- | --------------- | ----- |
| [Adafruit Feather M4 Express](https://www.adafruit.com/product/3857) | Atmel SAMD51 (Cortex M4F) | CircuitPython | An economical solution for basic USB keyboards |
| [Adafruit ItsyBitsy M4 Express](https://www.adafruit.com/product/3800) | Atmel SAMD51 (Cortex M4F) | CircuitPython | A smaller solution for basic USB keyboards |
| [Adafruit Feather NRF52840 Express](https://www.adafruit.com/product/4062) | Cortex M4F/nrf52840 | CircuitPython | Supports USB HID and soon BLE (Bluetooth) |
| [Seeed nRF52840 Micro Dev Kit](https://www.seeedstudio.com/nRF52840-Micro-Development-Kit-p-3079.html) | M4F/nrf52840 | CircuitPython | Supports USB HID and soon BLE (Bluetooth) |
## Community Supported
| Board | Chipset | Python Platform | Maintainer | Notes |
| ----- | ------- | --------------- | ----- | ----- |
| [pyboard v1.1](https://www.adafruit.com/product/2390) | STM32F405RG (Cortex M4F) | MicroPython | kdb424 | Very large and expensive, and has ram limitations. |
## Support Planned/WIP
| Board | Chipset | Python Platform | Notes |
| ----- | ------- | --------------- | ----- |
| [Planck rev6 Keyboard](https://olkb.com/planck) | STM32F303 | CircuitPython | Requires porting CircuitPython to STM32F3. |
| [Proton C Controller?](https://olkb.com/parts/qmk-proton-c) | STM32F303CCT6 | CircuitPython | Requires porting CircuitPython to STM32F3. |
| [Seeed nRF52840 Micro Dev Kit](https://www.seeedstudio.com/nRF52840-Micro-Development-Kit-p-3079.html) | nRF52840 | [CircuitPython](https://github.com/KMKfw/circuitpython/tree/topic-nrf52840-mdk) | This is basically as bleeding edge as it gets. Will support BLE HID to PC as well as BLE split boards |
| [Planck rev6 Keyboard](https://olkb.com/planck) | STM32 of some sort | MicroPython | Requires porting MicroPython to STM32F3, this work has begun but I'm pretty terrible at it. |
| [Proton C Controller?](https://www.reddit.com/r/MechanicalKeyboards/comments/87cw36/render_of_the_qmk_proton_c_qmkpowered_pro_micro/) | ??? | ??? | Does not exist yet, the controller from a Planck rev6 in a Pro Micro pin-compat controller chip |
## Unsupported Devices
Here's a list of problematic, but possibly usable microcontrollers:
| Board | Chipset | Python Platform | Notes |
| ----- | ------- | --------------- | ------------------ |
| [Adafruit Feather Huzzah](https://www.adafruit.com/product/2821) | ESP8266 | CircuitPython | Suuuuuper limited on GPIO lanes, Lack USB HID (HW) |
| [Adafruit HUZZAH32](https://www.adafruit.com/product/3405) | ESP32 | MicroPython | This may work as a BLE HID device, or with a GPIO-based USB breakout. Lacks USB HID (HW) |
| [Adafruit Feather nRF52 BLE Controller](https://www.adafruit.com/product/3406) | nRF52832 | CircuitPython | Lacks USB HID (HW), but could be fixed with GPIO USB breakout. BLE HID should be possible, but it's considered somewhat unstable. This chip is considered "mostly unsupported" in CircuitPython at the time of writing. |
## Porting new devices
Pull requests are welcome and encouraged to add support for new
keyboards/microcontrollers. The base requirements for device support
- CircuitPython
- CircuitPython or MicroPython
- 256KB of flash storage
- HID over USB and/or Bluetooth.
- HID over USB or Bluetooth.
## Secondary Support
In the future, secondary support for lesser controllers is planned. One of
In the future, secondary support for lesser contollers is planned. One of
these cases is the pro micro being used for a slave half of a split keyboard
while all actual work is being done by a supported board. This could also be
used to convert boards that use USB or i2c that run lesser chips to a KMK
board, with a supported board acting as a translation layer. Support for
a converter is planned with the inspiration coming from the [Hasu USB to
USB Controller Converter](https://www.1upkeyboards.com/shop/controllers/usb-to-usb-converter/)
and would allow for conversion to KMK as opposed to TMK or QMK with that board.
USB Controller Converter](https://www.1upkeyboards.com/shop/controllers/usb-to-usb-converter/) and would allow for conversion to KMK as
opposed to TMK or QMK with that board.

View File

@ -230,40 +230,3 @@
|`KC.RALT(kc)`|Hold Right Alt and press `kc` |
|`KC.RGUI(kc)`|Hold Right GUI and press `kc` |
## [RGB/Underglow]
|Key |Aliases |Description |
|-----------------------------|-------------------|----------------------------|
|`KC.RGB_TOG` | |Toggles RGB |
|`KC.RGB_HUI` | |Increase Hue |
|`KC.RGB_HUD` | |Decrease Hue |
|`KC.RGB_SAI` | |Increase Saturation |
|`KC.RGB_SAD` | |Decrease Saturation |
|`KC.RGB_VAI` | |Increase Value |
|`KC.RGB_VAD` | |Decrease Value |
|`KC.RGB_MODE_PLAIN` |`RGB_M_P` |Static RGB |
|`KC.RGB_MODE_BREATHE` |`RGB_M_B` |Breathing animation |
|`KC.RGB_MODE_RAINBOW` |`RGB_M_R` |Rainbow animation |
|`KC.RGB_MODE_BREATHE_RAINBOW`|`RGB_M_BR` |Breathing rainbow animation |
|`KC.RGB_MODE_KNIGHT` |`RGB_M_K` |Knightrider animation |
## [Mod-Tap Keys] NOT IMPLEMENTED AT THIS TIME
|Key |Aliases |Description |
|------------|---------------------------------------|-------------------------------------------------------|
|`LCTL_T(kc)`|`CTL_T(kc)` |Left Control when held, `kc` when tapped |
|`RCTL_T(kc)`| |Right Control when held, `kc` when tapped |
|`LSFT_T(kc)`|`SFT_T(kc)` |Left Shift when held, `kc` when tapped |
|`RSFT_T(kc)`| |Right Shift when held, `kc` when tapped |
|`LALT_T(kc)`|`ALT_T(kc)` |Left Alt when held, `kc` when tapped |
|`RALT_T(kc)`|`ALGR_T(kc)` |Right Alt when held, `kc` when tapped |
|`LGUI_T(kc)`|`LCMD_T(kc)`, `RWIN_T(kc)`, `GUI_T(kc)`|Left GUI when held, `kc` when tapped |
|`RGUI_T(kc)`|`RCMD_T(kc)`, `RWIN_T(kc)` |Right GUI when held, `kc` when tapped |
|`C_S_T(kc)` | |Left Control and Shift when held, `kc` when tapped |
|`MEH_T(kc)` | |Left Control, Shift and Alt when held, `kc` when tapped|
|`LCAG_T(kc)`| |Left Control, Alt and GUI when held, `kc` when tapped |
|`RCAG_T(kc)`| |Right Control, Alt and GUI when held, `kc` when tapped |
|`ALL_T(kc)` | |Left Control, Shift, Alt and GUI when held, `kc` when tapped - more info [here](http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/)|
|`SGUI_T(kc)`|`SCMD_T(kc)`, `SWIN_T(kc)` |Left Shift and GUI when held, `kc` when tapped |
|`LCA_T(kc)` | |Left Control and Alt when held, `kc` when tapped |

View File

@ -1,10 +1,10 @@
# Keys
> NOTE: This is not a lookup table of key objects provided by KMK. That listing
> can be found in `keycodes.md`. It's probably worth a look at the raw source if
> you're stumped: `kmk/keys.py`.
> can be found in `keycodes.md`, though that file is not always kept up to date.
> It's probably worth a look at the raw source if you're stumped: `kmk/keys.py`.
This is a bunch of documentation about how a physical keypress translates to
This is a bunch of documentation about how physical keypresses translate to
events (and the lifecycle of said events) in KMK. It's somewhat technical, but
if you're looking to extend your keyboard's functionality with extra code,
you'll need at least some of this technical knowledge.

View File

@ -1,82 +0,0 @@
# LED (Mono color backlight)
Want your keyboard to shine? Add some lights!
## [Keycodes]
|Key |Aliases |Description |
|-----------------------------|-------------------|----------------------------|
|`KC.LED_TOG` | |Toggles LED's |
|`KC.LED_INC` | |Increase Brightness |
|`KC.LED_DEC` | |Decrease Brightness |
|`KC.LED_ANI` | |Increase animation speed |
|`KC.LED_AND` | |Decrease animation speed |
|`KC.LED_MODE_PLAIN` |`LED_M_P` |Static LED's |
|`KC.LED_MODE_BREATHE` |`LED_M_B` |Breathing animation |
## Configuration
|Define |Default |Description |
|-----------------------------------------|-------------|------------------------------------------------|
|`keyboard.led_config['brightness_step']` |`5` |The number of steps to change the brightness by |
|`keyboard.led_config['brightness_limit']`|`100` |The maximum brightness level in percent |
## Built-in Animation Configuration
|Define |Default |Description |
|-----------------------------------------|-------------|-------------------------------------------------------------------------------------|
|`keyboard.led_config['breath_center']` |`1.5` |Used to calculate the curve for the breathing animation. Anywhere from 1.0 - 2.7 is valid|
## Functions
If you want to create your own animations, or for example, change the lighting in a macro, or a layer switch, here are some functions that are available.
|Function |Description |
|--------------------------------------------|--------------------------------------------------------------------------------------------|
|`keyboard.pixels.increase_brightness(step)` |Increases hue by a given step |
|`keyboard.pixels.decrease_brightness(step)` |Decreases hue by a given step |
|`keyboard.pixels.set_brightness(percent)` |Increases saturation by a given step |
## Direct variable access
|Define |Default |Description |
|-----------------------------------|-----------|--------------------------------------------------------------------------------------------------------|
|`keyboard.led.brightness` |`0` |Sets the brightness by percent 0-100 |
|`keyboard.led.brightness_limit` |`100` |Sets the limit of brightness |
|`keyboard.led.brightness_step` |`5` |Sets the step value to change brightness by |
|`keyboard.led.animation_mode` |`static` |This can be changed to any modes included, or to something custom for user animations. Any string is valid |
|`keyboard.led.animation_speed` |`1` |Increases animation speed of most animations. Recommended 1-5, Maximum 10. |
## User animations
User animations can be created as well. An example of a light show would look like this
```python
from kmk.keys import make_key
def start_flicker(*args, **kwargs):
# Setting mode to user will use the user animation
keyboard.led.animation_mode = 'user'
def flicker(self):
# This is the code that is run every cycle that can serve as an animation
# Refer to the kmk/rgb.py for actual examples of what has been done
if self.brightness == 0:
self.brightness = 100
else:
self.brightness = 0
keyboard.led.set_brightness(self.brightness)
return self
# This is what "gives" your function to KMK so it knows what your animation code is
keyboard.led_config['user_animation'] = flicker
# Makes a key that would start your animation
LS = make_key(on_press=start_flicker())
keymap = [...LS,...]
```
# Troubleshooting
Make sure that your board supports LED backlight by checking for a line with "LED_PIN". If it does not, you can add it to your keymap.
|Define |Description |
|---------------------|---------------------------------------------|
|`keyboard.led_pin` |The pin connected to the data pin of the LEDs|

View File

@ -1,148 +0,0 @@
# 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).
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:
* WS2811, WS2812, WS2812B, WS2812C, etc.
* SK6812, SK6812MINI, SK6805
* All neopixels
### Color Selection
KMK uses [Hue, Saturation, and Value](https://en.wikipedia.org/wiki/HSL_and_HSV) to select colors rather than RGB. The color wheel below demonstrates how this works.
Changing the **Hue** cycles around the circle.
Changing the **Saturation** moves between the inner and outer sections of the wheel, affecting the intensity of the color.
Changing the **Value** sets the overall brightness.
## [Keycodes]
|Key |Aliases |Description |
|-----------------------------|-------------------|----------------------------|
|`KC.RGB_TOG` | |Toggles RGB |
|`KC.RGB_HUI` | |Increase Hue |
|`KC.RGB_HUD` | |Decrease Hue |
|`KC.RGB_SAI` | |Increase Saturation |
|`KC.RGB_SAD` | |Decrease Saturation |
|`KC.RGB_VAI` | |Increase Value |
|`KC.RGB_VAD` | |Decrease Value |
|`KC.RGB_ANI` | |Increase animation speed |
|`KC.RGB_AND` | |Decrease animation speed |
|`KC.RGB_MODE_PLAIN` |`RGB_M_P` |Static RGB |
|`KC.RGB_MODE_BREATHE` |`RGB_M_B` |Breathing animation |
|`KC.RGB_MODE_RAINBOW` |`RGB_M_R` |Rainbow animation |
|`KC.RGB_MODE_BREATHE_RAINBOW`|`RGB_M_BR` |Breathing rainbow animation |
|`KC.RGB_MODE_KNIGHT` |`RGB_M_K` |Knightrider animation |
## Configuration
|Define |Default |Description |
|-------------------------------------|-------------|-----------------------------------------------------------------------------|
|`keyboard.rgb_config['rgb_order']` |`(1, 0, 2)` |The order of the pixels R G B, and optionally white. Example(1, 0, 2, 3) |
|`keyboard.rgb_config['hue_step']` |`10` |The number of steps to cycle through the hue by |
|`keyboard.rgb_config['sat_step']` |`17` |The number of steps to change the saturation by |
|`keyboard.rgb_config['val_step']` |`17` |The number of steps to change the brightness by |
|`keyboard.rgb_config['hue_default']` |`0` |The default hue when the keyboard boots |
|`keyboard.rgb_config['sat_default']` |`100` |The default saturation when the keyboard boots |
|`keyboard.rgb_config['val_default']` |`100` |The default value (brightness) when the keyboard boots |
|`keyboard.rgb_config['val_limit']` |`255` |The maximum brightness level |
## Built-in Animation Configuration
|Define |Default |Description |
|----------------------------------------------|-------------|-------------------------------------------------------------------------------------|
|`keyboard.rgb_config['breathe_center']` |`1.5` |Used to calculate the curve for the breathing animation. Anywhere from 1.0 - 2.7 is valid|
|`keyboard.rgb_config['knight_effect_length']` |`4` |The number of LEDs to light up for the "Knight" animation |
## Functions
If you want to create your own animations, or for example, change the lighting in a macro, or a layer switch, here are some functions that are available.
|Function |Description |
|--------------------------------------------------|--------------------------------------------------------------------------------------------|
|`keyboard.pixels.set_hsv_fill(hue, sat, val)` |Fills all LED's with HSV values |
|`keyboard.pixels.set_hsv(hue, sat, val, index)` |Sets a single LED with HSV value |
|`keyboard.pixels.set_rgb_fill((r, g, b))` |Fills all LED's with RGB(W) values |
|`keyboard.pixels.set_rgb((r, g, b), index)` |Set's a single LED with RGB(W) values |
|`keyboard.pixels.disable_auto_write(bool)` |When True, disables showing changes. Good for setting multiple LED's before a visible update|
|`keyboard.pixels.increase_hue(step)` |Increases hue by a given step |
|`keyboard.pixels.decrease_hue(step)` |Decreases hue by a given step |
|`keyboard.pixels.increase_sat(step)` |Increases saturation by a given step |
|`keyboard.pixels.decrease_sat(step)` |Decreases saturation by a given step |
|`keyboard.pixels.increase_val(step)` |Increases value (brightness) by a given step |
|`keyboard.pixels.decrease_val(step)` |Decreases value (brightness) by a given step |
|`keyboard.pixels.increase_ani()` |Increases animation speed by 1. Maximum 10 |
|`keyboard.pixels.decrease_ani()` |Decreases animation speed by 1. Minimum 10 |
|`keyboard.pixels.off()` |Turns all LED's off |
|`keyboard.pixels.show()` |Displays all stored configuration for LED's. Useful with disable_auto_write explained below |
|`keyboard.pixels.time_ms()` |Returns a time in ms since the board has booted. Useful for start/stop timers |
## Direct variable access
|Define |Default |Description |
|-----------------------------------|-----------|-----------------------------------------------------------------------------------------------------------|
|`keyboard.pixels.hue` |`0` |Sets the hue from 0-360 |
|`keyboard.pixels.sat` |`100` |Sets the saturation from 0-100 |
|`keyboard.pixels.val` |`80` |Sets the brightness from 1-255 |
|`keyboard.pixels.reverse_animation`|`False` |If true, some animations will run in reverse. Can be safely used in user animations |
|`keyboard.pixels.animation_mode` |`static` |This can be changed to any modes included, or to something custom for user animations. Any string is valid |
|`keyboard.pixels.animation_speed` |`1` |Increases animation speed of most animations. Recommended 1-5, Maximum 10. |
## Hardware Modification
To add RGB LED's to boards that don't support them directly, you will have to add a 3 wires. The power wire will run on 3.3v or 5v (depending on the LED),
ground, and data pins will need added to an unused pin on your microcontroller unless your keyboard has specific solder points for them. With those 3 wires
connected, set the pixel_pin as described above, and you are ready to use your RGB LED's/Neopixels.
## ADVANCED USAGE
If you wish to interact with these as you would normal LED's and do not want help from KMK, you can disable all helper functions from working and access the
neopixel object directly like this.
```python
keyboard.pixels.disable_auto_write = True
keyboard.pixels.neopixel() # <-- This is the neopixel object
```
## User animations
User animations can be created as well. An example of a light show would look like this
```python
from kmk.keys import make_key
def start_light_show(*args, **kwargs):
# Setting mode to user will use the user animation
keyboard.pixels.animation_mode = 'user'
def light_show(self):
# This is the code that is run every cycle that can serve as an animation
# Refer to the kmk/rgb.py for actual examples of what has been done
self.hue = (self.hue + 35) % 360
keyboard.pixels.set_hsv_fill(self.hue, self.sat, self.val)
return self
# This is what "gives" your function to KMK so it knows what your animation code is
keyboard.rgb_config['user_animation'] = light_show
# Makes a key that would start your animation
LS = make_key(on_press=start_light_show)
keymap = [...LS,...]
```
## Troubleshooting
### Incorrect colors
If your colors are incorrect, check the pixel order of your specific LED's. Here are some common ones.
* WS2811, WS2812, WS2812B, WS2812C are all GRB (1, 0, 2)
* SK6812, SK6812MINI, SK6805 are all GRB (1, 0, 2)
* Neopixels will vary depending on which one you buy. It will be listed on the product page.# Troubleshooting
### Lights don't turn on
Make sure that your board supports LED backlight by checking for a line with "PIXEL_PIN". If it does not, you can add it to your keymap.
If you added the LED's yourself, you will also need to set num_pixels to the number of installed LED's in total.
|Define |Description |
|---------------------|---------------------------------------------|
|`keyboard.pixel_pin` |The pin connected to the data pin of the LEDs|
|`keyboard.num_pixels`|The number of LEDs connected |

View File

@ -3,9 +3,7 @@
Sequences are used for sending multiple keystrokes in a single action, and can
be used for things like unicode characters (even emojis! 🇨🇦), lorei epsum
generators, triggering side effects (think lighting, speakers,
microcontroller-optimized cryptocurrency miners, whatever). If you are still
unsure of what this is, most other vendors call these "Macros", but can do much
more if you wish.
microcontroller-optimized cryptocurrency miners, whatever).
## Sending strings
The most basic sequence is `send_string`. It can be used to send any standard

View File

@ -2,22 +2,13 @@
Split keyboards are mostly the same as unsplit and very easy to adapt a keymap for. Currently
UART is supported, though other modes will come later such as Bluetooth and i2c.
## UART
To enable uart it's as simple as adding this line, of course changing the pin
```python
keyboard.split_type = "UART"
keyboard.uart_pin = board.SCL
```
## Config
Useful config options:
```python
keyboard.split_flip = True # If your boards are identical but one is flipped, this option is for you
keyboard.split_offsets = [6, 6, 6, 6] # This is the how many keys are on each column on the "Master" half
```
### EE HANDS
## EE HANDS
If you want to plug in on either side, it can be done fairly easily but requires setup.
On each half of your keyboard make a file called kmk_side.py and add one of these lines to the file
@ -33,3 +24,9 @@ and then in your keymap, add the line
from kmk_side import split_side
```
# UART
To enable uart it's as simple as adding this line, of course changing the pin
```python
keyboard.split_type = "UART"
keyboard.uart_pin = board.SCL
```

View File

@ -1,12 +0,0 @@
# Support
If you are having any issues in installing, configuring, or otherwise issues with KMK, please reach out to us and
our community here.
# Matrix
* [Software Support](https://matrix.to/#/#kmk-support:kmkfw.io)
* [Hardware Support](https://matrix.to/#/#kmk-hardware:kmkfw.io)
* [General discussion](https://matrix.to/#/#kmk-general:kmkfw.io)
# Discord
* [General support](https://discord.gg/NDUau62)

View File

@ -1,6 +1,6 @@
# Tap Dance
Tap dance is a way to allow a single physical key to work as multiple logical
Tap dance is a way to allow a single physical key to work as multple logical
keys / actions without using layers. With basic tap dance, you can trigger these
"nested" keys or macros through a series of taps of the physical key within a
given timeout.
@ -34,7 +34,7 @@ are planned to be worked around "eventually", but for now are noteworthy:
- Super fancy stuff like sending a keypress only when the leader key is released
(perhaps based on how long the leader key was held) is **unsupported** - an
example use case might be "tap for Home, hold for Shift"
example usecase might be "tap for Home, hold for Shift"
Here's an example of all this in action:

View File

@ -1,9 +0,0 @@
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_samd51 import Firmware as _Firmware
from kmk.pins import Pin as P
class Firmware(_Firmware):
col_pins = (P.D9, P.D10, P.D11, P.D12, P.D13, P.SCL)
row_pins = (P.A3, P.A4, P.A5, P.SCK, P.MOSI)
diode_orientation = DiodeOrientation.COLUMNS

View File

@ -1,13 +0,0 @@
import board
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_samd51 import Firmware as _Firmware
from kmk.pins import Pin as P
class Firmware(_Firmware):
col_pins = (P.A0, P.A1, P.A2, P.A3, P.A4, P.A5, P.SCK, P.MOSI)
row_pins = (P.TX, P.RX, P.SDA, P.SCL, P.D13, P.D12, P.D11, P.D10)
diode_orientation = DiodeOrientation.COLUMNS
rgb_pixel_pin = board.D9
rgb_num_pixels = 12

View File

@ -1,11 +0,0 @@
import board
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_samd51 import Firmware as _Firmware
from kmk.pins import Pin as P
class Firmware(_Firmware):
col_pins = (P.RX, P.D13, P.A0, P.D11, P.A4, P.A5, P.D10, P.D9, P.SCK)
diode_orientation = DiodeOrientation.COLUMNS
rgb_pixel_pin = board.TX

View File

@ -1,16 +0,0 @@
import board
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_samd51 import Firmware as _Firmware
from kmk.pins import Pin as P
class Firmware(_Firmware):
col_pins = (P.A1, P.A2, P.A3, P.A4, P.A5, P.SCK, P.MOSI)
row_pins = (P.A0, P.D11, P.D10, P.D9)
diode_orientation = DiodeOrientation.COLUMNS
rgb_pixel_pin = board.TX
uart_pin = board.SCL
split_type = 'UART'
split_flip = True
split_offsets = [7, 7, 7, 7]

View File

@ -1,16 +0,0 @@
import board
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_samd51 import Firmware as _Firmware
from kmk.pins import Pin as P
class Firmware(_Firmware):
col_pins = (P.A2, P.A3, P.A4, P.A5, P.SCK, P.MOSI)
row_pins = (P.D11, P.D10, P.D9, P.D7, P.D13)
diode_orientation = DiodeOrientation.COLUMNS
rgb_pixel_pin = board.TX
uart_pin = board.SCL
split_type = 'UART'
split_flip = True
split_offsets = [6, 6, 6, 6, 6]

View File

@ -1,12 +0,0 @@
import board
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_samd51 import Firmware as _Firmware
from kmk.pins import Pin as P
class Firmware(_Firmware):
col_pins = (P.SDA, P.A2, P.A3, P.A4, P.A5, P.SCK, P.MOSI)
row_pins = (P.TX, P.A0, P.RX, P.A1, P.D11, P.D9, P.D12, P.D10)
diode_orientation = DiodeOrientation.COLUMNS
rgb_pixel_pin = board.D13

View File

@ -1,16 +0,0 @@
import board
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_samd51 import Firmware as _Firmware
from kmk.pins import Pin as P
class Firmware(_Firmware):
col_pins = (P.A2, P.A3, P.A4, P.A5, P.SCK, P.A0)
row_pins = (P.D11, P.D10, P.D9, P.D7)
diode_orientation = DiodeOrientation.COLUMNS
rgb_pixel_pin = board.TX
uart_pin = board.SCL
split_type = 'UART'
split_flip = True
split_offsets = [6, 6, 6, 6]

View File

@ -1,19 +0,0 @@
import board
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_samd51 import Firmware as _Firmware
from kmk.pins import Pin as P
class Firmware(_Firmware):
col_pins = (P.A2, P.A3, P.A4, P.A5, P.SCK, P.MOSI)
row_pins = (P.D13, P.D11, P.D10, P.D9)
diode_orientation = DiodeOrientation.COLUMNS
split_type = 'UART'
split_flip = True
split_offsets = [6, 6, 6, 6, 6]
uart_pin = board.SCL
extra_data_pin = board.SDA
rgb_pixel_pin = board.TX
# led_pin = board.D7

View File

@ -1,16 +0,0 @@
import board
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_samd51 import Firmware as _Firmware
from kmk.pins import Pin as P
class Firmware(_Firmware):
col_pins = (P.A2, P.A3, P.A4, P.A5, P.SCK, P.MOSI)
row_pins = (P.D13, P.D11, P.D10, P.D9, P.D7)
diode_orientation = DiodeOrientation.COLUMNS
rgb_pixel_pin = board.TX
uart_pin = board.SCL
split_type = 'UART'
split_flip = True
split_offsets = [6, 6, 6, 6, 6]

View File

@ -1,18 +0,0 @@
import board
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_samd51 import Firmware as _Firmware
from kmk.pins import Pin as P
class Firmware(_Firmware):
col_pins = (P.RX, P.A1, P.A2, P.A3, P.A4, P.A5)
row_pins = (P.D13, P.D11, P.D10, P.D9, P.D7)
diode_orientation = DiodeOrientation.COLUMNS
split_type = 'UART'
split_flip = True
split_offsets = [6, 6, 6, 6, 6]
uart_pin = board.SCL
rgb_pixel_pin = board.TX
extra_data_pin = board.SDA

View File

@ -1,17 +0,0 @@
import board
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_samd51 import Firmware as _Firmware
from kmk.pins import Pin as P
class Firmware(_Firmware):
# Will need additional work and testing
col_pins = (P.A1, P.A2, P.A3, P.A4, P.A5, P.SCK, P.MOSI, P.D12)
row_pins = (P.A0, P.D13, P.D11, P.D10, P.D9, P.D7)
diode_orientation = DiodeOrientation.COLUMNS
rgb_pixel_pin = board.TX
uart_pin = board.SCL
split_type = 'UART'
split_flip = False
split_offsets = [8, 8, 8, 8, 8, 8]

View File

@ -1,16 +0,0 @@
import board
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_samd51 import Firmware as _Firmware
from kmk.pins import Pin as P
class Firmware(_Firmware):
col_pins = (P.A2, P.A3, P.A4, P.A5, P.SCK, P.MOSI)
row_pins = (P.D11, P.D10, P.D9, P.RX, P.D13)
diode_orientation = DiodeOrientation.COLUMNS
rgb_pixel_pin = board.TX
uart_pin = board.SCL
split_type = 'UART'
split_flip = True
split_offsets = [6, 6, 6, 6, 6]

View File

@ -1,9 +0,0 @@
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_samd51 import Firmware as _Firmware
from kmk.pins import Pin as P
class Firmware(_Firmware):
col_pins = (P.A0, P.A1, P.A2, P.A3, P.A4, P.A5, P.SCK, P.MOSI)
row_pins = (P.TX, P.RX, P.SDA, P.SCL, P.D9, P.D10, P.D12, P.D11, P.D13)
diode_orientation = DiodeOrientation.COLUMNS

View File

@ -1,16 +0,0 @@
import board
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_samd51 import Firmware as _Firmware
from kmk.pins import Pin as P
class Firmware(_Firmware):
col_pins = (P.A1, P.A2, P.A3, P.A4, P.A5, P.SCK, P.MOSI)
row_pins = (P.D13, P.D11, P.D10, P.D9, P.D7)
diode_orientation = DiodeOrientation.COLUMNS
rgb_pixel_pin = board.TX
uart_pin = board.SCL
split_type = 'UART'
split_flip = True
split_offsets = [7, 7, 7, 7, 7]

View File

@ -1,16 +0,0 @@
import board
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_samd51 import Firmware as _Firmware
from kmk.pins import Pin as P
class Firmware(_Firmware):
col_pins = (P.A0, P.A1, P.A2, P.A3, P.A4, P.A5, P.SCK)
row_pins = (P.D13, P.D11, P.D10, P.D9, P.D7)
diode_orientation = DiodeOrientation.COLUMNS
rgb_pixel_pin = board.TX
uart_pin = board.SCL
split_type = 'UART'
split_flip = True
split_offsets = [7, 7, 7, 7, 7]

View File

@ -1,16 +0,0 @@
import board
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_samd51 import Firmware as _Firmware
from kmk.pins import Pin as P
class Firmware(_Firmware):
col_pins = (P.A5, P.A4, P.A3, P.A2, P.A1, P.A0)
row_pins = (P.D7, P.D9, P.D10, P.D11)
diode_orientation = DiodeOrientation.COLUMNS
rgb_pixel_pin = board.TX
uart_pin = board.SCL
split_type = 'UART'
split_flip = True
split_offsets = [6, 6, 6, 6]

View File

@ -1,16 +0,0 @@
import board
from kmk.consts import DiodeOrientation
from kmk.mcus.circuitpython_samd51 import Firmware as _Firmware
from kmk.pins import Pin as P
class Firmware(_Firmware):
col_pins = (P.MOSI, P.SCK, P.A5, P.A4, P.A3, P.A2)
row_pins = (P.D11, P.D10, P.D9, P.D7)
diode_orientation = DiodeOrientation.COLUMNS
rgb_pixel_pin = board.TX
uart_pin = board.SCL
split_type = 'UART'
split_flip = True
split_offsets = [6, 6, 6, 6]

View File

@ -16,11 +16,8 @@ class Firmware(_Firmware):
split_flip = True
split_offsets = (6, 6, 6, 6, 6)
split_type = 'UART'
split_type = "UART"
uart_pin = board.SCL
extra_data_pin = board.SDA
rgb_pixel_pin = board.TX
led_pin = board.D7
coord_mapping = []
coord_mapping.extend(ic(0, x) for x in range(12))

View File

@ -42,12 +42,13 @@ import kmk.matrix # isort:skip
import kmk.hid # isort:skip
import kmk.internal_state # isort:skip
# GC runs automatically after CircuitPython imports.
# GC runs automatically after CircuitPython imports. If we ever go back to
# supporting MicroPython, we'll need a GC here (and probably after each
# chunk of the above)
# Thanks for sticking around. Now let's do real work, starting below
from kmk.util import intify_coordinate as ic
from kmk import led, rgb # isort:skip
class Firmware:
@ -60,7 +61,6 @@ class Firmware:
col_pins = None
diode_orientation = None
matrix_scanner = MatrixScanner
uart_buffer = []
unicode_mode = UnicodeMode.NOOP
tap_time = 300
@ -70,7 +70,6 @@ class Firmware:
hid_helper = USB_HID
# Split config
extra_data_pin = None
split_offsets = ()
split_flip = False
@ -82,14 +81,6 @@ class Firmware:
uart_flip = True
uart_pin = None
# RGB config
rgb_pixel_pin = None
rgb_config = rgb.rgb_config
# led config (mono color)
led_pin = None
led_config = led.led_config
def __init__(self):
# Attempt to sanely guess a coord_mapping if one is not provided
@ -128,7 +119,6 @@ class Firmware:
:param update:
'''
if update is not None:
self._state.matrix_changed(
update[0],
update[1],
@ -144,22 +134,14 @@ class Firmware:
self.uart.write(update)
def _receive_from_slave(self):
if self.uart is not None and self.uart.in_waiting > 0 or self.uart_buffer:
if self.uart.in_waiting >= 60:
# This is a dirty hack to prevent crashes in unrealistic cases
import microcontroller
microcontroller.reset()
while self.uart.in_waiting >= 3:
self.uart_buffer.append(self.uart.read(3))
if self.uart_buffer:
update = bytearray(self.uart_buffer.pop(0))
# Built in debug mode switch
if update == b'DEB':
print(self.uart.readline())
return None
return update
if self.uart is not None and self.uart.in_waiting > 0:
update = bytearray(self.uart.read(3))
# Built in debug mode switch
if update == b'DEB':
# TODO Pretty up output
print(self.uart.readline())
return None
return update
return None
@ -204,27 +186,15 @@ class Firmware:
if self.split_flip and not self._master_half():
self.col_pins = list(reversed(self.col_pins))
if self.split_side == 'Left':
self.split_master_left = self._master_half()
elif self.split_side == 'Right':
if self.split_side == "Left":
self.split_master_left = self._master_half()
elif self.split_side == "Right":
self.split_master_left = not self._master_half()
if self.uart_pin is not None:
self.uart = self.init_uart(self.uart_pin)
if self.rgb_pixel_pin:
self.pixels = rgb.RGB(self.rgb_config, self.rgb_pixel_pin)
self.rgb_config = None # No longer needed
else:
self.pixels = None
if self.led_pin:
self.led = led.led(self.led_pin, self.led_config)
self.led_config = None # No longer needed
else:
self.led = None
self.matrix = MatrixScanner(
self.matrix = self.matrix_scanner(
cols=self.col_pins,
rows=self.row_pins,
diode_orientation=self.diode_orientation,
@ -242,7 +212,7 @@ class Firmware:
del self.leader_dictionary[k]
if self.debug_enabled:
print('Firin\' lazers. Keyboard is booted.')
print("Firin' lazers. Keyboard is booted.")
while True:
state_changed = False
@ -278,16 +248,3 @@ class Firmware:
if self.debug_enabled and state_changed:
print('New State: {}'.format(self._state._to_dict()))
if self.debug_enabled and state_changed and self.pixels.enabled:
print('New State: {}'.format(self.pixels))
if self.pixels:
# Only check animations if pixels is initialized
if self.pixels.animation_mode:
self.pixels = self.pixels.animate()
if self.led:
# Only check animations if led is initialized
if self.led.animation_mode:
self.led = self.led.animate()

View File

@ -52,6 +52,8 @@ def gesc_pressed(key, state, KC, *args, **kwargs):
if GESC_TRIGGERS.intersection(state.keys_pressed):
# First, release GUI if already pressed
state.keys_pressed.discard(KC.LGUI)
state.keys_pressed.discard(KC.RGUI)
state.config._send_hid()
# if Shift is held, KC_GRAVE will become KC_TILDE on OS level
state.keys_pressed.add(KC.GRAVE)
@ -116,125 +118,3 @@ def td_pressed(key, state, *args, **kwargs):
def td_released(key, state, *args, **kwargs):
return state._process_tap_dance(key, False)
def rgb_tog(key, state, *args, **kwargs):
if state.config.pixels.animation_mode == 'static_standby':
state.config.pixels.animation_mode = 'static'
state.config.pixels.enabled = not state.config.pixels.enabled
return state
def rgb_hui(key, state, *args, **kwargs):
state.config.pixels.increase_hue()
return state
def rgb_hud(key, state, *args, **kwargs):
state.config.pixels.decrease_hue()
return state
def rgb_sai(key, state, *args, **kwargs):
state.config.pixels.increase_sat()
return state
def rgb_sad(key, state, *args, **kwargs):
state.config.pixels.decrease_sat()
return state
def rgb_vai(key, state, *args, **kwargs):
state.config.pixels.increase_val()
return state
def rgb_vad(key, state, *args, **kwargs):
state.config.pixels.decrease_val()
return state
def rgb_ani(key, state, *args, **kwargs):
state.config.pixels.increase_ani()
return state
def rgb_and(key, state, *args, **kwargs):
state.config.pixels.decrease_ani()
return state
def rgb_mode_static(key, state, *args, **kwargs):
state.config.pixels.effect_init = True
state.config.pixels.animation_mode = 'static'
return state
def rgb_mode_breathe(key, state, *args, **kwargs):
state.config.pixels.effect_init = True
state.config.pixels.animation_mode = 'breathing'
return state
def rgb_mode_breathe_rainbow(key, state, *args, **kwargs):
state.config.pixels.effect_init = True
state.config.pixels.animation_mode = 'breathing_rainbow'
return state
def rgb_mode_rainbow(key, state, *args, **kwargs):
state.config.pixels.effect_init = True
state.config.pixels.animation_mode = 'rainbow'
return state
def rgb_mode_swirl(key, state, *args, **kwargs):
state.config.pixels.effect_init = True
state.config.pixels.animation_mode = 'swirl'
return state
def rgb_mode_knight(key, state, *args, **kwargs):
state.config.pixels.effect_init = True
state.config.pixels.animation_mode = 'knight'
return state
def led_tog(key, state, *args, **kwargs):
if state.config.led.animation_mode == 'static_standby':
state.config.led.animation_mode = 'static'
state.config.led.enabled = not state.config.led.enabled
return state
def led_inc(key, state, *args, **kwargs):
state.config.led.increase_brightness()
return state
def led_dec(key, state, *args, **kwargs):
state.config.led.decrease_brightness()
return state
def led_ani(key, state, *args, **kwargs):
state.config.led.increase_ani()
return state
def led_and(key, state, *args, **kwargs):
state.config.led.decrease_ani()
return state
def led_mode_static(key, state, *args, **kwargs):
state.config.led.effect_init = True
state.config.led.animation_mode = 'static'
return state
def led_mode_breathe(key, state, *args, **kwargs):
state.config.led.effect_init = True
state.config.led.animation_mode = 'breathing'
return state

View File

@ -171,7 +171,8 @@ class InternalState:
return self
if (
changed_key not in self.tap_dance_counts or not self.tap_dance_counts[changed_key]
changed_key not in self.tap_dance_counts or
not self.tap_dance_counts[changed_key]
):
self.tap_dance_counts[changed_key] = 1
self.set_timeout(self.config.tap_time, lambda: self._end_tap_dance(changed_key))
@ -256,7 +257,8 @@ class InternalState:
for key in keys_pressed:
if (
self.config.leader_mode == LeaderMode.ENTER_ACTIVE and key == KC.ENT
self.config.leader_mode == LeaderMode.ENTER_ACTIVE and
key == KC.ENT
):
self._handle_leader_sequence()
break

View File

@ -432,18 +432,18 @@ make_key(code=39, names=('0', 'N0'))
gc.collect()
# More ASCII standard keys
make_key(code=40, names=('ENTER', 'ENT', '\n'))
make_key(code=40, names=('ENTER', 'ENT', "\n"))
make_key(code=41, names=('ESCAPE', 'ESC'))
make_key(code=42, names=('BACKSPACE', 'BSPC', 'BKSP'))
make_key(code=43, names=('TAB', '\t'))
make_key(code=43, names=('TAB', "\t"))
make_key(code=44, names=('SPACE', 'SPC', ' '))
make_key(code=45, names=('MINUS', 'MINS', '-'))
make_key(code=46, names=('EQUAL', 'EQL', '='))
make_key(code=47, names=('LBRACKET', 'LBRC', '['))
make_key(code=48, names=('RBRACKET', 'RBRC', ']'))
make_key(code=49, names=('BACKSLASH', 'BSLASH', 'BSLS', '\\'))
make_key(code=49, names=('BACKSLASH', 'BSLASH', 'BSLS', "\\"))
make_key(code=51, names=('SEMICOLON', 'SCOLON', 'SCLN', ';'))
make_key(code=52, names=('QUOTE', 'QUOT', '\''))
make_key(code=52, names=('QUOTE', 'QUOT', "'"))
make_key(code=53, names=('GRAVE', 'GRV', 'ZKHK', '`'))
make_key(code=54, names=('COMMA', 'COMM', ','))
make_key(code=55, names=('DOT', '.'))
@ -531,7 +531,7 @@ make_key(code=134, names=('KP_EQUAL_AS400', 'NUMPAD_EQUAL_AS400'))
gc.collect()
# Making life better for folks on tiny keyboards especially: exposes
# the 'shifted' keys as raw keys. Under the hood we're still
# the "shifted" keys as raw keys. Under the hood we're still
# sending Shift+(whatever key is normally pressed) to get these, so
# for example `KC_AT` will hold shift and press 2.
make_shifted_key('GRAVE', names=('TILDE', 'TILD', '~'))
@ -551,7 +551,7 @@ make_shifted_key('LBRACKET', names=('LEFT_CURLY_BRACE', 'LCBR', '{'))
make_shifted_key('RBRACKET', names=('RIGHT_CURLY_BRACE', 'RCBR', '}'))
make_shifted_key('BACKSLASH', names=('PIPE', '|'))
make_shifted_key('SEMICOLON', names=('COLON', 'COLN', ':'))
make_shifted_key('QUOTE', names=('DOUBLE_QUOTE', 'DQUO', 'DQT', '\''))
make_shifted_key('QUOTE', names=('DOUBLE_QUOTE', 'DQUO', 'DQT', '"'))
make_shifted_key('COMMA', names=('LEFT_ANGLE_BRACKET', 'LABK', '<'))
make_shifted_key('DOT', names=('RIGHT_ANGLE_BRACKET', 'RABK', '>'))
make_shifted_key('SLSH', names=('QUESTION', 'QUES', '?'))
@ -584,9 +584,9 @@ make_key(code=152, names=('LANG9',))
gc.collect()
# Consumer ('media') keys. Most known keys aren't supported here. A much
# Consumer ("media") keys. Most known keys aren't supported here. A much
# longer list used to exist in this file, but the codes were almost certainly
# incorrect, conflicting with each other, or otherwise 'weird'. We'll add them
# incorrect, conflicting with each other, or otherwise "weird". We'll add them
# back in piecemeal as needed. PRs welcome.
#
# A super useful reference for these is http://www.freebsddiary.org/APC/usb_hid_usages.php
@ -625,35 +625,6 @@ make_key(names=('DEBUG', 'DBG'), on_press=handlers.debug_pressed, on_release=han
make_key(names=('GESC',), on_press=handlers.gesc_pressed, on_release=handlers.gesc_released)
make_key(names=('BKDL',), on_press=handlers.bkdl_pressed, on_release=handlers.bkdl_released)
make_key(names=('GESC', 'GRAVE_ESC'), on_press=handlers.gesc_pressed,
on_release=handlers.gesc_released)
make_key(names=('RGB_TOG',), on_press=handlers.rgb_tog)
make_key(names=('RGB_HUI',), on_press=handlers.rgb_hui)
make_key(names=('RGB_HUD',), on_press=handlers.rgb_hud)
make_key(names=('RGB_SAI',), on_press=handlers.rgb_sai)
make_key(names=('RGB_SAD',), on_press=handlers.rgb_sad)
make_key(names=('RGB_VAI',), on_press=handlers.rgb_vai)
make_key(names=('RGB_VAD',), on_press=handlers.rgb_vad)
make_key(names=('RGB_ANI',), on_press=handlers.rgb_ani)
make_key(names=('RGB_AND',), on_press=handlers.rgb_and)
make_key(names=('RGB_MODE_PLAIN', 'RGB_M_P'), on_press=handlers.rgb_mode_static)
make_key(names=('RGB_MODE_BREATHE', 'RGB_M_B'), on_press=handlers.rgb_mode_breathe)
make_key(names=('RGB_MODE_RAINBOW', 'RGB_M_R'), on_press=handlers.rgb_mode_rainbow)
make_key(names=('RGB_MODE_BREATHE_RAINBOW', 'RGB_M_BR'),
on_press=handlers.rgb_mode_breathe_rainbow)
make_key(names=('RGB_MODE_SWIRL', 'RGB_M_S'), on_press=handlers.rgb_mode_swirl)
make_key(names=('RGB_MODE_KNIGHT', 'RGB_M_K'), on_press=handlers.rgb_mode_knight)
make_key(names=('LED_TOG',), on_press=handlers.led_tog)
make_key(names=('LED_INC',), on_press=handlers.led_inc)
make_key(names=('LED_DEC',), on_press=handlers.led_dec)
make_key(names=('LED_ANI',), on_press=handlers.led_ani)
make_key(names=('LED_AND',), on_press=handlers.led_and)
make_key(names=('LED_MODE_PLAIN', 'LED_M_P'), on_press=handlers.led_mode_static)
make_key(names=('LED_MODE_BREATHE', 'LED_M_B'), on_press=handlers.led_mode_breathe)
make_key(
names=('LEADER', 'LEAD'),
on_press=handlers.leader_pressed,

View File

@ -1,143 +0,0 @@
import time
from math import e, exp, pi, sin
import pulseio
from micropython import const
led_config = {
'brightness_step': 5,
'brightness_limit': 100,
'breathe_center': 1.5,
'animation_mode': 'static',
'animation_speed': 1,
}
class led:
brightness = 0
time = int(time.monotonic() * 1000)
pos = 0
effect_init = False
led = None
brightness_step = 5
brightness_limit = 100
breathe_center = 1.5
animation_mode = 'static'
animation_speed = 1
enabled = True
user_animation = None
def __init__(self, led_pin, config):
self.led = pulseio.PWMOut(led_pin)
self.brightness_step = const(config['brightness_step'])
self.brightness_limit = const(config['brightness_limit'])
self.animation_mode = const(config['animation_mode'])
self.animation_speed = const(config['animation_speed'])
self.breathe_center = const(config['breathe_center'])
if config['user_animation']:
self.user_animation = config['user_animation']
def __repr__(self):
return 'LED({})'.format(self._to_dict())
def _to_dict(self):
return {
'led': self.led,
'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,
}
def _init_effect(self):
self.pos = 0
self.effect_init = False
return self
def time_ms(self):
return int(time.monotonic() * 1000)
def set_brightness(self, percent):
self.led.duty_cycle = int(percent / 100 * 65535)
def increase_brightness(self, step=None):
if not step:
self.brightness += self.brightness_step
else:
self.brightness += step
if self.brightness > 100:
self.brightness = 100
self.set_brightness(self.brightness)
def decrease_brightness(self, step=None):
if not step:
self.brightness -= self.brightness_step
else:
self.brightness -= step
if self.brightness < 0:
self.brightness = 0
self.set_brightness(self.brightness)
def off(self):
self.set_brightness(0)
def increase_ani(self):
"""
Increases animation speed by 1 amount stopping at 10
:param step:
"""
if (self.animation_speed + 1) >= 10:
self.animation_speed = 10
else:
self.val += 1
def decrease_ani(self):
"""
Decreases animation speed by 1 amount stopping at 0
:param step:
"""
if (self.val - 1) <= 0:
self.val = 0
else:
self.val -= 1
def effect_breathing(self):
# http://sean.voisen.org/blog/2011/10/breathing-led-with-arduino/
# https://github.com/qmk/qmk_firmware/blob/9f1d781fcb7129a07e671a46461e501e3f1ae59d/quantum/rgblight.c#L806
self.brightness = int((exp(sin((self.pos / 255.0) * pi)) - self.breathe_center / e) *
(self.brightness_limit / (e - 1 / e)))
self.pos = (self.pos + self.animation_speed) % 256
self.set_brightness(self.brightness)
return self
def effect_static(self):
self.set_brightness(self.brightness)
# Set animation mode to none to prevent cycles from being wasted
self.animation_mode = None
return self
def animate(self):
"""
Activates a "step" in the animation based on the active mode
:return: Returns the new state in animation
"""
if self.effect_init:
self._init_effect()
if self.enabled:
if self.animation_mode == 'breathing':
return self.effect_breathing()
elif self.animation_mode == 'static':
return self.effect_static()
elif self.animation_mode == 'user':
return self.user_animation(self)
else:
self.off()
return self

View File

@ -1,487 +0,0 @@
import time
from math import e, exp, pi, sin
from micropython import const
rgb_config = {
'pixels': None,
'num_pixels': 0,
'pixel_pin': None,
'val_limit': 255,
'hue_default': 0,
'sat_default': 100,
'rgb_order': (1, 0, 2), # GRB WS2812
'val_default': 100,
'hue_step': 1,
'sat_step': 1,
'val_step': 1,
'animation_speed': 1,
'breathe_center': 1.5, # 1.0-2.7
'knight_effect_length': 3,
'animation_mode': 'static',
}
class RGB:
hue = 0
sat = 100
val = 80
pos = 0
time = int(time.monotonic() * 10)
intervals = (30, 20, 10, 5)
animation_speed = 1
enabled = True
neopixel = None
rgbw = False
reverse_animation = False
disable_auto_write = False
animation_mode = 'static'
# Set by config
num_pixels = None
hue_step = None
sat_step = None
val_step = None
breathe_center = None # 1.0-2.7
knight_effect_length = None
val_limit = None
effect_init = False
user_animation = None
def __init__(self, config, pixel_pin):
try:
import neopixel
self.neopixel = neopixel.NeoPixel(pixel_pin,
config['num_pixels'],
pixel_order=config['rgb_order'],
auto_write=False)
if len(config['rgb_order']) == 4:
self.rgbw = True
self.num_pixels = const(config['num_pixels'])
self.hue_step = const(config['hue_step'])
self.sat_step = const(config['sat_step'])
self.val_step = const(config['val_step'])
self.hue = const(config['hue_default'])
self.sat = const(config['sat_default'])
self.val = const(config['val_default'])
self.breathe_center = const(config['breathe_center'])
self.knight_effect_length = const(config['knight_effect_length'])
self.val_limit = const(config['val_limit'])
self.animation_mode = config['animation_mode']
self.animation_speed = const(config['animation_speed'])
if 'user_animation' in config:
print(config['user_animation'])
self.user_animation = config['user_animation']
except ImportError as e:
print(e)
def __repr__(self):
return 'RGB({})'.format(self._to_dict())
def _to_dict(self):
return {
'hue': self.hue,
'sat': self.sat,
'val': self.val,
'time': self.time,
'intervals': self.intervals,
'animation_mode': self.animation_mode,
'animation_speed': self.animation_speed,
'enabled': self.enabled,
'neopixel': self.neopixel,
'disable_auto_write': self.disable_auto_write,
}
def time_ms(self):
return int(time.monotonic() * 1000)
def hsv_to_rgb(self, hue, sat, val):
"""
Converts HSV values, and returns a tuple of RGB values
:param hue:
:param sat:
:param val:
:return: (r, g, b)
"""
r = 0
g = 0
b = 0
if val > self.val_limit:
val = self.val_limit
if sat == 0:
r = val
g = val
b = val
else:
base = ((100 - sat) * val) / 100
color = int((val - base) * ((hue % 60) / 60))
x = int(hue / 60)
if x == 0:
r = val
g = base + color
b = base
elif x == 1:
r = val - color
g = val
b = base
elif x == 2:
r = base
g = val
b = base + color
elif x == 3:
r = base
g = val - color
b = val
elif x == 4:
r = base + color
g = base
b = val
elif x == 5:
r = val
g = base
b = val - color
return int(r), int(g), int(b)
def hsv_to_rgbw(self, hue, sat, val):
"""
Converts HSV values, and returns a tuple of RGBW values
:param hue:
:param sat:
:param val:
:return: (r, g, b, w)
"""
rgb = self.hsv_to_rgb(hue, sat, val)
return rgb[0], rgb[1], rgb[2], min(rgb)
def set_hsv(self, hue, sat, val, index):
"""
Takes HSV values and displays it on a single LED/Neopixel
:param hue:
:param sat:
:param val:
:param index: Index of LED/Pixel
"""
if self.neopixel:
if self.rgbw:
self.set_rgb(self.hsv_to_rgbw(hue, sat, val), index)
else:
self.set_rgb(self.hsv_to_rgb(hue, sat, val), index)
return self
def set_hsv_fill(self, hue, sat, val):
"""
Takes HSV values and displays it on all LEDs/Neopixels
:param hue:
:param sat:
:param val:
"""
if self.neopixel:
if self.rgbw:
self.set_rgb_fill(self.hsv_to_rgbw(hue, sat, val))
else:
self.set_rgb_fill(self.hsv_to_rgb(hue, sat, val))
return self
def set_rgb(self, rgb, index):
"""
Takes an RGB or RGBW and displays it on a single LED/Neopixel
:param rgb: RGB or RGBW
:param index: Index of LED/Pixel
"""
if self.neopixel and 0 <= index <= self.num_pixels - 1:
self.neopixel[index] = rgb
if not self.disable_auto_write:
self.neopixel.show()
return self
def set_rgb_fill(self, rgb):
"""
Takes an RGB or RGBW and displays it on all LEDs/Neopixels
:param rgb: RGB or RGBW
"""
if self.neopixel:
self.neopixel.fill(rgb)
if not self.disable_auto_write:
self.neopixel.show()
return self
def increase_hue(self, step=None):
"""
Increases hue by step amount rolling at 360 and returning to 0
:param step:
"""
if not step:
step = self.hue_step
self.hue = (self.hue + step) % 360
if self._check_update():
self._do_update()
return self
def decrease_hue(self, step=None):
"""
Decreases hue by step amount rolling at 0 and returning to 360
:param step:
"""
if not step:
step = self.hue_step
if (self.hue - step) <= 0:
self.hue = (self.hue + 360 - step) % 360
else:
self.hue = (self.hue - step) % 360
if self._check_update():
self._do_update()
return self
def increase_sat(self, step=None):
"""
Increases saturation by step amount stopping at 100
:param step:
"""
if not step:
step = self.sat_step
if self.sat + step >= 100:
self.sat = 100
else:
self.sat += step
if self._check_update():
self._do_update()
return self
def decrease_sat(self, step=None):
"""
Decreases saturation by step amount stopping at 0
:param step:
"""
if not step:
step = self.sat_step
if (self.sat - step) <= 0:
self.sat = 0
else:
self.sat -= step
if self._check_update():
self._do_update()
return self
def increase_val(self, step=None):
"""
Increases value by step amount stopping at 100
:param step:
"""
if not step:
step = self.val_step
if (self.val + step) >= 100:
self.val = 100
else:
self.val += step
if self._check_update():
self._do_update()
return self
def decrease_val(self, step=None):
"""
Decreases value by step amount stopping at 0
:param step:
"""
if not step:
step = self.val_step
if (self.val - step) <= 0:
self.val = 0
else:
self.val -= step
if self._check_update():
self._do_update()
return self
def increase_ani(self):
"""
Increases animation speed by 1 amount stopping at 10
:param step:
"""
if (self.animation_speed + 1) >= 10:
self.animation_speed = 10
else:
self.val += 1
def decrease_ani(self):
"""
Decreases animation speed by 1 amount stopping at 0
:param step:
"""
if (self.val - 1) <= 0:
self.val = 0
else:
self.val -= 1
return self
def off(self):
"""
Turns off all LEDs/Neopixels without changing stored values
"""
if self.neopixel:
self.set_hsv_fill(0, 0, 0)
return self
def show(self):
"""
Turns on all LEDs/Neopixels without changing stored values
"""
if self.neopixel:
self.neopixel.show()
return self
def animate(self):
"""
Activates a "step" in the animation based on the active mode
:return: Returns the new state in animation
"""
if self.effect_init:
self._init_effect()
if self.enabled:
if self.animation_mode == 'breathing':
return self.effect_breathing()
elif self.animation_mode == 'rainbow':
return self.effect_rainbow()
elif self.animation_mode == 'breathing_rainbow':
return self.effect_breathing_rainbow()
elif self.animation_mode == 'static':
return self.effect_static()
elif self.animation_mode == 'knight':
return self.effect_knight()
elif self.animation_mode == 'swirl':
return self.effect_swirl()
elif self.animation_mode == 'user':
return self.user_animation(self)
elif self.animation_mode == 'static_standby':
pass
else:
self.off()
return self
def _animation_step(self):
interval = self.time_ms() - self.time
if interval >= max(self.intervals):
self.time = self.time_ms()
return max(self.intervals)
if interval in self.intervals:
return interval
else:
return False
def _init_effect(self):
if self.animation_mode == 'breathing' or self.animation_mode == 'breathing_rainbow':
self.intervals = (30, 20, 10, 5)
elif self.animation_mode == 'swirl':
self.intervals = (50, 50)
self.pos = 0
self.reverse_animation = False
self.effect_init = False
return self
def _check_update(self):
if self.animation_mode == 'static_standby':
return True
def _do_update(self):
if self.animation_mode == 'static_standby':
self.animation_mode = 'static'
def effect_static(self):
self.set_hsv_fill(self.hue, self.sat, self.val)
self.animation_mode = 'static_standby'
return self
def effect_breathing(self):
# http://sean.voisen.org/blog/2011/10/breathing-led-with-arduino/
# https://github.com/qmk/qmk_firmware/blob/9f1d781fcb7129a07e671a46461e501e3f1ae59d/quantum/rgblight.c#L806
self.val = int((exp(sin((self.pos / 255.0) * pi)) - self.breathe_center / e) *
(self.val_limit / (e - 1 / e)))
self.pos = (self.pos + self.animation_speed) % 256
self.set_hsv_fill(self.hue, self.sat, self.val)
return self
def effect_breathing_rainbow(self):
if self._animation_step():
self.increase_hue(self.animation_speed)
self.effect_breathing()
return self
def effect_rainbow(self):
if self._animation_step():
self.increase_hue(self.animation_speed)
self.set_hsv_fill(self.hue, self.sat, self.val)
return self
def effect_swirl(self):
if self._animation_step():
self.increase_hue(self.animation_speed)
self.disable_auto_write = True # Turn off instantly showing
for i in range(0, self.num_pixels):
self.set_hsv(
(self.hue - (i * self.num_pixels)) % 360,
self.sat,
self.val,
i)
# Show final results
self.disable_auto_write = False # Resume showing changes
self.show()
return self
def effect_knight(self):
# Determine which LEDs should be lit up
self.disable_auto_write = True # Turn off instantly showing
self.off() # Fill all off
pos = int(self.pos)
# Set all pixels on in range of animation length offset by position
for i in range(pos, (pos + self.knight_effect_length)):
self.set_hsv(self.hue, self.sat, self.val, i)
# Reverse animation when a boundary is hit
if pos >= self.num_pixels or pos - 1 < (self.knight_effect_length * -1):
self.reverse_animation = not self.reverse_animation
if self.reverse_animation:
self.pos -= self.animation_speed / 5
else:
self.pos += self.animation_speed / 5
# Show final results
self.disable_auto_write = False # Resume showing changes
self.show()
return self

View File

@ -1,31 +0,0 @@
from kmk.boards.converter.fourtypercentclub.luddite import Firmware
from kmk.keys import KC
keyboard = Firmware()
_______ = KC.TRNS
XXXXXXX = KC.NO
BASE = 0
FN1 = 1
keyboard.keymap = [
[
KC.GESC, KC.N1, KC.N2, KC.N3, KC.N4, KC.N5, KC.N6, KC.N7, KC.N8, KC.N9, KC.N0, KC.MINS, KC.EQL, KC.BSPC,
KC.TAB, KC.Q, KC.W, KC.E, KC.R, KC.T, KC.Y, KC.U, KC.I, KC.O, KC.P, KC.LBRC, KC.RBRC, KC.BSLS,
KC.CAPS, KC.A, KC.S, KC.D, KC.F, KC.G, KC.H, KC.J, KC.K, KC.L, KC.SCLN, KC.QUOT, KC.ENT,
KC.LSFT, KC.Z, KC.X, KC.C, KC.V, KC.B, KC.N, KC.M, KC.COMM, KC.DOT, KC.SLSH, KC.RSFT,
KC.LCTL, KC.LGUI, KC.LALT, KC.SPC, KC.RALT, KC.RGUI, KC.MO(FN1), KC.RCTL,
],
[
KC.GESC, KC.F1, KC.F2, KC.F3, KC.F4, KC.F5, KC.F6, KC.F7, KC.F8, KC.F9, KC.F10, KC.F11, KC.F12, KC.BSPC,
KC.RGB_TOG, _______, KC.UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, KC.LEFT, KC.DOWN, KC.RGHT, _______, _______, _______, _______, _______, _______, _______, _______, _______,
KC.LED_INC, KC.LED_DEC, KC.LED_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______,
KC.GRV, _______, _______, _______, _______, _______, _______, _______,
],
]
if __name__ == '__main__':
keyboard.go()

View File

@ -1,137 +0,0 @@
from kmk.boards.converter.keebio.nyquist_r2 import Firmware
from kmk.keys import KC
keyboard = Firmware()
_______ = KC.TRNS
XXXXXXX = KC.NO
LOWER = KC.MO(3)
RAISE = KC.MO(4)
ADJUST = KC.MO(5)
keyboard.keymap = [
# Qwerty
# ,-----------------------------------------------------------------------------------.
# | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
# |------+------+------+------+------+------+------+------+------+------+------+------|
# | Tab | Q | W | E | R | T | Y | U | I | O | P | Del |
# |------+------+------+------+------+-------------+------+------+------+------+------|
# | Esc | A | S | D | F | G | H | J | K | L | ; | " |
# |------+------+------+------+------+------|------+------+------+------+------+------|
# | Shift| Z | X | C | V | B | N | M | , | . | / |Enter |
# |------+------+------+------+------+------+------+------+------+------+------+------|
# |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right |
# `-----------------------------------------------------------------------------------'
[
KC.GRV, KC.N1, KC.N2, KC.N3, KC.N4, KC.N5, KC.N6, KC.N7, KC.N8, KC.N9, KC.N0, KC.BSPC,
KC.TAB, KC.Q, KC.W, KC.E, KC.R, KC.T, KC.Y, KC.U, KC.I, KC.O, KC.P, KC.DEL,
KC.ESC, KC.A, KC.S, KC.D, KC.F, KC.G, KC.H, KC.J, KC.K, KC.L, KC.SCLN, KC.QUOT,
KC.LSFT, KC.Z, KC.X, KC.C, KC.V, KC.B, KC.N, KC.M, KC.COMM, KC.DOT, KC.SLSH, KC.ENT,
ADJUST, KC.LCTL, KC.LALT, KC.LGUI, LOWER, KC.SPC, KC.SPC, RAISE, KC.LEFT, KC.DOWN, KC.UP, KC.RGHT,
],
# Colemak
# ,-----------------------------------------------------------------------------------.
# | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
# |------+------+------+------+------+------+------+------+------+------+------+------|
# | Tab | Q | W | F | P | G | J | L | U | Y | ; | Del |
# |------+------+------+------+------+-------------+------+------+------+------+------|
# | Esc | A | R | S | T | D | H | N | E | I | O | " |
# |------+------+------+------+------+------|------+------+------+------+------+------|
# | Shift| Z | X | C | V | B | K | M | , | . | / |Enter |
# |------+------+------+------+------+------+------+------+------+------+------+------|
# |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right |
# `-----------------------------------------------------------------------------------'
[
KC.GRV, KC.N1, KC.N2, KC.N3, KC.N4, KC.N5, KC.N6, KC.N7, KC.N8, KC.N9, KC.N0, KC.BSPC,
KC.TAB, KC.Q, KC.W, KC.F, KC.P, KC.G, KC.J, KC.L, KC.U, KC.Y, KC.SCLN, KC.DEL,
KC.ESC, KC.A, KC.R, KC.S, KC.T, KC.D, KC.H, KC.N, KC.E, KC.I, KC.O, KC.QUOT,
KC.LSFT, KC.Z, KC.X, KC.C, KC.V, KC.B, KC.K, KC.M, KC.COMM, KC.DOT, KC.SLSH, KC.ENT,
ADJUST, KC.LCTL, KC.LALT, KC.LGUI, LOWER, KC.SPC, KC.SPC, RAISE, KC.LEFT, KC.DOWN, KC.UP, KC.RGHT,
],
# Dvorak
# ,-----------------------------------------------------------------------------------.
# | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
# |------+------+------+------+------+------+------+------+------+------+------+------|
# | Tab | " | , | . | P | Y | F | G | C | R | L | Del |
# |------+------+------+------+------+-------------+------+------+------+------+------|
# | Esc | A | O | E | U | I | D | H | T | N | S | / |
# |------+------+------+------+------+------|------+------+------+------+------+------|
# | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter |
# |------+------+------+------+------+------+------+------+------+------+------+------|
# |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right |
# `-----------------------------------------------------------------------------------'
[
KC.GRV, KC.N1, KC.N2, KC.N3, KC.N4, KC.N5, KC.N6, KC.N7, KC.N8, KC.N9, KC.N0, KC.BSPC,
KC.TAB, KC.QUOT, KC.COMM, KC.DOT, KC.P, KC.Y, KC.F, KC.G, KC.C, KC.R, KC.L, KC.DEL,
KC.ESC, KC.A, KC.O, KC.E, KC.U, KC.I, KC.D, KC.H, KC.T, KC.N, KC.S, KC.SLSH,
KC.LSFT, KC.SCLN, KC.Q, KC.J, KC.K, KC.X, KC.B, KC.M, KC.W, KC.V, KC.Z, KC.ENT,
ADJUST, KC.LCTL, KC.LALT, KC.LGUI, LOWER, KC.SPC, KC.SPC, RAISE, KC.LEFT, KC.DOWN, KC.UP, KC.RGHT,
],
# Lower
# ,-----------------------------------------------------------------------------------.
# | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
# |------+------+------+------+------+-------------+------+------+------+------+------|
# | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Del |
# |------+------+------+------+------+-------------+------+------+------+------+------|
# | Del | F1 | F2 | F3 | F4 | F5 | F6 | . | + | | \ | | |
# |------+------+------+------+------+------|------+------+------+------+------+------|
# | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | | |Enter |
# |------+------+------+------+------+------+------+------+------+------+------+------|
# | | | | | | | | Next | Vol- | Vol+ | Play |
# `-----------------------------------------------------------------------------------'
[
KC.TILD, KC.EXLM, KC.AT, KC.HASH, KC.DLR, KC.PERC, KC.CIRC, KC.AMPR, KC.ASTR, KC.LPRN, KC.RPRN, KC.BSPC,
KC.TILD, KC.EXLM, KC.AT, KC.HASH, KC.DLR, KC.PERC, KC.CIRC, KC.AMPR, KC.ASTR, KC.LPRN, KC.RPRN, KC.DEL,
KC.DEL, KC.F1, KC.F2, KC.F3, KC.F4, KC.F5, KC.F6, KC.UNDS, KC.PLUS, KC.LCBR, KC.RCBR, KC.PIPE,
_______, KC.F7, KC.F8, KC.F9, KC.F10, KC.F11, KC.F12, KC.NUHS, KC.NUBS, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, KC.MNXT, KC.VOLD, KC.VOLU, KC.MPLY,
],
# Raise
# ,-----------------------------------------------------------------------------------.
# | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
# |------+------+------+------+------+-------------+------+------+------+------+------|
# | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Del |
# |------+------+------+------+------+-------------+------+------+------+------+------|
# | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ |
# |------+------+------+------+------+------|------+------+------+------+------+------|
# | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | | |Enter |
# |------+------+------+------+------+------+------+------+------+------+------+------|
# | | | | | | | | Next | Vol- | Vol+ | Play |
# `-----------------------------------------------------------------------------------'
[
KC.GRV, KC.N1, KC.N2, KC.N3, KC.N4, KC.N5, KC.N6, KC.N7, KC.N8, KC.N9, KC.N0, KC.BSPC,
KC.GRV, KC.N1, KC.N2, KC.N3, KC.N4, KC.N5, KC.N6, KC.N7, KC.N8, KC.N9, KC.N0, KC.DEL,
KC.DEL, KC.F1, KC.F2, KC.F3, KC.F4, KC.F5, KC.F6, KC.MINS, KC.EQL, KC.LBRC, KC.RBRC, KC.BSLS,
_______, KC.F7, KC.F8, KC.F9, KC.F10, KC.F11, KC.F12, KC.NUHS, KC.NUBS, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, KC.MNXT, KC.VOLD, KC.VOLU, KC.MPLY,
],
# Adjust
# ,-----------------------------------------------------------------------------------.
# | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 |
# |------+------+------+------+------+------+------+------+------+------+------+------|
# | | Reset|RGB Tg|RGB Md|Hue Up|Hue Dn|Sat Up|Sat Dn|Val Up|Val Dn| | Del |
# |------+------+------+------+------+-------------+------+------+------+------+------|
# | | | | | | | |Qwerty|Colemk|Dvorak| | |
# |------+------+------+------+------+------|------+------+------+------+------+------|
# | | | | | | | | | | | | |
# |------+------+------+------+------+------+------+------+------+------+------+------|
# | | | | | | | | | | | |
# `-----------------------------------------------------------------------------------'
[
KC.F1, KC.F2, KC.F3, KC.F4, KC.F5, KC.F6, KC.F7, KC.F8, KC.F9, KC.F10, KC.F11, KC.F12,
_______, _______, KC.RGB.TOG, KC.RGB.MOD, KC.RGB.HUD, KC.RGB.HUI, KC.RGB.SAD, KC.RGB.SAI, KC.RGB.VAD, KC.RGB.VAI, _______, KC.DEL,
_______, _______, _______, _______, _______, _______, _______, KC.DF(0), KC.DF(1), KC.DF(2), _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
],
]
if __name__ == '__main__':
keyboard.go()

View File

@ -49,7 +49,7 @@ WPM = send_string("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed
keyboard.keymap = [
[
# default
# Default
KC.GESC, KC.QUOTE, KC.COMMA, KC.DOT, KC.P, KC.Y, KC.F, KC.G, KC.C, KC.R, KC.L, KC.BKSP,
KC.TAB, KC.A, KC.O, KC.E, KC.U, KC.I, KC.D, KC.H, KC.T, KC.N, KC.S, KC.ENT,
KC.LSFT, KC.SCLN, KC.Q, KC.J, KC.K, KC.X, KC.B, KC.M, KC.W, KC.V, KC.Z, KC.SLSH,

View File

@ -1,10 +1,24 @@
from kmk.boards.converter.keebio.levinson_r2 import Firmware
from kmk.consts import LeaderMode, UnicodeMode
import board
import busio
from kmk.consts import DiodeOrientation, LeaderMode, UnicodeMode
from kmk.handlers.sequences import compile_unicode_string_sequences
from kmk.keys import KC
from kmk.mcus.circuitpython_samd51 import Firmware
from kmk.pins import Pin as P
keyboard = Firmware()
keyboard.col_pins = (P.A2, P.A3, P.A4, P.A5, P.SCK, P.MOSI)
keyboard.row_pins = (P.D13, P.D11, P.D10, P.D9)
keyboard.diode_orientation = DiodeOrientation.COLUMNS
keyboard.split_type = "UART"
keyboard.split_flip = True
keyboard.split_offsets = [6, 6, 6, 6]
keyboard.uart_pin = board.SCL
keyboard.extra_data_pin = board.SDA
# ------------------User level config variables ---------------------------------------
keyboard.leader_mode = LeaderMode.TIMEOUT
keyboard.unicode_mode = UnicodeMode.LINUX
@ -12,19 +26,6 @@ keyboard.tap_time = 150
keyboard.leader_timeout = 2000
keyboard.debug_enabled = True
keyboard.rgb_config['num_pixels'] = 16
keyboard.rgb_config['val_limit'] = 150
keyboard.rgb_config['hue_step'] = 10
keyboard.rgb_config['sat_step'] = 5
keyboard.rgb_config['val_step'] = 5
keyboard.rgb_config['hue_default'] = 260
keyboard.rgb_config['sat_default'] = 100
keyboard.rgb_config['val_default'] = 20
keyboard.rgb_config['knight_effect_length'] = 6
keyboard.rgb_config['animation_mode'] = 'swirl'
keyboard.rgb_config['animation_speed'] = 2
keyboard.debug_enabled = False
emoticons = compile_unicode_string_sequences({
# Emoticons, but fancier
'ANGRY_TABLE_FLIP': r'(ノಠ痊ಠ)ノ彡┻━┻',
@ -53,11 +54,11 @@ keyboard.leader_dictionary = {
keyboard.keymap = [
[
# default
# Default
KC.GESC, KC.QUOTE, KC.COMMA, KC.DOT, KC.P, KC.Y, KC.F, KC.G, KC.C, KC.R, KC.L, KC.BKSP,
KC.TAB, KC.A, KC.O, KC.E, KC.U, KC.I, KC.D, KC.H, KC.T, KC.N, KC.S, KC.ENT,
KC.LSFT, KC.SCLN, KC.Q, KC.J, KC.K, KC.X, KC.B, KC.M, KC.W, KC.V, KC.Z, KC.SLSH,
KC.LCTRL, KC.LGUI, KC.LALT, KC.RGB_TOG, KC.MO(2), KC.LT(3, KC.SPC), KC.LT(3, KC.SPC), KC.MO(4), KC.LEFT, KC.DOWN, KC.UP, KC.RIGHT,
KC.LCTRL, KC.LGUI, KC.LALT, KC.LEAD, KC.MO(2), KC.LT(3, KC.SPC), KC.LT(3, KC.SPC), KC.MO(4), KC.LEFT, KC.DOWN, KC.UP, KC.RIGHT,
],
[
# Gaming

View File

@ -1,69 +0,0 @@
from kmk.boards.converter.fourtypercentclub.luddite import Firmware
from kmk.keys import KC
keyboard = Firmware()
# ---------------------------------- Config --------------------------------------------
keyboard.tap_time = 150
keyboard.rgb_config['num_pixels'] = 16
keyboard.rgb_config['val_limit'] = 150
keyboard.rgb_config['hue_step'] = 10
keyboard.rgb_config['sat_step'] = 5
keyboard.rgb_config['val_step'] = 5
keyboard.rgb_config['hue_default'] = 260
keyboard.rgb_config['sat_default'] = 100
keyboard.rgb_config['val_default'] = 0
keyboard.rgb_config['knight_effect_length'] = 6
keyboard.rgb_config['animation_mode'] = 'static'
keyboard.rgb_config['animation_speed'] = 2
keyboard.debug_enabled = False
# ---------------------- Custom Functions --------------------------------------------
_______ = KC.TRNS
XXXXXXX = KC.NO
HOME = KC.MT(KC.HOME, KC.LSFT)
END = KC.MT(KC.END, KC.RSFT)
BASE = 0
GAMING = 1
FN1 = 2
# ---------------------- Keymap ---------------------------------------------------------
keyboard.keymap = [
# df
[
KC.GESC, KC.N1, KC.N2, KC.N3, KC.N4, KC.N5, KC.N6, KC.N7, KC.N8, KC.N9, KC.N0, KC.LBRC, KC.RBRC, KC.BSPC,
KC.LEAD, KC.QUOT, KC.COMM, KC.DOT, KC.P, KC.Y, KC.F, KC.G, KC.C, KC.R, KC.L, KC.SLSH, KC.EQL, KC.BSLS,
KC.TAB, KC.A, KC.O, KC.E, KC.U, KC.I, KC.D, KC.H, KC.T, KC.N, KC.S, KC.MINS, KC.ENT,
HOME, KC.SCLN, KC.Q, KC.J, KC.K, KC.X, KC.B, KC.M, KC.W, KC.V, KC.Z, END,
KC.LCTL, KC.LGUI, KC.MO(FN1), KC.SPC, KC.LEFT, KC.DOWN, KC.UP, KC.RIGHT,
],
# df
[
KC.GESC, KC.N1, KC.N2, KC.N3, KC.N4, KC.N5, KC.N6, KC.N7, KC.N8, KC.N9, KC.N0, KC.LBRC, KC.RBRC, KC.BSPC,
KC.LEAD, KC.QUOT, KC.COMM, KC.DOT, KC.P, KC.Y, KC.F, KC.G, KC.C, KC.R, KC.L, KC.SLSH, KC.EQL, KC.BSLS,
KC.TAB, KC.A, KC.O, KC.E, KC.U, KC.I, KC.D, KC.H, KC.T, KC.N, KC.S, KC.MINS, KC.ENT,
KC.LSFT, KC.SCLN, KC.Q, KC.J, KC.K, KC.X, KC.B, KC.M, KC.W, KC.V, KC.Z, KC.RSFT,
KC.LCTL, KC.LGUI, KC.MO(FN1), KC.SPC, KC.LEFT, KC.DOWN, KC.UP, KC.RIGHT,
],
# fn
[
KC.GESC, KC.F1, KC.F2, KC.F3, KC.F4, KC.F5, KC.F6, KC.F7, KC.F8, KC.F9, KC.F10, KC.F11, KC.F12, KC.DEL,
KC.RGB_TOG, KC.RGB_HUD, KC.RGB_HUI, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC.VOLU, _______,
_______, KC.RGB_SAD, KC.RGB_SAI, _______, _______, _______, _______, _______, _______, _______, _______, KC.VOLD, _______,
_______, KC.RGB_VAD, KC.RGB_VAI, _______, _______, _______, _______, _______, _______, _______, _______, _______,
KC.RGB_M_K, _______, _______, _______, KC.LALT, KC.RGB_M_S, KC.DF(0), KC.DF(1),
],
]
if __name__ == '__main__':
keyboard.go()

View File

@ -0,0 +1,111 @@
import board
import busio
from kmk.consts import DiodeOrientation, LeaderMode, UnicodeMode
from kmk.handlers.sequences import (compile_unicode_string_sequences,
simple_key_sequence)
from kmk.keys import KC
from kmk.mcus.circuitpython_samd51 import Firmware
from kmk.pins import Pin as P
keyboard = Firmware()
keyboard.col_pins = (P.RX, P.A1, P.A2, P.A3, P.A4, P.A5)
keyboard.row_pins = (P.D13, P.D11, P.D10, P.D9, P.D7)
keyboard.diode_orientation = DiodeOrientation.COLUMNS
keyboard.split_type = "UART"
keyboard.split_flip = True
keyboard.split_offsets = [6, 6, 6, 6, 6]
keyboard.uart_pin = board.SCL
keyboard.extra_data_pin = board.SDA
# ------------------User level config variables ---------------------------------------
keyboard.leader_mode = LeaderMode.TIMEOUT
keyboard.unicode_mode = UnicodeMode.LINUX
keyboard.tap_time = 150
keyboard.leader_timeout = 2000
keyboard.debug_enabled = True
emoticons = compile_unicode_string_sequences({
# Emoticons, but fancier
'ANGRY_TABLE_FLIP': r'(ノಠ痊ಠ)ノ彡┻━┻',
'CHEER': r'+。:.゚ヽ(´∀。)ノ゚.:。+゚゚+。:.゚ヽ(*´∀)ノ゚.:。+゚',
'TABLE_FLIP': r'(╯°□°)╯︵ ┻━┻',
'WAT': r'⊙.☉',
'FF': r'凸(゚Д゚#)',
'F': r'( ̄^ ̄)凸',
'MEH': r'╮( ̄_ ̄)╭',
'YAY': r'o(^▽^)o',
})
# ---------------------- Leader Key Macros --------------------------------------------
keyboard.leader_dictionary = {
'flip': emoticons.ANGRY_TABLE_FLIP,
'cheer': emoticons.CHEER,
'wat': emoticons.WAT,
'ff': emoticons.FF,
'f': emoticons.F,
'meh': emoticons.MEH,
'yay': emoticons.YAY,
'gw': KC.DF(1),
}
_______ = KC.TRNS
XXXXXXX = KC.NO
LT3_SP = KC.LT(3, KC.SPC)
SHFT_INS = KC.LSHIFT(KC.INS)
df = 0
gw = 1
r1 = 2
r2 = 3
r3 = 4
# ---------------------- Keymap ---------------------------------------------------------
keyboard.keymap = [
[
# df
[KC.GESC, KC.N1, KC.N2, KC.N3, KC.N4, KC.N5, KC.N6, KC.N7, KC.N8, KC.N9, KC.N0, KC.DEL],
[KC.GRV, KC.QUOTE, KC.COMMA, KC.DOT, KC.P, KC.Y, KC.F, KC.G, KC.C, KC.R, KC.L, KC.BKSP],
[KC.TAB, KC.A, KC.O, KC.E, KC.U, KC.I, KC.D, KC.H, KC.T, KC.N, KC.S, KC.ENT],
[KC.LSFT, KC.SCLN, KC.Q, KC.J, KC.K, KC.X, KC.B, KC.M, KC.W, KC.V, KC.Z, KC.SLSH],
[KC.LCTRL, KC.LGUI, KC.LALT, KC.LEAD, KC.MO(r1), LT3_SP, LT3_SP, KC.MO(r3), KC.LEFT, KC.DOWN, KC.UP, KC.RIGHT],
],
[
# gw
[KC.GESC, KC.N1, KC.N2, KC.N3, KC.N4, KC.N5, KC.N6, KC.N7, KC.N8, KC.N9, KC.N0, KC.DEL],
[KC.TAB, KC.QUOT, KC.COMM, KC.DOT, KC.P, KC.Y, KC.F, KC.G, KC.C, KC.R, KC.L, KC.BKSP],
[KC.ESC, KC.A, KC.O, KC.E, KC.U, KC.I, KC.D, KC.H, KC.T, KC.N, KC.S, KC.ENT],
[KC.LSFT, KC.SCLN, KC.Q, KC.J, KC.K, KC.X, KC.B, KC.M, KC.W, KC.V, KC.Z, KC.SLSH],
[KC.LCTRL, KC.LGUI, KC.LALT, KC.F1, KC.F2, KC.SPC, KC.SPC, KC.MO(r3), KC.LEFT, KC.DOWN, KC.UP, KC.RIGHT],
],
[
# r1
[KC.GESC, KC.N1, KC.N2, KC.N3, KC.N4, KC.N5, KC.N6, KC.N7, KC.N8, KC.N9, KC.N0, KC.DEL],
[KC.TILD, KC.EXLM, KC.AT, KC.HASH, KC.DLR, KC.PERC, KC.CIRC, KC.AMPR, KC.ASTR, KC.LPRN, KC.RPRN, KC.DEL],
[_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC.LBRC, KC.RBRC, KC.BSLS],
[_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC.INS, _______, _______, KC.MINS],
[KC.RESET, _______, _______, _______, _______, XXXXXXX, XXXXXXX, KC.EQL, KC.HOME, KC.PGDN, KC.PGUP, KC.END],
],
[
# r2
[KC.GESC, KC.N1, KC.N2, KC.N3, KC.N4, KC.N5, KC.N6, KC.N7, KC.N8, KC.N9, KC.N0, KC.DEL],
[_______, _______, _______, _______, _______, _______, _______, _______, KC.N7, KC.N8, KC.N9, KC.BKSP],
[_______, _______, _______, _______, _______, _______, _______, _______, KC.N4, KC.N5, KC.N6, XXXXXXX],
[_______, _______, _______, _______, _______, _______, _______, _______, KC.N1, KC.N2, KC.N3, XXXXXXX],
[_______, _______, _______, _______, _______, _______, _______, _______, KC.N0, KC.N0, KC.PDOT, KC.ENT],
],
[
# r3
[KC.GESC, KC.N1, KC.N2, KC.N3, KC.N4, KC.N5, KC.N6, KC.N7, KC.F10, KC.F11, KC.F12, KC.DEL],
[_______, _______, _______, _______, _______, _______, _______, _______, KC.F7, KC.F8, KC.F9, SHFT_INS],
[_______, _______, _______, _______, _______, _______, _______, _______, KC.F4, KC.F5, KC.F6, KC.VOLU],
[_______, _______, _______, _______, _______, _______, _______, _______, KC.F1, KC.F2, KC.F4, KC.VOLD],
[KC.DF(df), KC.DF(gw), _______, _______, _______, _______, _______, _______, _______, _______, _______, XXXXXXX],
],
]
if __name__ == '__main__':
keyboard.go()

View File

@ -1,80 +0,0 @@
from kmk.boards.converter.keebio.nyquist_r2 import Firmware
from kmk.keys import KC
keyboard = Firmware()
# ------------------User level config variables ---------------------------------------
keyboard.tap_time = 150
keyboard.leader_timeout = 2000
keyboard.debug_enabled = False
# RGB Config (underglow)
keyboard.rgb_config['num_pixels'] = 12
keyboard.rgb_config['val_limit'] = 150
keyboard.rgb_config['hue_step'] = 10
keyboard.rgb_config['sat_step'] = 5
keyboard.rgb_config['val_step'] = 5
keyboard.rgb_config['hue_default'] = 260
keyboard.rgb_config['sat_default'] = 100
keyboard.rgb_config['val_default'] = 20
keyboard.rgb_config['knight_effect_length'] = 4
keyboard.rgb_config['animation_mode'] = 'static'
keyboard.rgb_config['animation_speed'] = 1
keyboard.debug_enabled = False
_______ = KC.TRNS
XXXXXXX = KC.NO
SHFT_INS = KC.LSHIFT(KC.INS)
BASE = KC.DF(0)
LT2_SP = KC.LT(3, KC.SPC)
GAMING = KC.DF(1)
# ---------------------- Keymap ---------------------------------------------------------
keyboard.keymap = [
[
# df
KC.GESC, KC.N1, KC.N2, KC.N3, KC.N4, KC.N5, KC.N6, KC.N7, KC.N8, KC.N9, KC.N0, KC.DEL,
KC.GRV, KC.QUOTE, KC.COMMA, KC.DOT, KC.P, KC.Y, KC.F, KC.G, KC.C, KC.R, KC.L, KC.BKSP,
KC.TAB, KC.A, KC.O, KC.E, KC.U, KC.I, KC.D, KC.H, KC.T, KC.N, KC.S, KC.ENT,
KC.LSFT, KC.SCLN, KC.Q, KC.J, KC.K, KC.X, KC.B, KC.M, KC.W, KC.V, KC.Z, KC.SLSH,
KC.LCTRL, KC.LGUI, KC.LALT, KC.RGB_TOG, KC.MO(2), LT2_SP, LT2_SP, KC.MO(4), KC.LEFT, KC.DOWN, KC.UP, KC.RIGHT,
],
[
# gw
KC.GESC, KC.N1, KC.N2, KC.N3, KC.N4, KC.N5, KC.N6, KC.N7, KC.N8, KC.N9, KC.N0, KC.DEL,
KC.TAB, KC.QUOT, KC.COMM, KC.DOT, KC.P, KC.Y, KC.F, KC.G, KC.C, KC.R, KC.L, KC.BKSP,
KC.ESC, KC.A, KC.O, KC.E, KC.U, KC.I, KC.D, KC.H, KC.T, KC.N, KC.S, KC.ENT,
KC.LSFT, KC.SCLN, KC.Q, KC.J, KC.K, KC.X, KC.B, KC.M, KC.W, KC.V, KC.Z, KC.SLSH,
KC.LCTRL, KC.LGUI, KC.LALT, KC.F1, KC.F2, KC.SPC, LT2_SP, KC.MO(4), KC.LEFT, KC.DOWN, KC.UP, KC.RIGHT,
],
[
# r1
KC.GESC, KC.N1, KC.N2, KC.N3, KC.N4, KC.N5, KC.N6, KC.N7, KC.N8, KC.N9, KC.N0, KC.DEL,
KC.TILD, KC.EXLM, KC.AT, KC.HASH, KC.DLR, KC.PERC, KC.CIRC, KC.AMPR, KC.ASTR, KC.LPRN, KC.RPRN, KC.DEL,
_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC.LBRC, KC.RBRC, KC.BSLS,
_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC.INS, _______, _______, KC.MINS,
KC.RESET, _______, _______, _______, _______, XXXXXXX, XXXXXXX, KC.EQL, KC.HOME, KC.PGDN, KC.PGUP, KC.END,
],
[
# r2
KC.GESC, KC.N1, KC.N2, KC.N3, KC.N4, KC.N5, KC.N6, KC.N7, KC.N8, KC.N9, KC.N0, KC.DEL,
_______, _______, _______, _______, _______, _______, _______, _______, KC.N7, KC.N8, KC.N9, KC.BKSP,
_______, _______, _______, _______, _______, _______, _______, _______, KC.N4, KC.N5, KC.N6, XXXXXXX,
_______, _______, _______, _______, _______, _______, _______, _______, KC.N1, KC.N2, KC.N3, XXXXXXX,
_______, _______, _______, _______, _______, _______, _______, _______, KC.N0, KC.N0, KC.PDOT, KC.ENT,
],
[
# r3
KC.GESC, KC.RGB_M_P, KC.RGB_M_K, KC.RGB_M_B, KC.RGB_M_BR, KC.RGB_M_S, _______, _______, KC.F10, KC.F11, KC.F12, KC.DEL,
KC.RGB_ANI, KC.RGB_HUD, KC.RGB_HUI, _______, _______, _______, _______, _______, KC.F7, KC.F8, KC.F9, SHFT_INS,
KC.RGB_AND, KC.RGB_SAD, KC.RGB_SAI, _______, _______, _______, _______, _______, KC.F4, KC.F5, KC.F6, KC.VOLU,
_______, KC.RGB_VAD, KC.RGB_VAI, _______, _______, _______, _______, _______, KC.F1, KC.F2, KC.F4, KC.VOLD,
BASE, GAMING, _______, _______, _______, _______, _______, _______, _______, _______, _______, XXXXXXX,
],
]
if __name__ == '__main__':
keyboard.go()

View File

@ -1,7 +1,7 @@
from kmk.boards.converter.keebio.iris_r2 import Firmware
from kmk.boards.kitsym4_iris import Firmware
from kmk.consts import LeaderMode, UnicodeMode
from kmk.handlers.sequences import compile_unicode_string_sequences as cuss
from kmk.handlers.sequences import send_string
from kmk.handlers.sequences import send_string, simple_key_sequence
from kmk.keys import KC
keyboard = Firmware()