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