Adds support for Nice Nano, no BLE yet.

This commit is contained in:
Luke D Russell 2022-05-27 20:07:22 +10:00 committed by Kyle Brown
parent f816f24497
commit dde6efe6fe
6 changed files with 268 additions and 192 deletions

View File

@ -1,15 +1,18 @@
# Faux Fox Keyboard (ffkb)
![ffkb](https://github.com/sadekbaroudi/ffkb)
A 36 or 42 key keyboard with support for per key leds, 2 rotary encoders (EC11 or evqwgd001), and a feature in the center (EC11, OLED (128x64), or pimoroni trackball)
kb.py is designed to work with a pro micro or kb2040
- [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
Instructions:
* Copy the kmk directory as a whole into the root directory of your KB2040
* Copy <gitroot>/lib/neopixel* to <usbroot>/lib/
* Copy kb.py and main.py in this folder to <usbroot>/
# Faux Fox Keyboard (ffkb)
![ffkb](https://github.com/sadekbaroudi/ffkb)
A 36 or 42 key keyboard with support for per key LEDs, 2 rotary encoders (EC11 or evqwgd001), and a feature in the center (EC11, OLED (128x64), or pimoroni trackball)
kb.py is designed to work with a Pro Micro or KB2040, while kb-nn.py is designed to work with a Nice!Nano.
- [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
Instructions:
* Copy the kmk directory as a whole into the root directory of your KB2040
* Copy <gitroot>/lib/neopixel* to <usbroot>/lib/
* Copy kb.py and main.py in this folder to <usbroot>/
> Note: The Nice!Nano doesn't have a lot of ROM, see guidance [over here](../../docs/../../docs/Officially_Supported_Microcontrollers.md#nicenano).

View File

@ -1,38 +1,38 @@
import board
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
from kmk.matrix import DiodeOrientation
from kmk.matrix import intify_coordinate as ic
class KMKKeyboard(_KMKKeyboard):
col_pins = (
board.D9,
board.D8,
board.D7,
board.D6,
board.D5,
board.D4,
board.MOSI,
board.MISO,
)
row_pins = (
board.D1,
board.A3,
board.A2,
board.A1,
board.A0,
board.SCK,
)
diode_orientation = DiodeOrientation.COLUMNS
rgb_pixel_pin = board.D0
rgb_num_pixels = 42
i2c = board.I2C
coord_mapping = [
ic(0,0), ic(0,1), ic(0,2), ic(0,3), ic(0,4), ic(0,5), ic(0,6), ic(0,7), ic(4,3), ic(3,4), ic(4,5), ic(3,7),
ic(1,0), ic(1,1), ic(1,2), ic(1,3), ic(1,4), ic(1,5), ic(4,1), ic(1,6), ic(1,7), ic(3,2), ic(4,4), ic(3,5), ic(4,7),
ic(2,0), ic(2,1), ic(2,2), ic(2,3), ic(2,4), ic(2,5), ic(2,6), ic(2,7), ic(4,2), ic(3,3), ic(3,6), ic(4,6),
ic(5,1), ic(5,3), ic(5,4), ic(5,5), ic(5,6), ic(5,7), ic(5,2), ic(5,0)
]
import board
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
from kmk.matrix import DiodeOrientation
from kmk.matrix import intify_coordinate as ic
class KMKKeyboard(_KMKKeyboard):
col_pins = (
board.D9,
board.D8,
board.D7,
board.D6,
board.D5,
board.D4,
board.MOSI,
board.MISO,
)
row_pins = (
board.D1,
board.A3,
board.A2,
board.A1,
board.A0,
board.SCK,
)
diode_orientation = DiodeOrientation.COLUMNS
rgb_pixel_pin = board.D0
rgb_num_pixels = 42
i2c = board.I2C
coord_mapping = [
ic(0,0), ic(0,1), ic(0,2), ic(0,3), ic(0,4), ic(0,5), ic(0,6), ic(0,7), ic(4,3), ic(3,4), ic(4,5), ic(3,7),
ic(1,0), ic(1,1), ic(1,2), ic(1,3), ic(1,4), ic(1,5), ic(4,1), ic(1,6), ic(1,7), ic(3,2), ic(4,4), ic(3,5), ic(4,7),
ic(2,0), ic(2,1), ic(2,2), ic(2,3), ic(2,4), ic(2,5), ic(2,6), ic(2,7), ic(4,2), ic(3,3), ic(3,6), ic(4,6),
ic(5,1), ic(5,3), ic(5,4), ic(5,5), ic(5,6), ic(5,7), ic(5,2), ic(5,0)
]

View File

@ -0,0 +1,39 @@
import board
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
from kmk.scanners import DiodeOrientation
class KMKKeyboard(_KMKKeyboard):
col_pins = (
board.P1_06,
board.P1_04,
board.P0_11,
board.P1_00,
board.P0_24,
board.P0_22,
board.MOSI,
board.MISO,
)
row_pins = (
board.P0_08,
board.P0_31,
board.P0_29,
board.P0_02,
board.P1_15,
board.SCK,
)
diode_orientation = DiodeOrientation.COLUMNS
rgb_pixel_pin = board.P0_06
rgb_num_pixels = 42
i2c = board.I2C
coord_mapping = [
0, 1, 2, 3, 4, 5, 6, 7,35,28,37,31,
8, 9,10,11,12,13, 33, 14,15,26,36,29,39,
16,17,18,19,20,21, 22,23,34,27,30,38,
41, 43,44,45, 46,47,42, 40,
]
encoder_pins = ((board.P0_20, board.P0_17, board.P0_09, False))

View File

@ -1,138 +1,138 @@
import board
from kb import KMKKeyboard
from kmk.extensions.RGB import RGB
from kmk.keys import KC
from kmk.modules.layers import Layers
from kmk.modules.modtap import ModTap
from kmk.modules.encoder import EncoderHandler
from kmk.extensions.media_keys import MediaKeys
from kmk.modules.mouse_keys import MouseKeys
keyboard = KMKKeyboard()
keyboard.tap_time = 150
keyboard.debug_enabled = False
# Cleaner key names
_______ = KC.TRNS
XXXXXXX = KC.NO
# Adding extensions
rgb = RGB(pixel_pin=keyboard.rgb_pixel_pin, num_pixels=keyboard.rgb_num_pixels, val_limit=50, hue_default=190, sat_default=100, val_default=5)
modtap = ModTap()
layers = Layers()
media_keys = MediaKeys()
encoder_handler = EncoderHandler()
keyboard.modules = [layers, modtap]#, encoder_handler]
keyboard.modules.append(MouseKeys())
keyboard.extensions = [rgb, media_keys]
encoder_handler.pins = ((board.D3, board.D2, board.D10, False))
ZOOM_IN = KC.LCTRL(KC.EQUAL)
ZOOM_OUT = KC.LCTRL(KC.MINUS)
LYR_BASE, LYR_NAV, LYR_SYM, LYR_SNAV, LYR_MEDIA, LYR_MOUSE = 0, 1, 2, 3, 4, 5
NAV_ENT = KC.LT(LYR_NAV, KC.ENT)
SYM_SPC = KC.LT(LYR_SYM, KC.SPC)
SNAV_TAB = KC.LT(LYR_SNAV, KC.TAB)
MEDIA_BSPC = KC.LT(LYR_MEDIA, KC.BSPC)
MOUSE_M = KC.LT(LYR_MOUSE, KC.M)
# HOMEROW MODS
LCTL_A = KC.MT(KC.A, KC.LCTRL)
LGUI_R = KC.MT(KC.R, KC.LGUI)
LALT_S = KC.MT(KC.S, KC.LALT)
LSFT_T = KC.MT(KC.T, KC.LSFT)
RSFT_N = KC.MT(KC.N, KC.RSFT)
RALT_E = KC.MT(KC.E, KC.RALT)
RGUI_I = KC.MT(KC.I, KC.RGUI)
RCTL_O = KC.MT(KC.O, KC.RCTRL)
# OTHER SHORTCUTS
BRWSR_LFT = KC.LCTRL(KC.LSFT(KC.TAB))
BRWSR_RGHT = KC.LCTRL(KC.TAB)
DESK_LEFT = KC.LCTRL(KC.LGUI(KC.LEFT))
DESK_RIGHT = KC.LCTRL(KC.LGUI(KC.RIGHT))
CAPSWORD = _______ # TODO: IMPLEMENT THIS
#SHIFT NAV
SFT_PGUP = KC.LSFT(KC.PGUP)
SFT_PGDN = KC.LSFT(KC.PGDN)
SFT_HOME = KC.LSFT(KC.HOME)
SFT_END = KC.LSFT(KC.END)
SFT_UP = KC.LSFT(KC.UP)
SFT_DOWN = KC.LSFT(KC.DOWN)
SFT_LEFT = KC.LSFT(KC.LEFT)
SFT_RGHT = KC.LSFT(KC.RIGHT)
RGB_TOG = KC.RGB_TOG
RGB_HUI = KC.RGB_HUI
RGB_HUD = KC.RGB_HUI
RGB_SAI = KC.RGB_SAI
RGB_SAD = KC.RGB_SAD
RGB_VAI = KC.RGB_VAI
RGB_VAD = KC.RGB_VAD
RGB_ANI = KC.RGB_ANI
RGB_AND = KC.RGB_AND
RGB_M_P = KC.RGB_MODE_PLAIN
RGB_M_B = KC.RGB_MODE_BREATHE
RGB_M_R = KC.RGB_MODE_RAINBOW
RGB_M_BR = KC.RGB_MODE_BREATHE_RAINBOW
RGB_M_K = KC.RGB_MODE_KNIGHT
RGB_M_S = KC.RGB_MODE_SWIRL
keyboard.keymap = [
[ #COLEMAK-DH
KC.ESC, KC.Q, KC.W, KC.F, KC.P, KC.B, KC.J, KC.L, KC.U, KC.Y, KC.SCLN, KC.BSPC,
KC.CAPS, LCTL_A, LGUI_R, LALT_S, LSFT_T, KC.G, KC.MUTE, MOUSE_M, RSFT_N, RALT_E, RGUI_I, RCTL_O, KC.QUOT,
KC.SPC, KC.Z, KC.X, KC.C, KC.D, KC.V, KC.K, KC.H, KC.COMM, KC.DOT, KC.SLSH, KC.RSFT,
KC.MUTE, KC.DEL, NAV_ENT, SNAV_TAB, MEDIA_BSPC, SYM_SPC, KC.QUOT, KC.LCTRL(KC.BSPC)
],
[ #NAVIGATION
_______, KC.ESC, KC.PGUP, KC.UP, KC.PGDN, _______, KC.ASTR, KC.N7, KC.N8, KC.N9, KC.PLUS, _______,
_______, KC.HOME, KC.LEFT, KC.DOWN, KC.RIGHT, KC.END, _______, KC.SLSH, KC.N4, KC.N5, KC.N6, KC.MINS, _______,
_______, _______, _______, _______, _______, _______, KC.EQL, KC.N1, KC.N2, KC.N3, KC.N0, _______,
_______, _______, _______, _______, KC.BKSP, KC.SPC, KC.DOT, _______,
],
[ #SYMBOLS
_______, KC.EXLM, KC.AT, KC.HASH, KC.DLR, KC.PERC, KC.CIRC, KC.AMPR, KC.ASTR, KC.UNDS, KC.EQL, _______,
_______, KC.MINS, KC.LBRC, KC.LCBR, KC.LPRN, KC.LABK, _______, KC.RABK, KC.RPRN, KC.RCBR, KC.RBRC, KC.PLUS, _______,
_______, KC.CAPS, KC.GRV, BRWSR_LFT, DESK_LEFT, CAPSWORD, _______, DESK_RIGHT, BRWSR_RGHT, _______, KC.BSLS, _______,
_______, _______, KC.ENT, KC.TAB, _______, _______, _______, _______,
],
[ #SHIFT NAVIGATION
_______, _______, SFT_PGUP, SFT_UP, SFT_PGDN, _______, _______, _______, _______, _______, _______, _______,
_______, SFT_HOME, SFT_LEFT, SFT_DOWN, SFT_RGHT, SFT_END, _______, KC.VOLU, KC.MPLY, KC.MSTP, _______, _______, _______,
_______, _______, _______, _______, _______, KC.MUTE, KC.VOLD, KC.MPRV, KC.MNXT, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______,
],
[ #MEDIA
_______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, RGB_HUI, RGB_SAI, RGB_VAI, RGB_ANI, _______, RGB_M_P, RGB_M_B, RGB_M_R, RGB_M_BR, RGB_M_K, _______,
_______, _______, RGB_HUD, RGB_SAD, RGB_VAD, RGB_AND, RGB_M_S, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______,
],
[ #MOUSE
_______, KC.RESET, KC.MW_UP, KC.MS_UP, KC.MW_DN, _______, _______, _______, _______, _______, _______, _______,
_______, _______, KC.MS_LT, KC.MS_DN, KC.MS_RT, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______,
],
]
encoder_handler.map = [(( KC.VOLD, KC.VOLU, KC.MUTE)), # Layer 1
((ZOOM_OUT, ZOOM_IN, _______)), # Layer 2
((_______, _______, _______)), # Layer 3
((_______, _______, _______)), # Layer 4
((_______, _______, _______)), # Layer 5
((_______, _______, _______)), # Layer 6
]
if __name__ == '__main__':
keyboard.go()
import board
from kb import KMKKeyboard
from kmk.extensions.rgb import RGB
from kmk.keys import KC
from kmk.modules.layers import Layers
from kmk.modules.modtap import ModTap
from kmk.modules.encoder import EncoderHandler
from kmk.extensions.media_keys import MediaKeys
from kmk.modules.mouse_keys import MouseKeys
keyboard = KMKKeyboard()
keyboard.tap_time = 150
keyboard.debug_enabled = False
# Cleaner key names
_______ = KC.TRNS
XXXXXXX = KC.NO
# Adding extensions
rgb = RGB(pixel_pin=keyboard.rgb_pixel_pin, num_pixels=keyboard.rgb_num_pixels, val_limit=50, hue_default=190, sat_default=100, val_default=5)
modtap = ModTap()
layers = Layers()
media_keys = MediaKeys()
encoder_handler = EncoderHandler()
keyboard.modules = [layers, modtap]#, encoder_handler]
keyboard.modules.append(MouseKeys())
keyboard.extensions = [rgb, media_keys]
encoder_handler.pins = ((board.D3, board.D2, board.D10, False))
ZOOM_IN = KC.LCTRL(KC.EQUAL)
ZOOM_OUT = KC.LCTRL(KC.MINUS)
LYR_BASE, LYR_NAV, LYR_SYM, LYR_SNAV, LYR_MEDIA, LYR_MOUSE = 0, 1, 2, 3, 4, 5
NAV_ENT = KC.LT(LYR_NAV, KC.ENT)
SYM_SPC = KC.LT(LYR_SYM, KC.SPC)
SNAV_TAB = KC.LT(LYR_SNAV, KC.TAB)
MEDIA_BSPC = KC.LT(LYR_MEDIA, KC.BSPC)
MOUSE_M = KC.LT(LYR_MOUSE, KC.M)
# HOMEROW MODS
LCTL_A = KC.MT(KC.A, KC.LCTRL)
LGUI_R = KC.MT(KC.R, KC.LGUI)
LALT_S = KC.MT(KC.S, KC.LALT)
LSFT_T = KC.MT(KC.T, KC.LSFT)
RSFT_N = KC.MT(KC.N, KC.RSFT)
RALT_E = KC.MT(KC.E, KC.RALT)
RGUI_I = KC.MT(KC.I, KC.RGUI)
RCTL_O = KC.MT(KC.O, KC.RCTRL)
# OTHER SHORTCUTS
BRWSR_LFT = KC.LCTRL(KC.LSFT(KC.TAB))
BRWSR_RGHT = KC.LCTRL(KC.TAB)
DESK_LEFT = KC.LCTRL(KC.LGUI(KC.LEFT))
DESK_RIGHT = KC.LCTRL(KC.LGUI(KC.RIGHT))
CAPSWORD = _______ # TODO: IMPLEMENT THIS
#SHIFT NAV
SFT_PGUP = KC.LSFT(KC.PGUP)
SFT_PGDN = KC.LSFT(KC.PGDN)
SFT_HOME = KC.LSFT(KC.HOME)
SFT_END = KC.LSFT(KC.END)
SFT_UP = KC.LSFT(KC.UP)
SFT_DOWN = KC.LSFT(KC.DOWN)
SFT_LEFT = KC.LSFT(KC.LEFT)
SFT_RGHT = KC.LSFT(KC.RIGHT)
RGB_TOG = KC.RGB_TOG
RGB_HUI = KC.RGB_HUI
RGB_HUD = KC.RGB_HUI
RGB_SAI = KC.RGB_SAI
RGB_SAD = KC.RGB_SAD
RGB_VAI = KC.RGB_VAI
RGB_VAD = KC.RGB_VAD
RGB_ANI = KC.RGB_ANI
RGB_AND = KC.RGB_AND
RGB_M_P = KC.RGB_MODE_PLAIN
RGB_M_B = KC.RGB_MODE_BREATHE
RGB_M_R = KC.RGB_MODE_RAINBOW
RGB_M_BR = KC.RGB_MODE_BREATHE_RAINBOW
RGB_M_K = KC.RGB_MODE_KNIGHT
RGB_M_S = KC.RGB_MODE_SWIRL
keyboard.keymap = [
[ #COLEMAK-DH
KC.ESC, KC.Q, KC.W, KC.F, KC.P, KC.B, KC.J, KC.L, KC.U, KC.Y, KC.SCLN, KC.BSPC,
KC.CAPS, LCTL_A, LGUI_R, LALT_S, LSFT_T, KC.G, KC.MUTE, MOUSE_M, RSFT_N, RALT_E, RGUI_I, RCTL_O, KC.QUOT,
KC.SPC, KC.Z, KC.X, KC.C, KC.D, KC.V, KC.K, KC.H, KC.COMM, KC.DOT, KC.SLSH, KC.RSFT,
KC.MUTE, KC.DEL, NAV_ENT, SNAV_TAB, MEDIA_BSPC, SYM_SPC, KC.QUOT, KC.LCTRL(KC.BSPC)
],
[ #NAVIGATION
_______, KC.ESC, KC.PGUP, KC.UP, KC.PGDN, _______, KC.ASTR, KC.N7, KC.N8, KC.N9, KC.PLUS, _______,
_______, KC.HOME, KC.LEFT, KC.DOWN, KC.RIGHT, KC.END, _______, KC.SLSH, KC.N4, KC.N5, KC.N6, KC.MINS, _______,
_______, _______, _______, _______, _______, _______, KC.EQL, KC.N1, KC.N2, KC.N3, KC.N0, _______,
_______, _______, _______, _______, KC.BKSP, KC.SPC, KC.DOT, _______,
],
[ #SYMBOLS
_______, KC.EXLM, KC.AT, KC.HASH, KC.DLR, KC.PERC, KC.CIRC, KC.AMPR, KC.ASTR, KC.UNDS, KC.EQL, _______,
_______, KC.MINS, KC.LBRC, KC.LCBR, KC.LPRN, KC.LABK, _______, KC.RABK, KC.RPRN, KC.RCBR, KC.RBRC, KC.PLUS, _______,
_______, KC.CAPS, KC.GRV, BRWSR_LFT, DESK_LEFT, CAPSWORD, _______, DESK_RIGHT, BRWSR_RGHT, _______, KC.BSLS, _______,
_______, _______, KC.ENT, KC.TAB, _______, _______, _______, _______,
],
[ #SHIFT NAVIGATION
_______, _______, SFT_PGUP, SFT_UP, SFT_PGDN, _______, _______, _______, _______, _______, _______, _______,
_______, SFT_HOME, SFT_LEFT, SFT_DOWN, SFT_RGHT, SFT_END, _______, KC.VOLU, KC.MPLY, KC.MSTP, _______, _______, _______,
_______, _______, _______, _______, _______, KC.MUTE, KC.VOLD, KC.MPRV, KC.MNXT, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______,
],
[ #MEDIA
_______, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, RGB_HUI, RGB_SAI, RGB_VAI, RGB_ANI, _______, RGB_M_P, RGB_M_B, RGB_M_R, RGB_M_BR, RGB_M_K, _______,
_______, _______, RGB_HUD, RGB_SAD, RGB_VAD, RGB_AND, RGB_M_S, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______,
],
[ #MOUSE
_______, KC.RESET, KC.MW_UP, KC.MS_UP, KC.MW_DN, _______, _______, _______, _______, _______, _______, _______,
_______, _______, KC.MS_LT, KC.MS_DN, KC.MS_RT, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______,
],
]
encoder_handler.map = [(( KC.VOLD, KC.VOLU, KC.MUTE)), # Layer 1
((ZOOM_OUT, ZOOM_IN, _______)), # Layer 2
((_______, _______, _______)), # Layer 3
((_______, _______, _______)), # Layer 4
((_______, _______, _______)), # Layer 5
((_______, _______, _______)), # Layer 6
]
if __name__ == '__main__':
keyboard.go()

View File

@ -1 +0,0 @@
This is the firmware for the ffkb running on circuitpy

View File

@ -0,0 +1,35 @@
import board
import kb
from kmk.keys import KC
from kmk.modules.layers import Layers
from kmk.modules.encoder import EncoderHandler
encoder_handler = EncoderHandler()
encoder_handler.pins = kb.encoder_pins
keyboard = kb.KMKKeyboard()
keyboard.modules.append(Layers())
_______ = KC.TRNS
xxxxxxx = KC.NO
keyboard.keymap = [
[ #COLEMAK-DH
KC.TAB, KC.Q, KC.W, KC.F, KC.P, KC.B, KC.J, KC.L, KC.U, KC.Y, KC.SCLN, KC.BSPC,
KC.LCTL, KC.A, KC.R, KC.S, KC.T, KC.G, KC.NO, KC.H, KC.N, KC.E, KC.I, KC.O, KC.QUOT,
KC.LALT, KC.Z, KC.X, KC.C, KC.D, KC.V, KC.K, KC.H, KC.COMM, KC.DOT, KC.SLSH, KC.BSLS,
KC.NO, KC.LGUI, KC.LSFT, KC.BSPC, KC.MO(1), KC.SPC, KC.ENT, KC.NO,
],
[ #NAVIGATION
_______, KC.ESC, KC.PGUP, KC.UP, KC.PGDN, _______, KC.ASTR, KC.N7, KC.N8, KC.N9, KC.PLUS, _______,
_______, KC.HOME, KC.LEFT, KC.DOWN, KC.RIGHT, KC.END, _______, KC.SLSH, KC.N4, KC.N5, KC.N6, KC.MINS, _______,
_______, _______, _______, _______, _______, _______, KC.EQL, KC.N1, KC.N2, KC.N3, KC.N0, _______,
_______, _______, _______, _______, KC.BKSP, KC.SPC, KC.DOT, _______,
],
]
if __name__ == '__main__':
keyboard.go()