Keyboard layouts (#30)

* Make switching keyboard layouts easier

* Fix broken image link

* fix typos
This commit is contained in:
dbisu
2021-10-31 11:42:46 -05:00
committed by GitHub
parent 003cede2b3
commit df615dd645
2 changed files with 65 additions and 2 deletions

View File

@@ -1,7 +1,15 @@
import usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
# comment out these lines for non_US keyboards
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS as KeyboardLayout
from adafruit_hid.keycode import Keycode
# uncomment these lines for non_US keyboards
# replace LANG with appropriate language
#from keyboard_layout_win_LANG import KeyboardLayout
#from keycode_win_LANG import Keycode
import time
import digitalio
from board import *
@@ -74,7 +82,7 @@ def parseLine(line):
runScriptLine(newScriptLine)
kbd = Keyboard(usb_hid.devices)
layout = KeyboardLayoutUS(kbd)
layout = KeyboardLayout(kbd)
# sleep at the start to allow the device to be recognized by the host computer
time.sleep(.5)