updated some button functions to media buttons
This commit is contained in:
parent
7753055416
commit
4368632c3b
1 changed files with 12 additions and 9 deletions
21
code.py
21
code.py
|
@ -6,6 +6,7 @@ from adafruit_hid.keyboard import Keyboard
|
|||
from adafruit_hid.keycode import Keycode
|
||||
from adafruit_hid.mouse import Mouse
|
||||
from adafruit_hid.consumer_control import ConsumerControl
|
||||
from adafruit_hid.consumer_control_code import ConsumerControlCode
|
||||
|
||||
led = DigitalInOut(board.LED)
|
||||
led.direction = Direction.OUTPUT
|
||||
|
@ -28,10 +29,10 @@ pins = [
|
|||
]
|
||||
|
||||
def press(key):
|
||||
if key == 0: # xf86copy
|
||||
ctl.send(0x21B)
|
||||
elif key == 1: # xf86paste
|
||||
ctl.send(0x21D)
|
||||
if key == 0:
|
||||
ctl.send(ConsumerControlCode.VOLUME_INCREMENT)
|
||||
elif key == 1:
|
||||
ctl.send(ConsumerControlCode.PLAY_PAUSE)
|
||||
elif key == 2:
|
||||
mse.press(Mouse.MIDDLE_BUTTON)
|
||||
elif key == 3:
|
||||
|
@ -40,11 +41,13 @@ def press(key):
|
|||
ctl.send(0x225) # forward (browser)
|
||||
elif key == 5:
|
||||
mse.press(Mouse.RIGHT_BUTTON)
|
||||
elif key == 6: # ctrl-w
|
||||
kbd.press(Keycode.CONTROL)
|
||||
kbd.press(Keycode.W)
|
||||
kbd.release(Keycode.W)
|
||||
kbd.release(Keycode.CONTROL)
|
||||
elif key == 6:
|
||||
ctl.send(ConsumerControlCode.VOLUME_DECREMENT)
|
||||
# ctrl-w
|
||||
#kbd.press(Keycode.CONTROL)
|
||||
#kbd.press(Keycode.W)
|
||||
#kbd.release(Keycode.W)
|
||||
#kbd.release(Keycode.CONTROL)
|
||||
elif key == 7:
|
||||
# toggles scroll mode in ploopy nano using maddie layout
|
||||
kbd.press(Keycode.KEYPAD_NUMLOCK)
|
||||
|
|
Loading…
Reference in a new issue