2022-05-10 19:03:54 +02:00
|
|
|
import board
|
|
|
|
|
2022-07-30 12:52:34 +02:00
|
|
|
from kmk.extensions.media_keys import MediaKeys
|
2022-05-12 01:01:04 +02:00
|
|
|
from kmk.extensions.RGB import RGB, AnimationModes
|
2022-05-10 19:03:54 +02:00
|
|
|
from kmk.keys import KC
|
2022-07-30 12:52:34 +02:00
|
|
|
from kmk.kmk_keyboard import KMKKeyboard
|
2022-05-10 19:03:54 +02:00
|
|
|
from kmk.modules.encoder import EncoderHandler
|
2022-07-30 12:52:34 +02:00
|
|
|
from kmk.scanners.keypad import KeysScanner
|
|
|
|
|
|
|
|
knob = KMKKeyboard()
|
|
|
|
knob.matrix = KeysScanner([])
|
|
|
|
|
|
|
|
media_keys = MediaKeys()
|
|
|
|
knob.extensions.append(media_keys)
|
2022-05-10 19:03:54 +02:00
|
|
|
|
2022-07-30 12:52:34 +02:00
|
|
|
# Rotary encoders that also acts as keys
|
2022-05-10 19:03:54 +02:00
|
|
|
encoder_handler = EncoderHandler()
|
|
|
|
encoder_handler.pins = (
|
2022-07-30 12:52:34 +02:00
|
|
|
(board.D1, board.D2, board.D0),
|
|
|
|
(board.D9, board.D10, board.D3),
|
|
|
|
(board.D7, board.D8, board.D6),
|
2022-05-10 19:03:54 +02:00
|
|
|
)
|
|
|
|
encoder_handler.map = (
|
2022-07-30 12:52:34 +02:00
|
|
|
((KC.VOLD, KC.VOLU, KC.MUTE), (KC.UP, KC.DOWN, KC.A), (KC.RIGHT, KC.LEFT, KC.B)),
|
2022-05-10 19:03:54 +02:00
|
|
|
)
|
|
|
|
knob.modules.append(encoder_handler)
|
|
|
|
|
2022-07-30 12:52:34 +02:00
|
|
|
print('ANAVI Knobs 3')
|
|
|
|
|
2022-05-12 01:01:04 +02:00
|
|
|
rgb_ext = RGB(
|
|
|
|
pixel_pin=board.NEOPIXEL,
|
|
|
|
num_pixels=1,
|
|
|
|
val_limit=100,
|
|
|
|
val_default=25,
|
|
|
|
animation_mode=AnimationModes.RAINBOW,
|
|
|
|
)
|
|
|
|
knob.extensions.append(rgb_ext)
|
|
|
|
|
2022-07-30 12:52:34 +02:00
|
|
|
knob.keymap = [[KC.MUTE]]
|
2022-05-10 19:03:54 +02:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
knob.go()
|