You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
add support for layouts where keys have no letters (#4)
* add support for layouts where keys have no letters
* update readme with instructions for custom layout
Co-authored-by: Guy Dupont <[email protected]>
Copy file name to clipboardExpand all lines: fw/README.md
+38-1Lines changed: 38 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,4 +22,41 @@ tested natively on desktop. *For key press detection on Mac, you'll need to give
22
22
1. Run `python3 bundle.py` from this directory. This will create a `bundle` directory, which will copy all required files into folders to be loaded onto each board.
23
23
2. Find the directory with your board's name in the `bundle` directory. Copy all files/subdirectories onto your CircuitPython device.
24
24
3. If your board requires third-party libraries to run this code (most do), you may have to manually copy them. Each board's `bundle` directory will contain a README listing all of the required dependencies. Official CircuitPython libraries available [here](https://circuitpython.org/libraries). As of May 2021, I have been using Bundle version 6.x.
25
-
4. If you're using one of the desktop versions, execute `python3 code.py` from the `bundle/[macos/win32]` directory. You'll have to `pip3 install pynput` as well.
25
+
4. If you're using one of the desktop versions, execute `python3 code.py` from the `bundle/[macos/win32]` directory. You'll have to `pip3 install pynput` as well.
26
+
27
+
## Customizing the keypad layout
28
+
29
+
You can customize which letters get attached to each key by changing the `keypad_dict` dictionary in `code.py`. The default is:
30
+
```python
31
+
keypad_dict = {
32
+
'1' : ['1'],
33
+
'2' : ['a', 'b', 'c'],
34
+
'3' : ['d', 'e', 'f'],
35
+
'4' : ['g', 'h', 'i'],
36
+
'5' : ['j', 'k', 'l'],
37
+
'6' : ['m', 'n', 'o'],
38
+
'7' : ['p', 'q', 'r', 's'],
39
+
'8' : ['t', 'u', 'v'],
40
+
'9' : ['w', 'x', 'y', 'z'],
41
+
'0' : ['', '0', '\n'],
42
+
'#' : ['.', ',', '?', '!']
43
+
}
44
+
```
45
+
But as [Ben Torvaney discovered](https://torvaney.github.io/projects/t9-optimised.html), you can optimize your typing even further by using something like:
46
+
```python
47
+
keypad_dict = {
48
+
'1' : ['1'],
49
+
'2' : ['a', 'm', 'r'],
50
+
'3' : ['c', 'd', 'f', 'p', 'u'],
51
+
'4' : ['h', 'n', 'q', 't'],
52
+
'5' : ['i', 'l', 'w', 'y'],
53
+
'6' : ['b', 'e', 'g', 'v', 'x'],
54
+
'7' : ['j', 'k', 'o', 's', 'z'],
55
+
'8' : ['8'],
56
+
'9' : ['9'],
57
+
'0' : ['', '0', '\n'],
58
+
'#' : ['.', ',', '?', '!']
59
+
}
60
+
```
61
+
62
+
**Note that the keypad will not run unless all characters are accounted for!**
0 commit comments