mirror of
https://github.com/dbisu/pico-ducky.git
synced 2025-12-06 02:41:45 +00:00
Updating instructions for adding keyboard layouts
This commit is contained in:
@@ -43,6 +43,10 @@ The easiest way to so is by using a jumper wire between those pins as seen bello
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
## Adding non-US keybaords
|
||||||
|
|
||||||
|
Instructions for adding non-US keyboards can be found [here](keyboard-layouts.md).
|
||||||
|
|
||||||
## Useful links and resources
|
## Useful links and resources
|
||||||
|
|
||||||
### Docs
|
### Docs
|
||||||
|
|||||||
@@ -1,8 +1,16 @@
|
|||||||
import usb_hid
|
import usb_hid
|
||||||
from adafruit_hid.keyboard import Keyboard
|
from adafruit_hid.keyboard import Keyboard
|
||||||
from adafruit_hid.keyboard_layout_win_de_de import KeyboardLayout
|
kblayout = "DE"
|
||||||
from adafruit_hid.keyboard_layout_win_de_de import KeyboardLayoutWinDeDe
|
|
||||||
from adafruit_hid.keycode import Keycode
|
if kblayout == "DE":
|
||||||
|
from keyboard_layout_win_de import KeyboardLayout
|
||||||
|
from keycode_win_de import Keycode
|
||||||
|
elif kblayout == "BR":
|
||||||
|
from keyboard_layout_win_br import KeyboardLayout
|
||||||
|
from keycode_win_br import Keycode
|
||||||
|
else:
|
||||||
|
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS as KeyboardLayout
|
||||||
|
from adafruit_hid.keycode import Keycode
|
||||||
import time
|
import time
|
||||||
import digitalio
|
import digitalio
|
||||||
from board import *
|
from board import *
|
||||||
@@ -60,7 +68,7 @@ def parseLine(line):
|
|||||||
runScriptLine(newScriptLine)
|
runScriptLine(newScriptLine)
|
||||||
|
|
||||||
kbd = Keyboard(usb_hid.devices)
|
kbd = Keyboard(usb_hid.devices)
|
||||||
layout = KeyboardLayoutWinDeDe(kbd)
|
layout = KeyboardLayout(kbd)
|
||||||
|
|
||||||
# sleep at the start to allow the device to be recognized by the host computer
|
# sleep at the start to allow the device to be recognized by the host computer
|
||||||
time.sleep(.5)
|
time.sleep(.5)
|
||||||
|
|||||||
26
keyboard-layouts.md
Normal file
26
keyboard-layouts.md
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
## How to install non-US keyboard layouts
|
||||||
|
|
||||||
|
Clone Circuitpython_Keyboard_Layouts
|
||||||
|
`git clone https://github.com/Neradoc/Circuitpython_Keyboard_Layouts`
|
||||||
|
|
||||||
|
`cd Circuitpython_Keyboard_Layouts`
|
||||||
|
|
||||||
|
Install dependencies
|
||||||
|
`pip3 install -r requirements-modules.txt`
|
||||||
|
|
||||||
|
Install build dependencies
|
||||||
|
`pip3 install -r requirements-dev.txt`
|
||||||
|
|
||||||
|
Build layouts
|
||||||
|
`python3 build.py`
|
||||||
|
|
||||||
|
Copy libraries to pico
|
||||||
|
`cp _build/circuitpython-keyboard-layouts-6.x-mpy-<date>/lib/*.mpy /<Pico mount point>/lib`
|
||||||
|
|
||||||
|
Update duckyinpython.py
|
||||||
|
Change
|
||||||
|
`kblayout="US"`
|
||||||
|
to
|
||||||
|
`kblayout="<keyboard layout>"`
|
||||||
|
|
||||||
|
Update `if kblayout ==` block to include the new keyboard layout if not already included
|
||||||
Reference in New Issue
Block a user