示例#1
0
class KMKKeyboard(_KMKKeyboard):
    # physical, visible cols (SCK, MO, MI, RX, TX, D4)
    # physical, visible rows (10, 11, 12, 13) (9, 6, 5, SCL)
    col_pins = (board.SCK, board.MOSI, board.MISO, board.RX, board.TX,
                board.D4)
    row_pins = (
        board.D10,
        board.D11,
        board.D12,
        board.D13,
        board.D9,
        board.D6,
        board.D5,
        board.SCL,
    )
    rollover_cols_every_rows = 4
    diode_orientation = DiodeOrientation.COLUMNS

    coord_mapping = []
    coord_mapping.extend(ic(0, x) for x in range(12))
    coord_mapping.extend(ic(1, x) for x in range(12))
    coord_mapping.extend(ic(2, x) for x in range(12))
    coord_mapping.extend(ic(3, r3_swap(x)) for x in range(12))

    layers_ext = Layers()
    modules = [layers_ext]
示例#2
0
    [
        (
            KC.VOLU,
            KC.VOLD,
            2,
        ),  #  Only 1 encoder is being used, so only one tuple per layer is required
    ],
    [
        (Zoom_in, Zoom_out, 1),
    ],
    [
        (_______, _______, 1),  #  no action taken by the encoder on this layer
    ],
]

layers_ext = Layers()

encoder_ext = EncoderHandler([board.D40], [board.D41], encoder_map)
encoder_ext.encoders[0].is_inverted = True

keyboard.modules = [layers_ext, encoder_ext]

keyboard.tap_time = 250
keyboard.debug_enabled = False

# custom keys
NEW = KC.LCTL(KC.N)
NEW_DIR = KC.LCTL(KC.LSFT(KC.N))
CAD = KC.LCTL(KC.LALT(KC.DEL))
RES = KC.LCTL(KC.LSFT(KC.ESC))
FE = KC.LGUI(KC.E)
示例#3
0
from kb import KMKKeyboard

from kmk.extensions.rgb import RGB
from kmk.handlers.sequences import send_string, simple_key_sequence
from kmk.keys import KC
from kmk.modules.layers import Layers
from kmk.modules.modtap import ModTap
from kmk.modules.split import Split

keyboard = KMKKeyboard()

# ------------------User level config variables ---------------------------------------
keyboard.tap_time = 150

layers = Layers()
modtap = ModTap()
rgb_ext = RGB(pixel_pin=keyboard.rgb_pixel_pin, num_pixels=27, val_limit=100, hue_default=190, sat_default=100, val_default=5)
split = Split()

keyboard.modules = [modtap, layers, split]
keyboard.extensions = [rgb_ext]

_______ = KC.TRNS
XXXXXXX = KC.NO
SHFT_INS = KC.LSHIFT(KC.INS)

BASE = KC.DF(0)
GAMING = KC.DF(1)
LT1_SP = KC.MO(2)
LT2_SP = KC.LT(3, KC.SPC)
示例#4
0
    def test_basic_kmk_keyboard(self):
        keyboard = KeyboardTest(
            [Layers(), ModTap(), OneShot()],
            [
                [
                    KC.MT(KC.A, KC.LCTL),
                    KC.LT(1, KC.B), KC.C, KC.D,
                    KC.OS(KC.E)
                ],
                [KC.N1, KC.N2, KC.N3, KC.N4, KC.N5],
            ],
            debug_enabled=False,
        )

        keyboard.test('MT tap behaviour', [(0, True), 100, (0, False)],
                      [{KC.A}, {}])

        keyboard.test('MT hold behaviour', [(0, True), 350, (0, False)],
                      [{KC.LCTL}, {}])

        # TODO test multiple mods being held

        # MT
        keyboard.test(
            'MT within tap time sequential -> tap behavior',
            [(0, True), 100, (0, False), (3, True), (3, False)],
            [{KC.A}, {}, {KC.D}, {}],
        )

        keyboard.test(
            'MT within tap time rolling -> hold behavior',
            [(0, True), 100, (3, True), 250, (0, False), (3, False)],
            [{KC.LCTL}, {KC.LCTL, KC.D}, {KC.D}, {}],
        )

        keyboard.test(
            'MT within tap time nested -> hold behavior',
            [(0, True), 100, (3, True), (3, False), 250, (0, False)],
            [{KC.LCTL}, {KC.LCTL, KC.D}, {KC.LCTL}, {}],
        )

        keyboard.test(
            'MT after tap time sequential -> hold behavior',
            [(0, True), 350, (0, False), (3, True), (3, False)],
            [{KC.LCTL}, {}, {KC.D}, {}],
        )

        keyboard.test(
            'MT after tap time rolling -> hold behavior',
            [(0, True), 350, (3, True), (0, False), (3, False)],
            [{KC.LCTL}, {KC.LCTL, KC.D}, {KC.D}, {}],
        )

        keyboard.test(
            'MT after tap time nested -> hold behavior',
            [(0, True), 350, (3, True), (3, False), (0, False)],
            [{KC.LCTL}, {KC.LCTL, KC.D}, {KC.LCTL}, {}],
        )

        # LT
        keyboard.test(
            'LT within tap time sequential -> tap behavior',
            [(1, True), 100, (1, False), (3, True), (3, False)],
            [{KC.B}, {}, {KC.D}, {}],
        )

        keyboard.test(
            'LT within tap time rolling -> tap behavior',
            [(1, True), 100, (3, True), 250, (1, False), (3, False)],
            [{KC.B}, {KC.B, KC.D}, {KC.D}, {}],
        )

        keyboard.test(
            'LT within tap time nested -> tap behavior',
            [(1, True), 100, (3, True), (3, False), 250, (1, False)],
            [{KC.B}, {KC.B, KC.D}, {KC.B}, {}],
        )

        keyboard.test(
            'LT after tap time sequential -> hold behavior',
            [(1, True), 350, (1, False), (3, True), (3, False)],
            [{KC.D}, {}],
        )

        keyboard.test(
            'LT after tap time rolling -> hold behavior',
            [(1, True), 350, (3, True), (1, False), (3, False)],
            [{KC.N4}, {}],
        )

        keyboard.test(
            'LT after tap time nested -> hold behavior',
            [(1, True), 350, (3, True), (3, False), (1, False)],
            [{KC.N4}, {}],
        )

        # TODO test TT

        # OS
        keyboard.test(
            'OS timed out',
            [(4, True), (4, False), 1050],
            [{KC.E}, {}],
        )

        keyboard.test(
            'OS interrupt within tap time',
            [(4, True), (4, False), 100, (3, True), (3, False)],
            [{KC.E}, {KC.D, KC.E}, {}],
        )

        keyboard.test(
            'OS hold with multiple interrupt keys',
            [(4, True), 100, (3, True), (3, False), (2, True), (2, False),
             (4, False)],
            [{KC.E}, {KC.D, KC.E}, {KC.E}, {KC.C, KC.E}, {KC.E}, {}],
        )
# Batreus44 designed by jpconstantineau
# https://github.com/jpconstantineau/Batreus44
# Board can use different controllers.
# Edit last 2 lines if you have a nRF52840 and want BLE

from kb import KMKKeyboard

from kmk.hid import HIDModes
from kmk.keys import KC
from kmk.modules.layers import Layers

keyboard = KMKKeyboard()
keyboard.modules.append(Layers())

FUN = KC.MO(1)
UPPER = KC.MO(2)
XXXXXXX = KC.TRNS

keyboard.keymap = [
    # Colemak Mod-DH See https://colemakmods.github.io/mod-dh/keyboards.html
    [
        KC.Q,
        KC.W,
        KC.F,
        KC.P,
        KC.B,
        KC.NO,
        KC.NO,
        KC.J,
        KC.L,
        KC.U,
示例#6
0
from keybow import Keybow

from kmk.extensions.media_keys import MediaKeys
from kmk.keys import KC
from kmk.modules.layers import Layers

keybow = Keybow()

# fmt: off
keybow.keymap = [
    [
        KC.A, KC.B, KC.C,
        KC.E, KC.F, KC.G,
        KC.I, KC.J, KC.K,
        KC.M, KC.N, KC.O,
    ]
]

keybow.extensions.extend([MediaKeys()])
keybow.modules.extend([Layers()])
# fmt: on

if __name__ == '__main__':
    keybow.go()