forked from Github/qmk_firmware
Compare commits
346 Commits
python_opt
...
0.13.31
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a0f2be18a4 | ||
![]() |
9c69db4700 | ||
![]() |
8802d28aad | ||
![]() |
d1cbea685e | ||
![]() |
2b097d670a | ||
![]() |
f2fc23d1b1 | ||
![]() |
e9a3e20813 | ||
![]() |
853344235a | ||
![]() |
4d42fb2031 | ||
![]() |
2d78a43556 | ||
![]() |
fd9d531bd9 | ||
![]() |
be9031d01d | ||
![]() |
c2f227d2a8 | ||
![]() |
720c676403 | ||
![]() |
4b630c46fe | ||
![]() |
851d995a7d | ||
![]() |
1305b6d82e | ||
![]() |
3f5482bbb7 | ||
![]() |
954806c80f | ||
![]() |
4604b58769 | ||
![]() |
56f84774d7 | ||
![]() |
d191ccfdc5 | ||
![]() |
56200de2eb | ||
![]() |
e755c5fe1f | ||
![]() |
fb6c66a14b | ||
![]() |
ec2f6026b9 | ||
![]() |
a4c050b5ae | ||
![]() |
b459f314ec | ||
![]() |
addb389a5e | ||
![]() |
7bfe53ee2f | ||
![]() |
aece9ad5fa | ||
![]() |
e180524c10 | ||
![]() |
57ad8db60e | ||
![]() |
4758ea2188 | ||
![]() |
069f479af4 | ||
![]() |
6af2d3a32c | ||
![]() |
d1db008745 | ||
![]() |
cfca970718 | ||
![]() |
1e2408af91 | ||
![]() |
77735b0a56 | ||
![]() |
6823e03b01 | ||
![]() |
f2d34f38be | ||
![]() |
8b39a3c484 | ||
![]() |
d93089d8ea | ||
![]() |
e1ce0d2836 | ||
![]() |
6fd9b2feba | ||
![]() |
a1f7d86ef5 | ||
![]() |
03212ced24 | ||
![]() |
7e1d28006f | ||
![]() |
219ce2b58a | ||
![]() |
104cdef329 | ||
![]() |
327e5a08d9 | ||
![]() |
86c0a6d3d7 | ||
![]() |
fab1af4154 | ||
![]() |
987e8e3529 | ||
![]() |
8ca6d835b9 | ||
![]() |
c0149dc376 | ||
![]() |
a78fdbb1f6 | ||
![]() |
5a0985aa4a | ||
![]() |
aa0b7079a4 | ||
![]() |
441fd2ca5b | ||
![]() |
6bdecb16c0 | ||
![]() |
768072e824 | ||
![]() |
ae268596ce | ||
![]() |
ad6acb3a03 | ||
![]() |
8fa674727d | ||
![]() |
8d611f6873 | ||
![]() |
dc2dfe2a6c | ||
![]() |
3a48cd64cb | ||
![]() |
f3d7901950 | ||
![]() |
e646211919 | ||
![]() |
ccdb432f71 | ||
![]() |
491b83aa32 | ||
![]() |
fcce9f2a4f | ||
![]() |
9088df04c3 | ||
![]() |
ae2c2358ec | ||
![]() |
a617c8b80a | ||
![]() |
b1c5a53a68 | ||
![]() |
e6e4ec6267 | ||
![]() |
a73e0a7b13 | ||
![]() |
2e5cecd704 | ||
![]() |
d45da3f0fb | ||
![]() |
fc9fb2c775 | ||
![]() |
b69e7431aa | ||
![]() |
b5bcd5b0a1 | ||
![]() |
145d89ab91 | ||
![]() |
44a0aa924c | ||
![]() |
1b002b7dcc | ||
![]() |
d4bc77ac94 | ||
![]() |
e08203f16a | ||
![]() |
4a47ee937d | ||
![]() |
cda1792ece | ||
![]() |
a08c7087be | ||
![]() |
dfd795e48e | ||
![]() |
4a8f540949 | ||
![]() |
270bf7a87a | ||
![]() |
79c8f035cc | ||
![]() |
5d7f2823c9 | ||
![]() |
95a7c22824 | ||
![]() |
58abdfc834 | ||
![]() |
78a3f43c08 | ||
![]() |
8158473464 | ||
![]() |
336c8d3efe | ||
![]() |
a400681ccf | ||
![]() |
e9c3f71e74 | ||
![]() |
92cca84651 | ||
![]() |
8e905a7a5c | ||
![]() |
8c17a822a8 | ||
![]() |
5766b9bfb7 | ||
![]() |
fbe782534a | ||
![]() |
665af4fa8d | ||
![]() |
5b8d2b5cde | ||
![]() |
b564ba13ee | ||
![]() |
c79bc7c909 | ||
![]() |
2b260bd846 | ||
![]() |
ca1aa56c7f | ||
![]() |
afc629210c | ||
![]() |
ec1a6f6b8b | ||
![]() |
ddc2766537 | ||
![]() |
dbca44ae8d | ||
![]() |
81cac8eec6 | ||
![]() |
c1ba35363d | ||
![]() |
3591312fa3 | ||
![]() |
42ac7c0541 | ||
![]() |
8c526703f8 | ||
![]() |
c6698cfce3 | ||
![]() |
8f6867ce95 | ||
![]() |
16e52980c4 | ||
![]() |
ec78f8bca2 | ||
![]() |
4f880801ec | ||
![]() |
9d523499af | ||
![]() |
388a4ae817 | ||
![]() |
3486870ee4 | ||
![]() |
7ea1b97785 | ||
![]() |
815c17b726 | ||
![]() |
b887a1b995 | ||
![]() |
1256915583 | ||
![]() |
35ee990bd0 | ||
![]() |
17933a884a | ||
![]() |
6ab0593f44 | ||
![]() |
9941cf0051 | ||
![]() |
8b0a996d5d | ||
![]() |
f439bfd543 | ||
![]() |
46b8230468 | ||
![]() |
8e30ec1eee | ||
![]() |
1105f2eb47 | ||
![]() |
5ee5280fa1 | ||
![]() |
10905a6500 | ||
![]() |
44a8ad265c | ||
![]() |
8bc8eadaf9 | ||
![]() |
7e698c71cd | ||
![]() |
046429fa87 | ||
![]() |
4b55b7f852 | ||
![]() |
58f9321a77 | ||
![]() |
5b6780f999 | ||
![]() |
07ae72ea6b | ||
![]() |
876f861715 | ||
![]() |
26e64f4fd3 | ||
![]() |
ca0e7e7bd9 | ||
![]() |
b127180c0c | ||
![]() |
d26537acc1 | ||
![]() |
932a67ced2 | ||
![]() |
6c550cc7f7 | ||
![]() |
89eeb4987c | ||
![]() |
455a988aa6 | ||
![]() |
6cc03dd30a | ||
![]() |
366be0f7e9 | ||
![]() |
5fda0e2c04 | ||
![]() |
c330fa725d | ||
![]() |
68b1ef2d1d | ||
![]() |
9d0b7ab9b9 | ||
![]() |
18c6e1d46d | ||
![]() |
867d60bd64 | ||
![]() |
99f637e82c | ||
![]() |
ffdfe3798b | ||
![]() |
1c9af238dc | ||
![]() |
9c4916e2e8 | ||
![]() |
dd5ead676b | ||
![]() |
70efc82c1c | ||
![]() |
b29179de1a | ||
![]() |
ef8267d6a7 | ||
![]() |
6cdba3a437 | ||
![]() |
2fd4595955 | ||
![]() |
d4399172d3 | ||
![]() |
a3d60464ef | ||
![]() |
555a449488 | ||
![]() |
3cd6cb65bc | ||
![]() |
64e6ba0211 | ||
![]() |
bf70db479c | ||
![]() |
b89abc402b | ||
![]() |
6b6ee5fa28 | ||
![]() |
92a029d6f3 | ||
![]() |
7d2f70f398 | ||
![]() |
8f0bf52b25 | ||
![]() |
c024acd752 | ||
![]() |
6b8168c378 | ||
![]() |
20a28d6752 | ||
![]() |
b71ee47c44 | ||
![]() |
4f3a4eca97 | ||
![]() |
0453b61e1a | ||
![]() |
877e81f963 | ||
![]() |
0a8accae06 | ||
![]() |
2c6cff4cb7 | ||
![]() |
988942ce40 | ||
![]() |
09474cbf04 | ||
![]() |
baa65d2177 | ||
![]() |
572a35d9a2 | ||
![]() |
1e51bb39a3 | ||
![]() |
f44b48669d | ||
![]() |
e10e67c9b9 | ||
![]() |
eab623f1ad | ||
![]() |
72540f7d83 | ||
![]() |
692d0268ca | ||
![]() |
b976fcbb44 | ||
![]() |
a0a57dc613 | ||
![]() |
dba3f0d1eb | ||
![]() |
09c4d536c3 | ||
![]() |
c9c2916829 | ||
![]() |
792c4e7893 | ||
![]() |
acf7de7a52 | ||
![]() |
9ce6808015 | ||
![]() |
03a9baa44f | ||
![]() |
4c1c112a16 | ||
![]() |
eb7178b542 | ||
![]() |
5d52d01825 | ||
![]() |
673a5b0ea2 | ||
![]() |
fa309df895 | ||
![]() |
b73f8de10b | ||
![]() |
af083b41cd | ||
![]() |
4d4cac2d07 | ||
![]() |
6d8fac5e2d | ||
![]() |
3e04e22edb | ||
![]() |
400844453a | ||
![]() |
2161496d62 | ||
![]() |
79751f5b15 | ||
![]() |
65f8da3034 | ||
![]() |
3b1506b741 | ||
![]() |
bec74aec1b | ||
![]() |
002d90b357 | ||
![]() |
4b6af0a507 | ||
![]() |
d068b7c097 | ||
![]() |
5878e86c8a | ||
![]() |
fdf71f1aa7 | ||
![]() |
4b285d3f50 | ||
![]() |
2ccca64514 | ||
![]() |
0339467814 | ||
![]() |
7f41c5147b | ||
![]() |
c55bb3d478 | ||
![]() |
2af5d493e3 | ||
![]() |
45dec4911c | ||
![]() |
06e0643541 | ||
![]() |
2ce8d26418 | ||
![]() |
170de06475 | ||
![]() |
f51d929bd9 | ||
![]() |
8bba77db0d | ||
![]() |
11a406f046 | ||
![]() |
73dedb96f2 | ||
![]() |
9f49ec51a1 | ||
![]() |
a8f6a36e1e | ||
![]() |
5046883531 | ||
![]() |
6db4b49fec | ||
![]() |
db7fd6c3a1 | ||
![]() |
79a46708f8 | ||
![]() |
bef73f44aa | ||
![]() |
c275828ac2 | ||
![]() |
57d9f01125 | ||
![]() |
a1582c4411 | ||
![]() |
397d388862 | ||
![]() |
882b90b729 | ||
![]() |
e322462cd4 | ||
![]() |
a001df5e80 | ||
![]() |
1e809e28b7 | ||
![]() |
c1813717a7 | ||
![]() |
2b8ad391ae | ||
![]() |
fb405c27ad | ||
![]() |
13533508e2 | ||
![]() |
4168e10c49 | ||
![]() |
54f429edd8 | ||
![]() |
d8c491954e | ||
![]() |
cd68fd7e8d | ||
![]() |
dc3896e31c | ||
![]() |
8c982dba31 | ||
![]() |
27d1e2909f | ||
![]() |
2a07a87a7c | ||
![]() |
93e3e777d6 | ||
![]() |
5538bffb8e | ||
![]() |
de8939aa5e | ||
![]() |
2b2e8bfdb7 | ||
![]() |
e475c5bf38 | ||
![]() |
f7faa7bfd0 | ||
![]() |
53ace430fe | ||
![]() |
cbe761ea16 | ||
![]() |
c232882fda | ||
![]() |
848da57d6e | ||
![]() |
ad3169f500 | ||
![]() |
b1ea4842e3 | ||
![]() |
234c129f1e | ||
![]() |
8783d0c73d | ||
![]() |
79cc6ce2d0 | ||
![]() |
6ef0419bb0 | ||
![]() |
7770a491f6 | ||
![]() |
03791ed92a | ||
![]() |
39b1dc7672 | ||
![]() |
93bd34c6d3 | ||
![]() |
92a9fba353 | ||
![]() |
7c2bd4dd88 | ||
![]() |
61ec0023c4 | ||
![]() |
ca2259d986 | ||
![]() |
a53128e958 | ||
![]() |
a726ada59b | ||
![]() |
36d8d7df5a | ||
![]() |
42f4528a45 | ||
![]() |
2d60444df1 | ||
![]() |
02fcb1069a | ||
![]() |
3cc037d8d8 | ||
![]() |
543dca0d89 | ||
![]() |
fc06c143b1 | ||
![]() |
344b1b4395 | ||
![]() |
b354ce94fe | ||
![]() |
fb78447ad6 | ||
![]() |
d45a24a954 | ||
![]() |
480b7e595e | ||
![]() |
8030f73f44 | ||
![]() |
563de365a7 | ||
![]() |
f5cecffab2 | ||
![]() |
5e86a11a8d | ||
![]() |
3099630a11 | ||
![]() |
dee50c9cc8 | ||
![]() |
0ec6d6daf7 | ||
![]() |
909d9c228f | ||
![]() |
4a15eb593d | ||
![]() |
6e1ed1c9d3 | ||
![]() |
a913db63aa | ||
![]() |
ced7e9a0ce | ||
![]() |
268d0efa7e | ||
![]() |
4ef2b0f818 | ||
![]() |
0c5c39c18a | ||
![]() |
92dd1b977b | ||
![]() |
d7f352de98 | ||
![]() |
19990a21a9 | ||
![]() |
3f292ec723 | ||
![]() |
eba3d68394 | ||
![]() |
224dcac08f | ||
![]() |
36f3dba195 | ||
![]() |
c0dd142d9f | ||
![]() |
59c572eaf0 |
1
.github/workflows/api.yml
vendored
1
.github/workflows/api.yml
vendored
@@ -7,6 +7,7 @@ on:
|
||||
paths:
|
||||
- 'keyboards/**'
|
||||
- 'layouts/community/**'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
api_data:
|
||||
|
1
.github/workflows/develop_api.yml
vendored
1
.github/workflows/develop_api.yml
vendored
@@ -7,6 +7,7 @@ on:
|
||||
paths:
|
||||
- 'keyboards/**'
|
||||
- 'layouts/community/**'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
api_data:
|
||||
|
93
.gitignore
vendored
93
.gitignore
vendored
@@ -1,36 +1,33 @@
|
||||
.history/
|
||||
.dep
|
||||
*.o
|
||||
*.bin
|
||||
*.eep
|
||||
# Junk files
|
||||
*.bak
|
||||
*.swp
|
||||
*~
|
||||
.DS_Store
|
||||
|
||||
# Build artifacts
|
||||
.clang_complete
|
||||
.build/
|
||||
*.elf
|
||||
*.hex
|
||||
*.uf2
|
||||
*.qmk
|
||||
!util/bootloader.hex
|
||||
!quantum/tools/eeprom_reset.hex
|
||||
*.log
|
||||
*.lss
|
||||
*.lst
|
||||
*.map
|
||||
*.o
|
||||
*.stackdump
|
||||
*.sym
|
||||
*.swp
|
||||
tags
|
||||
*~
|
||||
|
||||
# QMK-specific
|
||||
api_data/v1
|
||||
build/
|
||||
.build/
|
||||
*.bak
|
||||
.vagrant/
|
||||
quantum/version.h
|
||||
.idea/
|
||||
CMakeLists.txt
|
||||
cmake-build-debug
|
||||
.clang_complete
|
||||
doxygen/
|
||||
.DS_Store
|
||||
/util/wsl_downloaded
|
||||
/util/win_downloaded
|
||||
quantum/version.h
|
||||
!quantum/tools/eeprom_reset.hex
|
||||
*.bin
|
||||
*.eep
|
||||
*.hex
|
||||
*.qmk
|
||||
*.uf2
|
||||
|
||||
# Old-style QMK Makefiles
|
||||
/keyboards/*/Makefile
|
||||
/keyboards/*/*/Makefile
|
||||
/keyboards/*/*/*/Makefile
|
||||
@@ -43,39 +40,49 @@ doxygen/
|
||||
/keyboards/*/*/*/*/*/keymaps/Makefile
|
||||
|
||||
# Eclipse/PyCharm/Other IDE Settings
|
||||
.cproject
|
||||
.project
|
||||
.settings/
|
||||
.idea
|
||||
*.iml
|
||||
.browse.VC.db*
|
||||
*.stackdump
|
||||
.cproject
|
||||
.idea
|
||||
.idea/
|
||||
.project
|
||||
.settings/
|
||||
.vagrant/
|
||||
|
||||
# ?
|
||||
.dep
|
||||
.history/
|
||||
build/
|
||||
cmake-build-debug
|
||||
CMakeLists.txt
|
||||
|
||||
# Let these ones be user specific, since we have so many different configurations
|
||||
*.code-workspace
|
||||
.vscode/c_cpp_properties.json
|
||||
.vscode/launch.json
|
||||
.vscode/tasks.json
|
||||
.vscode/last.sql
|
||||
.vscode/temp.sql
|
||||
.vscode/ipch/
|
||||
.stfolder
|
||||
.tags
|
||||
.vscode/c_cpp_properties.json
|
||||
.vscode/ipch/
|
||||
.vscode/last.sql
|
||||
.vscode/launch.json
|
||||
.vscode/tasks.json
|
||||
.vscode/temp.sql
|
||||
tags
|
||||
|
||||
# ignore image files
|
||||
*.png
|
||||
# Ignore image files
|
||||
*.gif
|
||||
*.jpg
|
||||
*.png
|
||||
|
||||
# things travis sees
|
||||
secrets.tar
|
||||
id_rsa_*
|
||||
# Things Travis sees
|
||||
/.vs
|
||||
id_rsa_*
|
||||
secrets.tar
|
||||
|
||||
# python things
|
||||
# Python things
|
||||
__pycache__
|
||||
.python-version
|
||||
|
||||
# prerequisites for updating ChibiOS
|
||||
# Prerequisites for updating ChibiOS
|
||||
/util/fmpp*
|
||||
|
||||
# Allow to exist but don't include it in the repo
|
||||
|
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
@@ -23,5 +23,8 @@
|
||||
"editor.trimAutoWhitespace": false,
|
||||
"files.trimTrailingWhitespace": false
|
||||
},
|
||||
"python.formatting.provider": "yapf"
|
||||
"python.formatting.provider": "yapf",
|
||||
"[json]": {
|
||||
"editor.formatOnSave": false
|
||||
}
|
||||
}
|
||||
|
19
Makefile
19
Makefile
@@ -252,11 +252,20 @@ define PARSE_RULE
|
||||
else
|
||||
$$(info make: *** No rule to make target '$1'. Stop.)
|
||||
$$(info |)
|
||||
$$(info | QMK's make format recently changed to use folder locations and colons:)
|
||||
$$(info | make project_folder:keymap[:target])
|
||||
$$(info | Examples:)
|
||||
$$(info | make dz60:default)
|
||||
$$(info | make planck/rev6:default:flash)
|
||||
$$(info | QMK's make format is:)
|
||||
$$(info | make keyboard_folder:keymap_folder[:target])
|
||||
$$(info |)
|
||||
$$(info | Where `keyboard_folder` is the path to the keyboard relative to)
|
||||
$$(info | `qmk_firmware/keyboards/`, and `keymap_folder` is the name of the)
|
||||
$$(info | keymap folder under that board's `keymaps/` directory.)
|
||||
$$(info |)
|
||||
$$(info | Examples:)
|
||||
$$(info | keyboards/dz60, keyboards/dz60/keymaps/default)
|
||||
$$(info | -> make dz60:default)
|
||||
$$(info | -> qmk compile -kb dz60 -km default)
|
||||
$$(info | keyboards/planck/rev6, keyboards/planck/keymaps/default)
|
||||
$$(info | -> make planck/rev6:default:flash)
|
||||
$$(info | -> qmk flash -kb planck/rev6 -km default)
|
||||
$$(info |)
|
||||
endif
|
||||
endef
|
||||
|
2
Vagrantfile
vendored
2
Vagrantfile
vendored
@@ -6,7 +6,7 @@ Vagrant.configure(2) do |config|
|
||||
config.vm.define "qmk_firmware"
|
||||
|
||||
# VMware/Virtualbox ( and also Hyperv/Parallels) 64 bit
|
||||
config.vm.box = "generic/debian10"
|
||||
config.vm.box = "generic/debian9"
|
||||
|
||||
config.vm.synced_folder '.', '/vagrant'
|
||||
|
||||
|
@@ -1,22 +1,22 @@
|
||||
# Look for a json keymap file
|
||||
ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_5)/keymap.json)","")
|
||||
KEYMAP_C := $(KEYMAP_OUTPUT)/keymap.c
|
||||
KEYMAP_C := $(KEYBOARD_OUTPUT)/src/keymap.c
|
||||
KEYMAP_JSON := $(MAIN_KEYMAP_PATH_5)/keymap.json
|
||||
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_5)
|
||||
else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_4)/keymap.json)","")
|
||||
KEYMAP_C := $(KEYMAP_OUTPUT)/keymap.c
|
||||
KEYMAP_C := $(KEYBOARD_OUTPUT)/src/keymap.c
|
||||
KEYMAP_JSON := $(MAIN_KEYMAP_PATH_4)/keymap.json
|
||||
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_4)
|
||||
else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_3)/keymap.json)","")
|
||||
KEYMAP_C := $(KEYMAP_OUTPUT)/keymap.c
|
||||
KEYMAP_C := $(KEYBOARD_OUTPUT)/src/keymap.c
|
||||
KEYMAP_JSON := $(MAIN_KEYMAP_PATH_3)/keymap.json
|
||||
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_3)
|
||||
else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_2)/keymap.json)","")
|
||||
KEYMAP_C := $(KEYMAP_OUTPUT)/keymap.c
|
||||
KEYMAP_C := $(KEYBOARD_OUTPUT)/src/keymap.c
|
||||
KEYMAP_JSON := $(MAIN_KEYMAP_PATH_2)/keymap.json
|
||||
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_2)
|
||||
else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_1)/keymap.json)","")
|
||||
KEYMAP_C := $(KEYMAP_OUTPUT)/keymap.c
|
||||
KEYMAP_C := $(KEYBOARD_OUTPUT)/src/keymap.c
|
||||
KEYMAP_JSON := $(MAIN_KEYMAP_PATH_1)/keymap.json
|
||||
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_1)
|
||||
endif
|
||||
@@ -27,5 +27,5 @@ ifneq ("$(wildcard $(KEYMAP_PATH))", "")
|
||||
endif
|
||||
|
||||
# Generate the keymap.c
|
||||
$(KEYMAP_C): $(KEYMAP_JSON)
|
||||
$(KEYBOARD_OUTPUT)/src/keymap.c: $(KEYMAP_JSON)
|
||||
$(QMK_BIN) json2c --quiet --output $(KEYMAP_C) $(KEYMAP_JSON)
|
||||
|
@@ -103,15 +103,6 @@ MAIN_KEYMAP_PATH_5 := $(KEYBOARD_PATH_5)/keymaps/$(KEYMAP)
|
||||
INFO_RULES_MK = $(shell $(QMK_BIN) generate-rules-mk --quiet --escape --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/rules.mk)
|
||||
include $(INFO_RULES_MK)
|
||||
|
||||
ifneq ($(FORCE_LAYOUT),)
|
||||
TARGET := $(TARGET)_$(FORCE_LAYOUT)
|
||||
endif
|
||||
|
||||
# Object files and generated keymap directory
|
||||
# To put object files in current directory, use a dot (.), do NOT make
|
||||
# this an empty or blank macro!
|
||||
KEYMAP_OUTPUT := $(BUILD_DIR)/obj_$(TARGET)
|
||||
|
||||
# Check for keymap.json first, so we can regenerate keymap.c
|
||||
include build_json.mk
|
||||
|
||||
@@ -154,6 +145,10 @@ ifeq ($(strip $(CONVERT_TO_PROTON_C)), yes)
|
||||
include platforms/chibios/QMK_PROTON_C/convert_to_proton_c.mk
|
||||
endif
|
||||
|
||||
ifneq ($(FORCE_LAYOUT),)
|
||||
TARGET := $(TARGET)_$(FORCE_LAYOUT)
|
||||
endif
|
||||
|
||||
include quantum/mcu_selection.mk
|
||||
|
||||
# Find all the C source files to be compiled in subfolders.
|
||||
@@ -332,6 +327,11 @@ endif
|
||||
# Disable features that a keyboard doesn't support
|
||||
-include disable_features.mk
|
||||
|
||||
# Object files directory
|
||||
# To put object files in current directory, use a dot (.), do NOT make
|
||||
# this an empty or blank macro!
|
||||
KEYMAP_OUTPUT := $(BUILD_DIR)/obj_$(TARGET)
|
||||
|
||||
ifneq ("$(wildcard $(KEYMAP_PATH)/config.h)","")
|
||||
CONFIG_H += $(KEYMAP_PATH)/config.h
|
||||
endif
|
||||
|
@@ -24,7 +24,6 @@ GTEST_INTERNAL_INC :=\
|
||||
|
||||
$(GTEST_OUTPUT)_SRC :=\
|
||||
googletest/src/gtest-all.cc\
|
||||
googletest/src/gtest_main.cc\
|
||||
googlemock/src/gmock-all.cc
|
||||
|
||||
$(GTEST_OUTPUT)_DEFS :=
|
||||
@@ -35,7 +34,8 @@ CREATE_MAP := no
|
||||
|
||||
VPATH +=\
|
||||
$(LIB_PATH)/googletest\
|
||||
$(LIB_PATH)/googlemock
|
||||
$(LIB_PATH)/googlemock\
|
||||
$(LIB_PATH)/printf
|
||||
|
||||
all: elf
|
||||
|
||||
@@ -43,19 +43,27 @@ VPATH += $(COMMON_VPATH)
|
||||
PLATFORM:=TEST
|
||||
PLATFORM_KEY:=test
|
||||
|
||||
ifeq ($(strip $(DEBUG)), 1)
|
||||
CONSOLE_ENABLE = yes
|
||||
endif
|
||||
|
||||
ifneq ($(filter $(FULL_TESTS),$(TEST)),)
|
||||
include tests/$(TEST)/rules.mk
|
||||
endif
|
||||
|
||||
include common_features.mk
|
||||
include $(TMK_PATH)/common.mk
|
||||
include $(QUANTUM_PATH)/debounce/tests/rules.mk
|
||||
include $(QUANTUM_PATH)/sequencer/tests/rules.mk
|
||||
include $(QUANTUM_PATH)/serial_link/tests/rules.mk
|
||||
ifneq ($(filter $(FULL_TESTS),$(TEST)),)
|
||||
include build_full_test.mk
|
||||
endif
|
||||
|
||||
$(TEST)_SRC += \
|
||||
tests/test_common/main.c \
|
||||
$(LIB_PATH)/printf/printf.c \
|
||||
$(COMMON_DIR)/printf.c
|
||||
|
||||
$(TEST_OBJ)/$(TEST)_SRC := $($(TEST)_SRC)
|
||||
$(TEST_OBJ)/$(TEST)_INC := $($(TEST)_INC) $(VPATH) $(GTEST_INC)
|
||||
$(TEST_OBJ)/$(TEST)_DEFS := $($(TEST)_DEFS)
|
||||
|
@@ -244,7 +244,7 @@ endif
|
||||
endif
|
||||
|
||||
RGB_MATRIX_ENABLE ?= no
|
||||
VALID_RGB_MATRIX_TYPES := AW20216 IS31FL3731 IS31FL3733 IS31FL3737 IS31FL3741 WS2812 custom
|
||||
VALID_RGB_MATRIX_TYPES := IS31FL3731 IS31FL3733 IS31FL3737 IS31FL3741 WS2812 custom
|
||||
|
||||
ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes)
|
||||
ifeq ($(filter $(RGB_MATRIX_DRIVER),$(VALID_RGB_MATRIX_TYPES)),)
|
||||
@@ -261,13 +261,6 @@ endif
|
||||
CIE1931_CURVE := yes
|
||||
RGB_KEYCODES_ENABLE := yes
|
||||
|
||||
ifeq ($(strip $(RGB_MATRIX_DRIVER)), AW20216)
|
||||
OPT_DEFS += -DAW20216 -DSTM32_SPI -DHAL_USE_SPI=TRUE
|
||||
COMMON_VPATH += $(DRIVER_PATH)/awinic
|
||||
SRC += aw20216.c
|
||||
QUANTUM_LIB_SRC += spi_master.c
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(RGB_MATRIX_DRIVER)), IS31FL3731)
|
||||
OPT_DEFS += -DIS31FL3731 -DSTM32_I2C -DHAL_USE_I2C=TRUE
|
||||
COMMON_VPATH += $(DRIVER_PATH)/issi
|
||||
@@ -536,11 +529,7 @@ ifeq ($(strip $(SPLIT_KEYBOARD)), yes)
|
||||
|
||||
# Determine which (if any) transport files are required
|
||||
ifneq ($(strip $(SPLIT_TRANSPORT)), custom)
|
||||
QUANTUM_SRC += $(QUANTUM_DIR)/split_common/transport.c \
|
||||
$(QUANTUM_DIR)/split_common/transactions.c
|
||||
|
||||
OPT_DEFS += -DSPLIT_COMMON_TRANSACTIONS
|
||||
|
||||
QUANTUM_LIB_SRC += $(QUANTUM_DIR)/split_common/transport.c
|
||||
# Functions added via QUANTUM_LIB_SRC are only included in the final binary if they're called.
|
||||
# Unused functions are pruned away, which is why we can add multiple drivers here without bloat.
|
||||
ifeq ($(PLATFORM),AVR)
|
||||
@@ -561,11 +550,6 @@ ifeq ($(strip $(SPLIT_KEYBOARD)), yes)
|
||||
COMMON_VPATH += $(QUANTUM_PATH)/split_common
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(CRC_ENABLE)), yes)
|
||||
OPT_DEFS += -DCRC_ENABLE
|
||||
QUANTUM_LIB_SRC += crc.c
|
||||
endif
|
||||
|
||||
HAPTIC_ENABLE ?= no
|
||||
ifneq ($(strip $(HAPTIC_ENABLE)),no)
|
||||
COMMON_VPATH += $(DRIVER_PATH)/haptic
|
||||
@@ -596,14 +580,6 @@ ifeq ($(strip $(OLED_DRIVER_ENABLE)), yes)
|
||||
SRC += oled_driver.c
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(ST7565_ENABLE)), yes)
|
||||
OPT_DEFS += -DST7565_ENABLE
|
||||
COMMON_VPATH += $(DRIVER_PATH)/oled # For glcdfont.h
|
||||
COMMON_VPATH += $(DRIVER_PATH)/lcd
|
||||
QUANTUM_LIB_SRC += spi_master.c
|
||||
SRC += st7565.c
|
||||
endif
|
||||
|
||||
include $(DRIVER_PATH)/qwiic/qwiic.mk
|
||||
|
||||
ifeq ($(strip $(UCIS_ENABLE)), yes)
|
||||
|
@@ -1,22 +1,34 @@
|
||||
{
|
||||
"$id": "qmk.api.keyboard.v1",
|
||||
"allOf": [
|
||||
{"$ref": "qmk.keyboard.v1"},
|
||||
{ "$ref": "qmk.keyboard.v1" },
|
||||
{
|
||||
"properties": {
|
||||
"keymaps": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"url": {"type": "string"}
|
||||
}
|
||||
|
||||
},
|
||||
"parse_errors": {"$ref": "qmk.definitions.v1#/string_array"},
|
||||
"parse_warnings": {"$ref": "qmk.definitions.v1#/string_array"},
|
||||
"processor_type": {"type": "string"},
|
||||
"protocol": {"type": "string"},
|
||||
"keyboard_folder": {"type": "string"},
|
||||
"platform": {"type": "string"}
|
||||
"$id": "qmk.api.keyboard.v1",
|
||||
"keymaps": {
|
||||
"type": "string"
|
||||
},
|
||||
"parse_errors": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"parse_warnings": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"processor_type": {
|
||||
"type": "string"
|
||||
},
|
||||
"protocol": {
|
||||
"type": "string"
|
||||
},
|
||||
"keyboard_folder": {
|
||||
"type": "string"
|
||||
},
|
||||
"platform": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@@ -1,107 +0,0 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"$id": "qmk.definitions.v1",
|
||||
"title": "Common definitions used across QMK's jsonschemas.",
|
||||
"type": "object",
|
||||
"boolean_array": {
|
||||
"type": "object",
|
||||
"additionalProperties": {"type": "boolean"}
|
||||
},
|
||||
"filename": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"pattern": "^[0-9a-z_]*$"
|
||||
},
|
||||
"hex_number_2d": {
|
||||
"type": "string",
|
||||
"pattern": "^0x[0-9A-F]{2}$"
|
||||
},
|
||||
"hex_number_4d": {
|
||||
"type": "string",
|
||||
"pattern": "^0x[0-9A-F]{4}$"
|
||||
},
|
||||
"text_identifier": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 250
|
||||
},
|
||||
"layout_macro": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"enum": ["LAYOUT", "LAYOUT_planck_1x2uC"]
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"pattern": "^LAYOUT_[0-9a-z_]*$"
|
||||
}
|
||||
]
|
||||
},
|
||||
"key_unit": {
|
||||
"type": "number",
|
||||
"min": 0.25
|
||||
},
|
||||
"mcu_pin_array": {
|
||||
"type": "array",
|
||||
"items": {"$ref": "#/mcu_pin"}
|
||||
},
|
||||
"mcu_pin": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"pattern": "^[A-K]\\d{1,2}$"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"pattern": "^LINE_PIN\\d{1,2}$"
|
||||
},
|
||||
{
|
||||
"type": "number",
|
||||
"multipleOf": 1
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"signed_decimal": {
|
||||
"type": "number"
|
||||
},
|
||||
"signed_int": {
|
||||
"type": "number",
|
||||
"multipleOf": 1
|
||||
}
|
||||
"signed_int_8": {
|
||||
"type": "number",
|
||||
"min": -127,
|
||||
"max": 127,
|
||||
"multipleOf": 1
|
||||
}
|
||||
"string_array": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"string_object": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"unsigned_decimal": {
|
||||
"type": "number",
|
||||
"min": 0
|
||||
},
|
||||
"unsigned_int": {
|
||||
"type": "number",
|
||||
"min": 0,
|
||||
"multipleOf": 1
|
||||
}
|
||||
"unsigned_int_8": {
|
||||
"type": "number",
|
||||
"min": 0,
|
||||
"max": 255,
|
||||
"multipleOf": 1
|
||||
}
|
||||
}
|
@@ -1,12 +1,24 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"$schema": "http://json-schema.org/schema#",
|
||||
"$id": "qmk.keyboard.v1",
|
||||
"title": "Keyboard Information",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"keyboard_name": {"$ref": "qmk.definitions.v1#/text_identifier"},
|
||||
"maintainer": {"$ref": "qmk.definitions.v1#/text_identifier"},
|
||||
"manufacturer": {"$ref": "qmk.definitions.v1#/text_identifier"},
|
||||
"keyboard_name": {
|
||||
"type": "string",
|
||||
"minLength": 2,
|
||||
"maxLength": 250
|
||||
},
|
||||
"maintainer": {
|
||||
"type": "string",
|
||||
"minLength": 2,
|
||||
"maxLength": 250
|
||||
},
|
||||
"manufacturer": {
|
||||
"type": "string",
|
||||
"minLength": 2,
|
||||
"maxLength": 250
|
||||
},
|
||||
"url": {
|
||||
"type": "string",
|
||||
"format": "uri"
|
||||
@@ -28,25 +40,62 @@
|
||||
"type": "string",
|
||||
"enum": ["COL2ROW", "ROW2COL"]
|
||||
},
|
||||
"debounce": {"$ref": "qmk.definitions.v1#/unsigned_int"},
|
||||
"height": {"$ref": "qmk.definitions.v1#/key_unit"},
|
||||
"width": {"$ref": "qmk.definitions.v1#/key_unit"},
|
||||
"debounce": {
|
||||
"type": "number",
|
||||
"min": 0,
|
||||
"multipleOf": 1
|
||||
},
|
||||
"height": {
|
||||
"type": "number",
|
||||
"min": 0.25
|
||||
},
|
||||
"width": {
|
||||
"type": "number",
|
||||
"min": 0.25
|
||||
},
|
||||
"community_layouts": {
|
||||
"type": "array",
|
||||
"items": {"$ref": "qmk.definitions.v1#/filename"}
|
||||
"items": {
|
||||
"type": "string",
|
||||
"minLength": 2,
|
||||
"pattern": "^[0-9a-z_]*$"
|
||||
}
|
||||
},
|
||||
"features": {
|
||||
"type": "object",
|
||||
"additionalProperties": {"type": "boolean"}
|
||||
},
|
||||
"features": {"$ref": "qmk.definitions.v1#/boolean_array"},
|
||||
"indicators": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"caps_lock": {"$ref": "qmk.definitions.v1#/mcu_pin"},
|
||||
"num_lock": {"$ref": "qmk.definitions.v1#/mcu_pin"},
|
||||
"scroll_lock": {"$ref": "qmk.definitions.v1#/mcu_pin"}
|
||||
"caps_lock": {
|
||||
"type": "string",
|
||||
"pattern": "^[A-K]\\d{1,2}$"
|
||||
},
|
||||
"num_lock": {
|
||||
"type": "string",
|
||||
"pattern": "^[A-K]\\d{1,2}$"
|
||||
},
|
||||
"scroll_lock": {
|
||||
"type": "string",
|
||||
"pattern": "^[A-K]\\d{1,2}$"
|
||||
}
|
||||
}
|
||||
},
|
||||
"layout_aliases": {
|
||||
"type": "object",
|
||||
"additionalProperties": {"$ref": "qmk.definitions.v1#/layout_macro"}
|
||||
"additionalProperties": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"enum": ["LAYOUT", "LAYOUT_planck_1x2uC"]
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"pattern": "^LAYOUT_[0-9a-z_]*$"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"layouts": {
|
||||
"type": "object",
|
||||
@@ -60,7 +109,11 @@
|
||||
"c_macro": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"key_count": {"$ref": "qmk.definitions.v1#/key_unit"},
|
||||
"key_count": {
|
||||
"type": "number",
|
||||
"min": 0,
|
||||
"multipleOf": 1
|
||||
},
|
||||
"layout": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
@@ -78,14 +131,34 @@
|
||||
"multipleOf": 1
|
||||
}
|
||||
},
|
||||
"key_count": {"$ref": "qmk.definitions.v1#/key_unit"},
|
||||
"r": {"$ref": "qmk.definitions.v1#/unsigned_decimal"},
|
||||
"rx": {"$ref": "qmk.definitions.v1#/unsigned_decimal"},
|
||||
"ry": {"$ref": "qmk.definitions.v1#/unsigned_decimal"},
|
||||
"h": {"$ref": "qmk.definitions.v1#/key_unit"},
|
||||
"w": {"$ref": "qmk.definitions.v1#/key_unit"},
|
||||
"x": {"$ref": "qmk.definitions.v1#/key_unit"},
|
||||
"y": {"$ref": "qmk.definitions.v1#/key_unit"}
|
||||
"h": {
|
||||
"type": "number",
|
||||
"min": 0.25
|
||||
},
|
||||
"r": {
|
||||
"type": "number",
|
||||
"min": 0
|
||||
},
|
||||
"rx": {
|
||||
"type": "number",
|
||||
"min": 0
|
||||
},
|
||||
"ry": {
|
||||
"type": "number",
|
||||
"min": 0
|
||||
},
|
||||
"w": {
|
||||
"type": "number",
|
||||
"min": 0.25
|
||||
},
|
||||
"x": {
|
||||
"type": "number",
|
||||
"min": 0
|
||||
},
|
||||
"y": {
|
||||
"type": "number",
|
||||
"min": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -98,10 +171,61 @@
|
||||
"properties": {
|
||||
"direct": {
|
||||
"type": "array",
|
||||
"items": {$ref": "qmk.definitions.v1#/mcu_pin_array"}
|
||||
"items": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"pattern": "^[A-K]\\d{1,2}$"
|
||||
},
|
||||
{
|
||||
"type": "number",
|
||||
"multipleOf": 1
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"cols": {"$ref": "qmk.definitions.v1#/mcu_pin_array"},
|
||||
"rows": {"$ref": "qmk.definitions.v1#/mcu_pin_array"}
|
||||
"cols": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"pattern": "^[A-K]\\d{1,2}$"
|
||||
},
|
||||
{
|
||||
"type": "number",
|
||||
"multipleOf": 1
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"rows": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"pattern": "^[A-K]\\d{1,2}$"
|
||||
},
|
||||
{
|
||||
"type": "number",
|
||||
"multipleOf": 1
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"rgblight": {
|
||||
@@ -114,19 +238,47 @@
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"brightness_steps": {"$ref": "qmk.definitions.v1#/unsigned_int"},
|
||||
"hue_steps": {"$ref": "qmk.definitions.v1#/unsigned_int"},
|
||||
"led_count": {"$ref": "qmk.definitions.v1#/unsigned_int"},
|
||||
"max_brightness": {"$ref": "qmk.definitions.v1#/unsigned_int_8"},
|
||||
"pin": {"$ref": "qmk.definitions.v1#/mcu_pin"},
|
||||
"saturation_steps": {"$ref": "qmk.definitions.v1#/unsigned_int"},
|
||||
"brightness_steps": {
|
||||
"type": "number",
|
||||
"min": 0,
|
||||
"multipleOf": 1
|
||||
},
|
||||
"hue_steps": {
|
||||
"type": "number",
|
||||
"min": 0,
|
||||
"multipleOf": 1
|
||||
},
|
||||
"led_count": {
|
||||
"type": "number",
|
||||
"min": 0,
|
||||
"multipleOf": 1
|
||||
},
|
||||
"max_brightness": {
|
||||
"type": "number",
|
||||
"min": 0,
|
||||
"max": 255,
|
||||
"multipleOf": 1
|
||||
},
|
||||
"pin": {
|
||||
"type": "string",
|
||||
"pattern": "^[A-K]\\d{1,2}$"
|
||||
},
|
||||
"saturation_steps": {
|
||||
"type": "number",
|
||||
"min": 0,
|
||||
"multipleOf": 1
|
||||
},
|
||||
"sleep": {"type": "boolean"},
|
||||
"split": {"type": "boolean"},
|
||||
"split_count": {
|
||||
"type": "array",
|
||||
"minLength": 2,
|
||||
"maxLength": 2,
|
||||
"items": {"$ref": "qmk.definitions.v1#/unsigned_int"}
|
||||
"items": {
|
||||
"type": "number",
|
||||
"min": 0,
|
||||
"multipleOf": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -134,19 +286,40 @@
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"device_ver": {"$ref": "qmk.definitions.v1#/hex_number_4d"},
|
||||
"pid": {"$ref": "qmk.definitions.v1#/hex_number_4d"},
|
||||
"vid": {"$ref": "qmk.definitions.v1#/hex_number_4d"}
|
||||
"device_ver": {
|
||||
"type": "string",
|
||||
"pattern": "^[0-9A-F]x[0-9A-F][0-9A-F][0-9A-F][0-9A-F]"
|
||||
},
|
||||
"pid": {
|
||||
"type": "string",
|
||||
"pattern": "^[0-9A-F]x[0-9A-F][0-9A-F][0-9A-F][0-9A-F]"
|
||||
},
|
||||
"vid": {
|
||||
"type": "string",
|
||||
"pattern": "^[0-9A-F]x[0-9A-F][0-9A-F][0-9A-F][0-9A-F]"
|
||||
}
|
||||
}
|
||||
},
|
||||
"qmk_lufa_bootloader": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"esc_output": {"$ref": "qmk.definitions.v1#/mcu_pin"},
|
||||
"esc_input": {"$ref": "qmk.definitions.v1#/mcu_pin"},
|
||||
"led": {"$ref": "qmk.definitions.v1#/mcu_pin"},
|
||||
"speaker": {"$ref": "qmk.definitions.v1#/mcu_pin"}
|
||||
"esc_output": {
|
||||
"type": "string",
|
||||
"pattern": "^[A-K]\\d{1,2}$"
|
||||
},
|
||||
"esc_input": {
|
||||
"type": "string",
|
||||
"pattern": "^[A-K]\\d{1,2}$"
|
||||
},
|
||||
"led": {
|
||||
"type": "string",
|
||||
"pattern": "^[A-K]\\d{1,2}$"
|
||||
},
|
||||
"speaker": {
|
||||
"type": "string",
|
||||
"pattern": "^[A-K]\\d{1,2}$"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -93,7 +93,6 @@
|
||||
* Hardware Features
|
||||
* Displays
|
||||
* [HD44780 LCD Controller](feature_hd44780.md)
|
||||
* [ST7565 LCD Driver](feature_st7565.md)
|
||||
* [OLED Driver](feature_oled_driver.md)
|
||||
* Lighting
|
||||
* [Backlight](feature_backlight.md)
|
||||
|
@@ -100,7 +100,3 @@ This happens immediately after the previous `develop` branch is merged.
|
||||
* [ ] `git pull --ff-only`
|
||||
* [ ] `git merge --no-ff develop`
|
||||
* [ ] `git push upstream master`
|
||||
|
||||
## Post-merge operations
|
||||
|
||||
* (Optional) [update ChibiOS + ChibiOS-Contrib on `develop`](chibios_upgrade_instructions.md)
|
||||
|
@@ -1,56 +0,0 @@
|
||||
# ChibiOS Upgrade Procedure
|
||||
|
||||
ChibiOS and ChibiOS-Contrib need to be updated in tandem -- the latter has a branch tied to the ChibiOS version in use and should not be mixed with different versions.
|
||||
|
||||
## Getting ChibiOS
|
||||
|
||||
* `svn` Initialisation:
|
||||
* Only needed to be done once
|
||||
* You might need to separately install `git-svn` package in your OS's package manager
|
||||
* `git svn init --stdlayout --prefix='svn/' http://svn.osdn.net/svnroot/chibios/`
|
||||
* `git remote add qmk git@github.com:qmk/ChibiOS.git`
|
||||
* Updating:
|
||||
* `git svn fetch`
|
||||
* First time around this will take several hours
|
||||
* Subsequent updates will be incremental only
|
||||
* Tagging example (work out which version first!):
|
||||
* `git tag -a ver20.3.3 -m ver20.3.3 svn/tags/ver20.3.3`
|
||||
* `git push qmk ver20.3.3`
|
||||
* `git tag -a breaking_YYYY_qN -m breaking_YYYY_qN svn/tags/ver20.3.3`
|
||||
* `git push qmk breaking_YYYY_qN`
|
||||
|
||||
## Getting ChibiOS-Contrib
|
||||
|
||||
* `git` Initialisation:
|
||||
* `git clone git@github.com:qmk/ChibiOS-Contrib`
|
||||
* `git remote add upstream https://github.com/ChibiOS/ChibiOS-Contrib`
|
||||
* `git checkout -b chibios-20.3.x upstream/chibios-20.3.x`
|
||||
* Updating:
|
||||
* `git fetch --all --tags --prune`
|
||||
* `git checkout chibios-20.3.x`
|
||||
* `git pull --ff-only`
|
||||
* `git push origin chibios-20.3.x`
|
||||
* `git tag -a breaking_YYYY_qN -m breaking_YYYY_qN chibios-20.3.x`
|
||||
* `git push origin breaking_YYYY_qN`
|
||||
|
||||
## Updating submodules
|
||||
|
||||
* Update the submodules
|
||||
* `cd $QMK_FIRMWARE`
|
||||
* `git checkout develop`
|
||||
* `git pull --ff-only`
|
||||
* `git checkout -b chibios-version-bump`
|
||||
* `cd lib/chibios`
|
||||
* `git fetch --all --tags --prune`
|
||||
* `git checkout breaking_YYYY_qN`
|
||||
* `cd ../chibios-contrib`
|
||||
* `git fetch --all --tags --prune`
|
||||
* `git checkout breaking_YYYY_qN`
|
||||
* Build everything
|
||||
* `cd $QMK_FIRMWARE`
|
||||
* `qmk multibuild -j4`
|
||||
* Make sure there are no errors
|
||||
* Push to the repo
|
||||
* `git commit -am 'Update ChibiOS to XXXXXXXXX'`
|
||||
* `git push --set-upstream origin chibios-version-bump`
|
||||
* Make a PR to qmk_firmware with the new branch
|
@@ -349,11 +349,12 @@ qmk cformat -b branch_name
|
||||
## `qmk docs`
|
||||
|
||||
This command starts a local HTTP server which you can use for browsing or improving the docs. Default port is 8936.
|
||||
Use the `-b`/`--browser` flag to automatically open the local webserver in your default browser.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```
|
||||
qmk docs [-p PORT]
|
||||
qmk docs [-b] [-p PORT]
|
||||
```
|
||||
|
||||
## `qmk generate-docs`
|
||||
|
@@ -51,10 +51,8 @@ This is a C header file that is one of the first things included, and will persi
|
||||
* the number of columns in your keyboard's matrix
|
||||
* `#define MATRIX_ROW_PINS { D0, D5, B5, B6 }`
|
||||
* pins of the rows, from top to bottom
|
||||
* may be omitted by the keyboard designer if matrix reads are handled in an alternate manner. See [low-level matrix overrides](custom_quantum_functions.md?id=low-level-matrix-overrides) for more information.
|
||||
* `#define MATRIX_COL_PINS { F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 }`
|
||||
* pins of the columns, from left to right
|
||||
* may be omitted by the keyboard designer if matrix reads are handled in an alternate manner. See [low-level matrix overrides](custom_quantum_functions.md?id=low-level-matrix-overrides) for more information.
|
||||
* `#define MATRIX_IO_DELAY 30`
|
||||
* the delay in microseconds when between changing matrix pin state and reading values
|
||||
* `#define UNUSED_PINS { D1, D2, D3, B1, B2, B3 }`
|
||||
@@ -274,7 +272,7 @@ There are a few different ways to set handedness for split keyboards (listed in
|
||||
### Other Options
|
||||
|
||||
* `#define USE_I2C`
|
||||
* For using I2C instead of Serial (default is serial; serial transport is supported on ARM -- I2C is AVR-only)
|
||||
* For using I2C instead of Serial (defaults to serial)
|
||||
|
||||
* `#define SOFT_SERIAL_PIN D0`
|
||||
* When using serial, define this. `D0` or `D1`,`D2`,`D3`,`E6`.
|
||||
@@ -282,7 +280,6 @@ There are a few different ways to set handedness for split keyboards (listed in
|
||||
* `#define MATRIX_ROW_PINS_RIGHT { <row pins> }`
|
||||
* `#define MATRIX_COL_PINS_RIGHT { <col pins> }`
|
||||
* If you want to specify a different pinout for the right half than the left half, you can define `MATRIX_ROW_PINS_RIGHT`/`MATRIX_COL_PINS_RIGHT`. Currently, the size of `MATRIX_ROW_PINS` must be the same as `MATRIX_ROW_PINS_RIGHT` and likewise for the definition of columns.
|
||||
* may be omitted by the keyboard designer if matrix reads are handled in an alternate manner. See [low-level matrix overrides](custom_quantum_functions.md?id=low-level-matrix-overrides) for more information.
|
||||
|
||||
* `#define DIRECT_PINS_RIGHT { { F1, F0, B0, C7 }, { F4, F5, F6, F7 } }`
|
||||
* If you want to specify a different direct pinout for the right half than the left half, you can define `DIRECT_PINS_RIGHT`. Currently, the size of `DIRECT_PINS` must be the same as `DIRECT_PINS_RIGHT`.
|
||||
@@ -303,7 +300,7 @@ There are a few different ways to set handedness for split keyboards (listed in
|
||||
* `#define SPLIT_USB_DETECT`
|
||||
* Detect (with timeout) USB connection when delegating master/slave
|
||||
* Default behavior for ARM
|
||||
* Required for AVR Teensy (without hardware mods)
|
||||
* Required for AVR Teensy
|
||||
|
||||
* `#define SPLIT_USB_TIMEOUT 2000`
|
||||
* Maximum timeout when detecting master/slave when using `SPLIT_USB_DETECT`
|
||||
@@ -311,28 +308,6 @@ There are a few different ways to set handedness for split keyboards (listed in
|
||||
* `#define SPLIT_USB_TIMEOUT_POLL 10`
|
||||
* Poll frequency when detecting master/slave when using `SPLIT_USB_DETECT`
|
||||
|
||||
* `#define FORCED_SYNC_THROTTLE_MS 100`
|
||||
* Deadline for synchronizing data from master to slave when using the QMK-provided split transport.
|
||||
|
||||
* `#define SPLIT_TRANSPORT_MIRROR`
|
||||
* Mirrors the master-side matrix on the slave when using the QMK-provided split transport.
|
||||
|
||||
* `#define SPLIT_LAYER_STATE_ENABLE`
|
||||
* Ensures the current layer state is available on the slave when using the QMK-provided split transport.
|
||||
|
||||
* `#define SPLIT_LED_STATE_ENABLE`
|
||||
* Ensures the current host indicator state (caps/num/scroll) is available on the slave when using the QMK-provided split transport.
|
||||
|
||||
* `#define SPLIT_MODS_ENABLE`
|
||||
* Ensures the current modifier state (normal, weak, and oneshot) is available on the slave when using the QMK-provided split transport.
|
||||
|
||||
* `#define SPLIT_WPM_ENABLE`
|
||||
* Ensures the current WPM is available on the slave when using the QMK-provided split transport.
|
||||
|
||||
* `#define SPLIT_TRANSACTION_IDS_KB .....`
|
||||
* `#define SPLIT_TRANSACTION_IDS_USER .....`
|
||||
* Allows for custom data sync with the slave when using the QMK-provided split transport. See [custom data sync between sides](feature_split_keyboard.md#custom-data-sync) for more information.
|
||||
|
||||
# The `rules.mk` File
|
||||
|
||||
This is a [make](https://www.gnu.org/software/make/manual/make.html) file that is included by the top-level `Makefile`. It is used to set some information about the MCU that we will be compiling for as well as enabling and disabling certain features.
|
||||
|
@@ -144,14 +144,6 @@ This is useful for setting up stuff that you may need elsewhere, but isn't hardw
|
||||
* Keyboard/Revision: `void matrix_init_kb(void)`
|
||||
* Keymap: `void matrix_init_user(void)`
|
||||
|
||||
### Low-level Matrix Overrides Function Documentation :id=low-level-matrix-overrides
|
||||
|
||||
* GPIO pin initialisation: `void matrix_init_pins(void)`
|
||||
* This needs to perform the low-level initialisation of all row and column pins. By default this will initialise the input/output state of each of the GPIO pins listed in `MATRIX_ROW_PINS` and `MATRIX_COL_PINS`, based on whether or not the keyboard is set up for `ROW2COL`, `COL2ROW`, or `DIRECT_PINS`. Should the keyboard designer override this function, no initialisation of pin state will occur within QMK itself, instead deferring to the keyboard's override.
|
||||
* `COL2ROW`-based row reads: `void matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)`
|
||||
* `ROW2COL`-based column reads: `void matrix_read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)`
|
||||
* `DIRECT_PINS`-based reads: `void matrix_read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)`
|
||||
* These three functions need to perform the low-level retrieval of matrix state of relevant input pins, based on the matrix type. Only one of the functions should be implemented, if needed. By default this will iterate through `MATRIX_ROW_PINS` and `MATRIX_COL_PINS`, configuring the inputs and outputs based on whether or not the keyboard is set up for `ROW2COL`, `COL2ROW`, or `DIRECT_PINS`. Should the keyboard designer override this function, no manipulation of matrix GPIO pin state will occur within QMK itself, instead deferring to the keyboard's override.
|
||||
|
||||
## Keyboard Post Initialization code
|
||||
|
||||
|
@@ -30,18 +30,38 @@ If you find that you can no longer type with the keyboard, you may have accident
|
||||
|
||||

|
||||
|
||||
Open the Device Manager and look for a device that looks like your keyboard.
|
||||
Open the Device Manager, select **View → Devices by container**, and look for an entry with your keyboard's name.
|
||||
|
||||

|
||||

|
||||
|
||||
Right-click it and hit **Uninstall device**. Make sure to tick **Delete the driver software for this device** first.
|
||||
Right-click each entry and hit **Uninstall device**. Make sure to tick **Delete the driver software for this device** first if it appears.
|
||||
|
||||

|
||||
|
||||
Click **Action → Scan for hardware changes**. At this point, you should be able to type again. Double check in Zadig that the keyboard device(s) are using the `HidUsb` driver. If so, you're all done, and your board should be functional again! Otherwise, repeat the process until Zadig reports the correct driver.
|
||||
Click **Action → Scan for hardware changes**. At this point, you should be able to type again. Double check in Zadig that the keyboard device(s) are using the `HidUsb` driver. If so, you're all done, and your board should be functional again! Otherwise, repeat this process until Zadig reports the correct driver.
|
||||
|
||||
?> A full reboot of your computer may sometimes be necessary at this point, to get Windows to pick up the new driver.
|
||||
|
||||
## Uninstallation
|
||||
|
||||
Uninstallation of bootloader devices is a little more involved than installation.
|
||||
|
||||
Open the Device Manager, select **View → Devices by container**, and look for the bootloader device. Match up the USB VID and PID in Zadig with one from [the table below](#list-of-known-bootloaders).
|
||||
|
||||
Find the `Inf name` value in the Details tab of the device properties. This should generally be something like `oemXX.inf`:
|
||||
|
||||

|
||||
|
||||
Then, open a new Command Prompt window as an Administrator (type in `cmd` into the Start menu and press Ctrl+Shift+Enter). Run `pnputil /enum-drivers` to verify the `Inf name` matches the `Published Name` field of one of the entries:
|
||||
|
||||

|
||||
|
||||
Run `pnputil /delete-driver oemXX.inf /uninstall`. This will delete the driver and remove it from any devices using it. Note that this will not uninstall the device itself.
|
||||
|
||||
As with the previous section, this process may need to be repeated multiple times, as multiple drivers can be applicable to the same device.
|
||||
|
||||
!> **WARNING:** Be *extremely careful* when doing this! You could potentially uninstall the driver for some other critical device. If you are unsure, double check the output of `/enum-drivers`, and omit the `/uninstall` flag when running `/delete-driver`.
|
||||
|
||||
## List of Known Bootloaders
|
||||
|
||||
This is a list of known bootloader devices and their USB vendor and product IDs, as well as the correct driver to assign for flashing with QMK. Note that the usbser and HidUsb drivers are built in to Windows, and cannot be assigned with Zadig - if your device has an incorrect driver, you must use the Device Manager to uninstall it as described in the previous section.
|
||||
|
@@ -28,7 +28,7 @@ For compatible platforms, [QMK Toolbox](https://github.com/qmk/qmk_toolbox) can
|
||||
|
||||
Prefer a terminal based solution? [hid_listen](https://www.pjrc.com/teensy/hid_listen.html), provided by PJRC, can also be used to display debug messages. Prebuilt binaries for Windows,Linux,and MacOS are available.
|
||||
|
||||
## Sending Your Own Debug Messages
|
||||
## Sending Your Own Debug Messages :id=debug-api
|
||||
|
||||
Sometimes it's useful to print debug messages from within your [custom code](custom_quantum_functions.md). Doing so is pretty simple. Start by including `print.h` at the top of your file:
|
||||
|
||||
|
@@ -2,24 +2,27 @@
|
||||
|
||||
These allow you to combine a modifier with a keycode. When pressed, the keydown event for the modifier, then `kc` will be sent. On release, the keyup event for `kc`, then the modifier will be sent.
|
||||
|
||||
|Key |Aliases |Description |
|
||||
|----------|-------------------------------|------------------------------------------------------|
|
||||
|`LCTL(kc)`|`C(kc)` |Hold Left Control and press `kc` |
|
||||
|`LSFT(kc)`|`S(kc)` |Hold Left Shift and press `kc` |
|
||||
|`LALT(kc)`|`A(kc)`, `LOPT(kc)` |Hold Left Alt and press `kc` |
|
||||
|`LGUI(kc)`|`G(kc)`, `LCMD(kc)`, `LWIN(kc)`|Hold Left GUI and press `kc` |
|
||||
|`RCTL(kc)`| |Hold Right Control and press `kc` |
|
||||
|`RSFT(kc)`| |Hold Right Shift and press `kc` |
|
||||
|`RALT(kc)`|`ROPT(kc)`, `ALGR(kc)` |Hold Right Alt and press `kc` |
|
||||
|`RGUI(kc)`|`RCMD(kc)`, `LWIN(kc)` |Hold Right GUI and press `kc` |
|
||||
|`SGUI(kc)`|`SCMD(kc)`, `SWIN(kc)` |Hold Left Shift and GUI and press `kc` |
|
||||
|`LCA(kc)` | |Hold Left Control and Alt and press `kc` |
|
||||
|`LSA(kc)` | |Hold Left Shift and Left Alt and press `kc` |
|
||||
|`RSA(kc)` |`SAGR(kc)` |Hold Right Shift and Right Alt (AltGr) and press `kc` |
|
||||
|`RCS(kc)` | |Hold Right Control and Right Shift and press `kc` |
|
||||
|`LCAG(kc)`| |Hold Left Control, Alt and GUI and press `kc` |
|
||||
|`MEH(kc)` | |Hold Left Control, Shift and Alt and press `kc` |
|
||||
|`HYPR(kc)`| |Hold Left Control, Shift, Alt and GUI and press `kc` |
|
||||
|Key |Aliases |Description |
|
||||
|----------|----------------------------------|------------------------------------------------------|
|
||||
|`LCTL(kc)`|`C(kc)` |Hold Left Control and press `kc` |
|
||||
|`LSFT(kc)`|`S(kc)` |Hold Left Shift and press `kc` |
|
||||
|`LALT(kc)`|`A(kc)`, `LOPT(kc)` |Hold Left Alt and press `kc` |
|
||||
|`LGUI(kc)`|`G(kc)`, `LCMD(kc)`, `LWIN(kc)` |Hold Left GUI and press `kc` |
|
||||
|`RCTL(kc)`| |Hold Right Control and press `kc` |
|
||||
|`RSFT(kc)`| |Hold Right Shift and press `kc` |
|
||||
|`RALT(kc)`|`ROPT(kc)`, `ALGR(kc)` |Hold Right Alt and press `kc` |
|
||||
|`RGUI(kc)`|`RCMD(kc)`, `LWIN(kc)` |Hold Right GUI and press `kc` |
|
||||
|`LSG(kc)` |`SGUI(kc)`, `SCMD(kc)`, `SWIN(kc)`|Hold Left Shift and GUI and press `kc` |
|
||||
|`LAG(kc)` | |Hold Left Alt and Left GUI and press `kc` |
|
||||
|`RSG(kc)` | |Hold Right Shift and Right GUI and press `kc` |
|
||||
|`RAG(kc)` | |Hold Right Alt and Right GUI and press `kc` |
|
||||
|`LCA(kc)` | |Hold Left Control and Alt and press `kc` |
|
||||
|`LSA(kc)` | |Hold Left Shift and Left Alt and press `kc` |
|
||||
|`RSA(kc)` |`SAGR(kc)` |Hold Right Shift and Right Alt (AltGr) and press `kc` |
|
||||
|`RCS(kc)` | |Hold Right Control and Right Shift and press `kc` |
|
||||
|`LCAG(kc)`| |Hold Left Control, Alt and GUI and press `kc` |
|
||||
|`MEH(kc)` | |Hold Left Control, Shift and Alt and press `kc` |
|
||||
|`HYPR(kc)`| |Hold Left Control, Shift, Alt and GUI and press `kc` |
|
||||
|
||||
You can also chain them, for example `LCTL(LALT(KC_DEL))` or `C(A(KC_DEL))` makes a key that sends Control+Alt+Delete with a single keypress.
|
||||
|
||||
|
@@ -146,7 +146,7 @@ And to trigger the bootloader, you hold this key down when plugging the keyboard
|
||||
|
||||
## Split Keyboards
|
||||
|
||||
When handedness is predetermined via an option like `SPLIT_HAND_PIN`, you might need to configure a different key between halves. This To do so, add these entries to your `config.h` file:
|
||||
When handedness is predetermined via an option like `SPLIT_HAND_PIN`, you might need to configure a different key between halves. To do so, add these entries to your `config.h` file:
|
||||
|
||||
```c
|
||||
#define BOOTMAGIC_LITE_ROW_RIGHT 4
|
||||
|
@@ -121,16 +121,16 @@ DEBOUNCE_TYPE = <name of algorithm>
|
||||
Where name of algorithm is one of:
|
||||
* ```sym_defer_g``` - debouncing per keyboard. On any state change, a global timer is set. When ```DEBOUNCE``` milliseconds of no changes has occurred, all input changes are pushed.
|
||||
* This is the current default algorithm. This is the highest performance algorithm with lowest memory usage, and it's also noise-resistant.
|
||||
* ```sym_eager_pr``` - debouncing per row. On any state change, response is immediate, followed by locking the row ```DEBOUNCE``` milliseconds of no further input for that row.
|
||||
* ```sym_eager_pr``` - debouncing per row. On any state change, response is immediate, followed by locking the row ```DEBOUNCE``` milliseconds of no further input for that row.
|
||||
For use in keyboards where refreshing ```NUM_KEYS``` 8-bit counters is computationally expensive / low scan rate, and fingers usually only hit one row at a time. This could be
|
||||
appropriate for the ErgoDox models; the matrix is rotated 90°, and hence its "rows" are really columns, and each finger only hits a single "row" at a time in normal use.
|
||||
* ```sym_eager_pk``` - debouncing per key. On any state change, response is immediate, followed by ```DEBOUNCE``` milliseconds of no further input for that key
|
||||
* ```sym_defer_pk``` - debouncing per key. On any state change, a per-key timer is set. When ```DEBOUNCE``` milliseconds of no changes have occurred on that key, the key status change is pushed.
|
||||
* ```asym_eager_defer_pk``` - debouncing per key. On a key-down state change, response is immediate, followed by ```DEBOUNCE``` milliseconds of no further input for that key. On a key-up state change, a per-key timer is set. When ```DEBOUNCE``` milliseconds of no changes have occurred on that key, the key-up status change is pushed.
|
||||
|
||||
### A couple algorithms that could be implemented in the future:
|
||||
* ```sym_defer_pr```
|
||||
* ```sym_eager_g```
|
||||
* ```asym_eager_defer_pk```
|
||||
|
||||
### Use your own debouncing code
|
||||
You have the option to implement you own debouncing algorithm. To do this:
|
||||
|
@@ -162,28 +162,4 @@ This will set what sequence HPT_RST will set as the active mode. If not defined,
|
||||
|
||||
### DRV2605L Continuous Haptic Mode
|
||||
|
||||
This mode sets continuous haptic feedback with the option to increase or decrease strength.
|
||||
|
||||
## Haptic Key Exclusion
|
||||
The Haptic Exclusion is implemented as `__attribute__((weak)) bool get_haptic_enabled_key(uint16_t keycode, keyrecord_t *record)` in haptic.c. This allows a re-definition at the required level with the specific requirement / exclusion.
|
||||
|
||||
### NO_HAPTIC_MOD
|
||||
With the entry of `#define NO_HAPTIC_MOD` in config.h, modifiers from Left Control to Right GUI will not trigger a feedback. This also includes modifiers in a Mod Tap configuration.
|
||||
|
||||
### NO_HAPTIC_FN
|
||||
With the entry of `#define NO_HAPTIC_FN` in config.h, layer keys will not rigger a feedback.
|
||||
|
||||
### NO_HAPTIC_ALPHA
|
||||
With the entry of `#define NO_HAPTIC_ALPHA` in config.h, none of the alpha keys (A ... Z) will trigger a feedback.
|
||||
|
||||
### NO_HAPTIC_PUNCTUATION
|
||||
With the entry of `#define NO_HAPTIC_PUNCTUATION` in config.h, none of the following keys will trigger a feedback: Enter, ESC, Backspace, Space, Minus, Equal, Left Bracket, Right Bracket, Backslash, Non-US Hash, Semicolon, Quote, Grave, Comma, Slash, Dot, Non-US Backslash.
|
||||
|
||||
### NO_HAPTIC_LOCKKEYS
|
||||
With the entry of `#define NO_HAPTIC_LOCKKEYS` in config.h, none of the following keys will trigger a feedback: Caps Lock, Scroll Lock, Num Lock.
|
||||
|
||||
### NO_HAPTIC_NAV
|
||||
With the entry of `#define NO_HAPTIC_NAV` in config.h, none of the following keys will trigger a feedback: Print Screen, Pause, Insert, Delete, Page Down, Page Up, Left Arrow, Up Arrow, Right Arrow, Down Arrow, End, Home.
|
||||
|
||||
### NO_HAPTIC_NUMERIC
|
||||
With the entry of `#define NO_HAPTIC_NUMERIC` in config.h, none of the following keys between 0 and 9 (KC_1 ... KC_0) will trigger a feedback.
|
||||
This mode sets continuous haptic feedback with the option to increase or decrease strength.
|
||||
|
@@ -1,5 +1,7 @@
|
||||
# LED Indicators
|
||||
|
||||
?> Currently, this feature is not supported for split keyboards
|
||||
|
||||
QMK provides methods to read 5 of the LEDs defined in the HID spec:
|
||||
|
||||
* Num Lock
|
||||
|
@@ -346,10 +346,6 @@ bool oled_scroll_left(void);
|
||||
// Returns true if the screen was not scrolling or stops scrolling
|
||||
bool oled_scroll_off(void);
|
||||
|
||||
// Inverts the display
|
||||
// Returns true if the screen was or is inverted
|
||||
bool oled_invert(bool invert);
|
||||
|
||||
// Returns the maximum number of characters that will fit on a line
|
||||
uint8_t oled_max_chars(void);
|
||||
|
||||
|
@@ -227,74 +227,6 @@ Configure the hardware via your `config.h`:
|
||||
#define DRIVER_LED_TOTAL 70
|
||||
```
|
||||
|
||||
---
|
||||
### AW20216 :id=aw20216
|
||||
There is basic support for addressable RGB matrix lighting with the SPI AW20216 RGB controller. To enable it, add this to your `rules.mk`:
|
||||
|
||||
```makefile
|
||||
RGB_MATRIX_ENABLE = yes
|
||||
RGB_MATRIX_DRIVER = AW20216
|
||||
```
|
||||
|
||||
You can use up to 2 AW20216 IC's. Do not specify `DRIVER_<N>_xxx` defines for IC's that are not present on your keyboard. You can define the following items in `config.h`:
|
||||
|
||||
| Variable | Description | Default |
|
||||
|----------|-------------|---------|
|
||||
| `DRIVER_1_CS` | (Required) MCU pin connected to first RGB driver chip select line | B13 |
|
||||
| `DRIVER_2_CS` | (Optional) MCU pin connected to second RGB driver chip select line | |
|
||||
| `DRIVER_1_EN` | (Required) MCU pin connected to first RGB driver hardware enable line | C13 |
|
||||
| `DRIVER_2_EN` | (Optional) MCU pin connected to second RGB driver hardware enable line | |
|
||||
| `DRIVER_1_LED_TOTAL` | (Required) How many RGB lights are connected to first RGB driver | |
|
||||
| `DRIVER_2_LED_TOTAL` | (Optional) How many RGB lights are connected to second RGB driver | |
|
||||
| `DRIVER_COUNT` | (Required) How many RGB driver IC's are present | |
|
||||
| `DRIVER_LED_TOTAL` | (Required) How many RGB lights are present across all drivers | |
|
||||
| `AW_SCALING_MAX` | (Optional) LED current scaling value (0-255, higher values mean LED is brighter at full PWM) | 150 |
|
||||
| `AW_GLOBAL_CURRENT_MAX` | (Optional) Driver global current limit (0-255, higher values means the driver may consume more power) | 150 |
|
||||
|
||||
Here is an example using 2 drivers.
|
||||
|
||||
```c
|
||||
#define DRIVER_1_CS B13
|
||||
#define DRIVER_2_CS B14
|
||||
// Hardware enable lines may be connected to the same pin
|
||||
#define DRIVER_1_EN C13
|
||||
#define DRIVER_2_EN C13
|
||||
|
||||
#define DRIVER_COUNT 2
|
||||
#define DRIVER_1_LED_TOTAL 66
|
||||
#define DRIVER_2_LED_TOTAL 32
|
||||
#define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
|
||||
```
|
||||
|
||||
!> Note the parentheses, this is so when `DRIVER_LED_TOTAL` is used in code and expanded, the values are added together before any additional math is applied to them. As an example, `rand() % (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)` will give very different results than `rand() % DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL`.
|
||||
|
||||
Define these arrays listing all the LEDs in your `<keyboard>.c`:
|
||||
|
||||
```c
|
||||
const aw_led g_aw_leds[DRIVER_LED_TOTAL] = {
|
||||
/* Each AW20216 channel is controlled by a register at some offset between 0x00
|
||||
* and 0xD7 inclusive.
|
||||
* See drivers/awinic/aw20216.h for the mapping between register offsets and
|
||||
* driver pin locations.
|
||||
* driver
|
||||
* | R location
|
||||
* | | G location
|
||||
* | | | B location
|
||||
* | | | | */
|
||||
{ 0, CS1_SW1, CS2_SW1, CS3_SW1 },
|
||||
{ 0, CS4_SW1, CS5_SW1, CS6_SW1 },
|
||||
{ 0, CS7_SW1, CS8_SW1, CS9_SW1 },
|
||||
{ 0, CS10_SW1, CS11_SW1, CS12_SW1 },
|
||||
{ 0, CS13_SW1, CS14_SW1, CS15_SW1 },
|
||||
...
|
||||
{ 1, CS1_SW1, CS2_SW1, CS3_SW1 },
|
||||
{ 1, CS13_SW1, CS14_SW1, CS15_SW1 },
|
||||
{ 1, CS16_SW1, CS17_SW1, CS18_SW1 },
|
||||
{ 1, CS4_SW2, CS5_SW2, CS6_SW2 },
|
||||
...
|
||||
};
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Common Configuration :id=common-configuration
|
||||
@@ -692,6 +624,39 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
|
||||
}
|
||||
```
|
||||
|
||||
### Indicator Examples :id=indicator-examples
|
||||
|
||||
Caps Lock indicator on alphanumeric flagged keys:
|
||||
```c
|
||||
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
|
||||
if (host_keyboard_led_state().caps_lock) {
|
||||
for (uint8_t i = led_min; i <= led_max; i++) {
|
||||
if (g_led_config.flags[i] & LED_FLAG_KEYLIGHT) {
|
||||
rgb_matrix_set_color(i, RGB_RED);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Layer indicator on all flagged keys:
|
||||
```c
|
||||
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
|
||||
for (uint8_t i = led_min; i <= led_max; i++) {
|
||||
switch(get_highest_layer(layer_state|default_layer_state)) {
|
||||
case RAISE:
|
||||
rgb_matrix_set_color(i, RGB_BLUE);
|
||||
break;
|
||||
case LOWER:
|
||||
rgb_matrix_set_color(i, RGB_YELLOW);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Suspended state :id=suspended-state
|
||||
To use the suspend feature, make sure that `#define RGB_DISABLE_WHEN_USB_SUSPENDED true` is added to the `config.h` file.
|
||||
|
||||
|
@@ -8,7 +8,8 @@ QMK Firmware has a generic implementation that is usable by any board, as well a
|
||||
|
||||
For this, we will mostly be talking about the generic implementation used by the Let's Split and other keyboards.
|
||||
|
||||
!> ARM split supports most QMK subsystems when using the 'serial' and 'serial_usart' drivers. I2C slave is currently unsupported.
|
||||
!> ARM is not yet fully supported for Split Keyboards and has many limitations. Progress is being made, but we have not yet reached 100% feature parity.
|
||||
|
||||
|
||||
## Compatibility Overview
|
||||
|
||||
@@ -168,7 +169,7 @@ Because not every split keyboard is identical, there are a number of additional
|
||||
#define USE_I2C
|
||||
```
|
||||
|
||||
This configures the use of I<sup>2</sup>C support for split keyboard transport (AVR only).
|
||||
This enables I<sup>2</sup>C support for split keyboards. This isn't strictly for communication, but can be used for OLED or other I<sup>2</sup>C-based devices.
|
||||
|
||||
```c
|
||||
#define SOFT_SERIAL_PIN D0
|
||||
@@ -192,115 +193,20 @@ If you're having issues with serial communication, you can change this value, as
|
||||
* **`5`**: about 20kbps
|
||||
|
||||
```c
|
||||
#define FORCED_SYNC_THROTTLE_MS 100
|
||||
#define SPLIT_MODS_ENABLE
|
||||
```
|
||||
|
||||
This sets the maximum number of milliseconds before forcing a synchronization of data from master to slave. Under normal circumstances this sync occurs whenever the data _changes_, for safety a data transfer occurs after this number of milliseconds if no change has been detected since the last sync.
|
||||
This enables transmitting modifier state (normal, weak and oneshot) to the non
|
||||
primary side of the split keyboard. This adds a few bytes of data to the split
|
||||
communication protocol and may impact the matrix scan speed when enabled.
|
||||
The purpose of this feature is to support cosmetic use of modifer state (e.g.
|
||||
displaying status on an OLED screen).
|
||||
|
||||
```c
|
||||
#define SPLIT_TRANSPORT_MIRROR
|
||||
```
|
||||
|
||||
This mirrors the master side matrix to the slave side for features that react or require knowledge of master side key presses on the slave side. The purpose of this feature is to support cosmetic use of key events (e.g. RGB reacting to keypresses). This adds overhead to the split communication protocol and may negatively impact the matrix scan speed when enabled.
|
||||
|
||||
```c
|
||||
#define SPLIT_LAYER_STATE_ENABLE
|
||||
```
|
||||
|
||||
This enables syncing of the layer state between both halves of the split keyboard. The main purpose of this feature is to enable support for use of things like OLED display of the currently active layer. This adds overhead to the split communication protocol and may negatively impact the matrix scan speed when enabled.
|
||||
|
||||
```c
|
||||
#define SPLIT_LED_STATE_ENABLE
|
||||
```
|
||||
|
||||
This enables syncing of the Host LED status (caps lock, num lock, etc) between both halves of the split keyboard. The main purpose of this feature is to enable support for use of things like OLED display of the Host LED status. This adds overhead to the split communication protocol and may negatively impact the matrix scan speed when enabled.
|
||||
|
||||
```c
|
||||
#define SPLIT_MODS_ENABLE
|
||||
```
|
||||
|
||||
This enables transmitting modifier state (normal, weak and oneshot) to the non primary side of the split keyboard. The purpose of this feature is to support cosmetic use of modifer state (e.g. displaying status on an OLED screen). This adds overhead to the split communication protocol and may negatively impact the matrix scan speed when enabled.
|
||||
|
||||
```c
|
||||
#define SPLIT_WPM_ENABLE
|
||||
```
|
||||
|
||||
This enables transmitting the current WPM to the slave side of the split keyboard. The purpose of this feature is to support cosmetic use of WPM (e.g. displaying the current value on an OLED screen). This adds overhead to the split communication protocol and may negatively impact the matrix scan speed when enabled.
|
||||
|
||||
### Custom data sync between sides :id=custom-data-sync
|
||||
|
||||
QMK's split transport allows for arbitrary data transactions at both the keyboard and user levels. This is modelled on a remote procedure call, with the master invoking a function on the slave side, with the ability to send data from master to slave, process it slave side, and send data back from slave to master.
|
||||
|
||||
To leverage this, a keyboard or user/keymap can define a comma-separated list of _transaction IDs_:
|
||||
|
||||
```c
|
||||
// for keyboard-level data sync:
|
||||
#define SPLIT_TRANSACTION_IDS_KB KEYBOARD_SYNC_A, KEYBOARD_SYNC_B
|
||||
// or, for user:
|
||||
#define SPLIT_TRANSACTION_IDS_USER USER_SYNC_A, USER_SYNC_B, USER_SYNC_C
|
||||
```
|
||||
|
||||
These _transaction IDs_ then need a slave-side handler function to be registered with the split transport, for example:
|
||||
|
||||
```c
|
||||
typedef struct _master_to_slave_t {
|
||||
int m2s_data;
|
||||
} master_to_slave_t;
|
||||
|
||||
typedef struct _slave_to_master_t {
|
||||
int s2m_data;
|
||||
} slave_to_master_t;
|
||||
|
||||
void user_sync_a_slave_handler(uint8_t in_buflen, const void* in_data, uint8_t out_buflen, void* out_data) {
|
||||
const master_to_slave_t *m2s = (const master_to_slave_t*)in_data;
|
||||
slave_to_master_t *s2m = (slave_to_master_t*)out_data;
|
||||
s2m->s2m_data = m2s->m2s_data + 5; // whatever comes in, add 5 so it can be sent back
|
||||
}
|
||||
|
||||
void keyboard_post_init_user(void) {
|
||||
transaction_register_rpc(USER_SYNC_A, user_sync_a_slave_handler);
|
||||
}
|
||||
```
|
||||
|
||||
The master side can then invoke the slave-side handler - for normal keyboard functionality to be minimally affected, any keyboard- or user-level code attempting to sync data should be throttled:
|
||||
|
||||
```c
|
||||
void housekeeping_task_user(void) {
|
||||
if (is_keyboard_master()) {
|
||||
// Interact with slave every 500ms
|
||||
static uint32_t last_sync = 0;
|
||||
if (timer_elapsed32(last_sync) > 500) {
|
||||
master_to_slave_t m2s = {6};
|
||||
slave_to_master_t s2m = {0};
|
||||
if(transaction_rpc_exec(USER_SYNC_A, sizeof(m2s), &m2s, sizeof(s2m), &s2m)) {
|
||||
last_sync = timer_read32();
|
||||
dprintf("Slave value: %d\n", s2m.s2m_data); // this will now be 11, as the slave adds 5
|
||||
} else {
|
||||
dprint("Slave sync failed!\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
!> It is recommended that any data sync between halves happens during the master side's _housekeeping task_. This ensures timely retries should failures occur.
|
||||
|
||||
If only one-way data transfer is needed, helper methods are provided:
|
||||
|
||||
```c
|
||||
bool transaction_rpc_exec(int8_t transaction_id, uint8_t initiator2target_buffer_size, const void *initiator2target_buffer, uint8_t target2initiator_buffer_size, void *target2initiator_buffer);
|
||||
bool transaction_rpc_send(int8_t transaction_id, uint8_t initiator2target_buffer_size, const void *initiator2target_buffer);
|
||||
bool transaction_rpc_recv(int8_t transaction_id, uint8_t target2initiator_buffer_size, void *target2initiator_buffer);
|
||||
```
|
||||
|
||||
By default, the inbound and outbound data is limited to a maximum of 32 bytes each. The sizes can be altered if required:
|
||||
|
||||
```c
|
||||
// Master to slave:
|
||||
#define RPC_M2S_BUFFER_SIZE 48
|
||||
// Slave to master:
|
||||
#define RPC_S2M_BUFFER_SIZE 48
|
||||
```
|
||||
This mirrors the master side matrix to the slave side for features that react or require knowledge of master side key presses on the slave side. This adds a few bytes of data to the split communication protocol and may impact the matrix scan speed when enabled. The purpose of this feature is to support cosmetic use of key events (e.g. RGB reacting to Keypresses).
|
||||
|
||||
### Hardware Configuration Options
|
||||
|
||||
|
@@ -1,274 +0,0 @@
|
||||
# ST7565 LCD Driver
|
||||
|
||||
## Supported Hardware
|
||||
|
||||
LCD modules using ST7565 driver IC, communicating over SPI.
|
||||
|
||||
|Module |IC |Size |Notes |
|
||||
|------------------------------|-------|------|----------------------------------------------------------|
|
||||
|Newhaven Display NHD-C12832A1Z|ST7565R|128x32|Used by Ergodox Infinity; primary consumer of this feature|
|
||||
|Zolentech ZLE12864B |ST7565P|128x64|Requires contrast adjustment |
|
||||
|
||||
## Usage
|
||||
|
||||
To enable the feature, there are three steps. First, when compiling your keyboard, you'll need to add the following to your `rules.mk`:
|
||||
|
||||
```make
|
||||
ST7565_ENABLE = yes
|
||||
```
|
||||
|
||||
Then in your `keymap.c` file, implement the ST7565 task call. This example assumes your keymap has three layers named `_QWERTY`, `_FN` and `_ADJ`:
|
||||
|
||||
```c
|
||||
#ifdef ST7565_ENABLE
|
||||
void st7565_task_user(void) {
|
||||
// Host Keyboard Layer Status
|
||||
st7565_write_P(PSTR("Layer: "), false);
|
||||
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
case _QWERTY:
|
||||
st7565_write_P(PSTR("Default\n"), false);
|
||||
break;
|
||||
case _FN:
|
||||
st7565_write_P(PSTR("FN\n"), false);
|
||||
break;
|
||||
case _ADJ:
|
||||
st7565_write_P(PSTR("ADJ\n"), false);
|
||||
break;
|
||||
default:
|
||||
// Or use the write_ln shortcut over adding '\n' to the end of your string
|
||||
st7565_write_ln_P(PSTR("Undefined"), false);
|
||||
}
|
||||
|
||||
// Host Keyboard LED Status
|
||||
led_t led_state = host_keyboard_led_state();
|
||||
st7565_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false);
|
||||
st7565_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false);
|
||||
st7565_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
|
||||
}
|
||||
#endif
|
||||
```
|
||||
|
||||
## Logo Example
|
||||
|
||||
In the default font, certain ranges of characters are reserved for a QMK logo. To render this logo to the screen, use the following code example:
|
||||
|
||||
```c
|
||||
static void render_logo(void) {
|
||||
static const char PROGMEM qmk_logo[] = {
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94,
|
||||
0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4,
|
||||
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0x00
|
||||
};
|
||||
|
||||
st7565_write_P(qmk_logo, false);
|
||||
}
|
||||
```
|
||||
|
||||
## Buffer Read Example
|
||||
For some purposes, you may need to read the current state of the display buffer. The `st7565_read_raw` function can be used to safely read bytes from the buffer.
|
||||
|
||||
In this example, calling `fade_display` in the `st7565_task_user` function will slowly fade away whatever is on the screen by turning random pixels off over time.
|
||||
```c
|
||||
//Setup some mask which can be or'd with bytes to turn off pixels
|
||||
const uint8_t single_bit_masks[8] = {127, 191, 223, 239, 247, 251, 253, 254};
|
||||
|
||||
static void fade_display(void) {
|
||||
//Define the reader structure
|
||||
display_buffer_reader_t reader;
|
||||
uint8_t buff_char;
|
||||
if (random() % 30 == 0) {
|
||||
srand(timer_read());
|
||||
// Fetch a pointer for the buffer byte at index 0. The return structure
|
||||
// will have the pointer and the number of bytes remaining from this
|
||||
// index position if we want to perform a sequential read by
|
||||
// incrementing the buffer pointer
|
||||
reader = st7565_read_raw(0);
|
||||
//Loop over the remaining buffer and erase pixels as we go
|
||||
for (uint16_t i = 0; i < reader.remaining_element_count; i++) {
|
||||
//Get the actual byte in the buffer by dereferencing the pointer
|
||||
buff_char = *reader.current_element;
|
||||
if (buff_char != 0) {
|
||||
st7565_write_raw_byte(buff_char & single_bit_masks[rand() % 8], i);
|
||||
}
|
||||
//increment the pointer to fetch a new byte during the next loop
|
||||
reader.current_element++;
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Other Examples
|
||||
|
||||
In split keyboards, it is very common to have two displays that each render different content and are oriented or flipped differently. You can do this by switching which content to render by using the return value from `is_keyboard_master()` or `is_keyboard_left()` found in `split_util.h`, e.g:
|
||||
|
||||
```c
|
||||
#ifdef ST7565_ENABLE
|
||||
display_rotation_t st7565_init_user(display_rotation_t rotation) {
|
||||
if (!is_keyboard_master()) {
|
||||
return DISPLAY_ROTATION_180; // flips the display 180 degrees if offhand
|
||||
}
|
||||
|
||||
return rotation;
|
||||
}
|
||||
|
||||
void st7565_task_user(void) {
|
||||
if (is_keyboard_master()) {
|
||||
render_status(); // Renders the current keyboard state (layer, lock, caps, scroll, etc)
|
||||
} else {
|
||||
render_logo(); // Renders a static logo
|
||||
}
|
||||
}
|
||||
#endif
|
||||
```
|
||||
|
||||
## Basic Configuration
|
||||
|
||||
|Define |Default |Description |
|
||||
|------------------------|--------------|-----------------------------------------------------------------------------------------------------|
|
||||
|`ST7565_A0_PIN` |*Not defined* |(Required) The GPIO connected to the display's A0 (data/command) pin |
|
||||
|`ST7565_RST_PIN` |*Not defined* |(Required) The GPIO connected to the display's reset pin |
|
||||
|`ST7565_SS_PIN` |*Not defined* |(Required) The GPIO connected to the display's slave select pin |
|
||||
|`ST7565_SPI_CLK_DIVISOR`|`4` |The SPI clock divisor to use |
|
||||
|`ST7565_FONT_H` |`"glcdfont.c"`|The font code file to use for custom fonts |
|
||||
|`ST7565_FONT_START` |`0` |The starting character index for custom fonts |
|
||||
|`ST7565_FONT_END` |`223` |The ending character index for custom fonts |
|
||||
|`ST7565_FONT_WIDTH` |`6` |The font width |
|
||||
|`ST7565_FONT_HEIGHT` |`8` |The font height (untested) |
|
||||
|`ST7565_TIMEOUT` |`60000` |Turns off the screen after 60000ms of keyboard inactivity. Helps reduce burn-in. Set to 0 to disable.|
|
||||
|`ST7565_COLUMN_OFFSET` |`0` |Shift output to the right this many pixels. |
|
||||
|`ST7565_CONTRAST` |`32` |The default contrast level of the display, from 0 to 255. |
|
||||
|`ST7565_UPDATE_INTERVAL`|`0` |Set the time interval for updating the display in ms. This will improve the matrix scan rate. |
|
||||
|
||||
## Custom sized displays
|
||||
|
||||
The default display size for this feature is 128x32 and all necessary defines are precalculated with that in mind.
|
||||
|
||||
|Define |Default |Description |
|
||||
|-----------------------|----------|-----------------------------------------------------------------------------------------------------------|
|
||||
|`ST7565_DISPLAY_WIDTH` |`128` |The width of the display. |
|
||||
|`ST7565_DISPLAY_HEIGHT`|`32` |The height of the display. |
|
||||
|`ST7565_MATRIX_SIZE` |`512` |The local buffer size to allocate.<br>`(ST7565_DISPLAY_HEIGHT / 8 * ST7565_DISPLAY_WIDTH)`. |
|
||||
|`ST7565_BLOCK_TYPE` |`uint16_t`|The unsigned integer type to use for dirty rendering. |
|
||||
|`ST7565_BLOCK_COUNT` |`16` |The number of blocks the display is divided into for dirty rendering.<br>`(sizeof(ST7565_BLOCK_TYPE) * 8)`.|
|
||||
|`ST7565_BLOCK_SIZE` |`32` |The size of each block for dirty rendering<br>`(ST7565_MATRIX_SIZE / ST7565_BLOCK_COUNT)`. |
|
||||
|
||||
## API
|
||||
|
||||
```c
|
||||
// Rotation enum values are flags
|
||||
typedef enum {
|
||||
DISPLAY_ROTATION_0,
|
||||
DISPLAY_ROTATION_180
|
||||
} display_rotation_t;
|
||||
|
||||
// Initialize the display, rotating the rendered output based on the define passed in.
|
||||
// Returns true if the was initialized successfully
|
||||
bool st7565_init(display_rotation_t rotation);
|
||||
|
||||
// Called at the start of st7565_init, weak function overridable by the user
|
||||
// rotation - the value passed into st7565_init
|
||||
// Return new display_rotation_t if you want to override default rotation
|
||||
display_rotation_t st7565_init_user(display_rotation_t rotation);
|
||||
|
||||
// Clears the display buffer, resets cursor position to 0, and sets the buffer to dirty for rendering
|
||||
void st7565_clear(void);
|
||||
|
||||
// Renders the dirty chunks of the buffer to display
|
||||
void st7565_render(void);
|
||||
|
||||
// Moves cursor to character position indicated by column and line, wraps if out of bounds
|
||||
// Max column denoted by 'st7565_max_chars()' and max lines by 'st7565_max_lines()' functions
|
||||
void st7565_set_cursor(uint8_t col, uint8_t line);
|
||||
|
||||
// Advances the cursor to the next page, writing ' ' if true
|
||||
// Wraps to the begining when out of bounds
|
||||
void st7565_advance_page(bool clearPageRemainder);
|
||||
|
||||
// Moves the cursor forward 1 character length
|
||||
// Advance page if there is not enough room for the next character
|
||||
// Wraps to the begining when out of bounds
|
||||
void st7565_advance_char(void);
|
||||
|
||||
// Writes a single character to the buffer at current cursor position
|
||||
// Advances the cursor while writing, inverts the pixels if true
|
||||
// Main handler that writes character data to the display buffer
|
||||
void st7565_write_char(const char data, bool invert);
|
||||
|
||||
// Writes a string to the buffer at current cursor position
|
||||
// Advances the cursor while writing, inverts the pixels if true
|
||||
void st7565_write(const char *data, bool invert);
|
||||
|
||||
// Writes a string to the buffer at current cursor position
|
||||
// Advances the cursor while writing, inverts the pixels if true
|
||||
// Advances the cursor to the next page, wiring ' ' to the remainder of the current page
|
||||
void st7565_write_ln(const char *data, bool invert);
|
||||
|
||||
// Pans the buffer to the right (or left by passing true) by moving contents of the buffer
|
||||
// Useful for moving the screen in preparation for new drawing
|
||||
void st7565_pan(bool left);
|
||||
|
||||
// Returns a pointer to the requested start index in the buffer plus remaining
|
||||
// buffer length as struct
|
||||
display_buffer_reader_t st7565_read_raw(uint16_t start_index);
|
||||
|
||||
// Writes a string to the buffer at current cursor position
|
||||
void st7565_write_raw(const char *data, uint16_t size);
|
||||
|
||||
// Writes a single byte into the buffer at the specified index
|
||||
void st7565_write_raw_byte(const char data, uint16_t index);
|
||||
|
||||
// Sets a specific pixel on or off
|
||||
// Coordinates start at top-left and go right and down for positive x and y
|
||||
void st7565_write_pixel(uint8_t x, uint8_t y, bool on);
|
||||
|
||||
// Writes a PROGMEM string to the buffer at current cursor position
|
||||
// Advances the cursor while writing, inverts the pixels if true
|
||||
// Remapped to call 'void st7565_write(const char *data, bool invert);' on ARM
|
||||
void st7565_write_P(const char *data, bool invert);
|
||||
|
||||
// Writes a PROGMEM string to the buffer at current cursor position
|
||||
// Advances the cursor while writing, inverts the pixels if true
|
||||
// Advances the cursor to the next page, wiring ' ' to the remainder of the current page
|
||||
// Remapped to call 'void st7565_write_ln(const char *data, bool invert);' on ARM
|
||||
void st7565_write_ln_P(const char *data, bool invert);
|
||||
|
||||
// Writes a PROGMEM string to the buffer at current cursor position
|
||||
void st7565_write_raw_P(const char *data, uint16_t size);
|
||||
|
||||
// Can be used to manually turn on the screen if it is off
|
||||
// Returns true if the screen was on or turns on
|
||||
bool st7565_on(void);
|
||||
|
||||
// Called when st7565_on() turns on the screen, weak function overridable by the user
|
||||
// Not called if the screen is already on
|
||||
void st7565_on_user(void);
|
||||
|
||||
// Can be used to manually turn off the screen if it is on
|
||||
// Returns true if the screen was off or turns off
|
||||
bool st7565_off(void);
|
||||
|
||||
// Called when st7565_off() turns off the screen, weak function overridable by the user
|
||||
// Not called if the screen is already off
|
||||
void st7565_off_user(void);
|
||||
|
||||
// Returns true if the screen is currently on, false if it is
|
||||
// not
|
||||
bool st7565_is_on(void);
|
||||
|
||||
// Basically it's st7565_render, but with timeout management and st7565_task_user calling!
|
||||
void st7565_task(void);
|
||||
|
||||
// Called at the start of st7565_task, weak function overridable by the user
|
||||
void st7565_task_user(void);
|
||||
|
||||
// Inverts the display
|
||||
// Returns true if the screen was or is inverted
|
||||
bool st7565_invert(bool invert);
|
||||
|
||||
// Returns the maximum number of characters that will fit on a line
|
||||
uint8_t st7565_max_chars(void);
|
||||
|
||||
// Returns the maximum number of lines that will fit on the display
|
||||
uint8_t st7565_max_lines(void);
|
||||
```
|
@@ -490,6 +490,8 @@ void ql_finished(qk_tap_dance_state_t *state, void *user_data) {
|
||||
layer_on(_MY_LAYER);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -7,9 +7,9 @@
|
||||
[](https://github.com/qmk/qmk_firmware/pulse/monthly)
|
||||
[](https://github.com/qmk/qmk_firmware/)
|
||||
|
||||
## Qu'est-ce que QMK Firmware ?
|
||||
## Qu'est-ce que QMK Firmware?
|
||||
|
||||
QMK (*Quantum Mechanical Keyboard*) est une communauté open source qui maintient le firmware QMK, la QMK Toolbox (*Boite à outil*), qmk.fm et leurs documentations. QMK Firmware est un firmware dédié aux claviers qui est basé sur [tmk\_keyboard](https://github.com/tmk/tmk_keyboard). Il offre des fonctionnalités très utiles pour les contrôleurs Atmel AVR, et, plus spécifiquement pour [les produits d'OLKB](https://olkb.com), le clavier [ErgoDox EZ](https://www.ergodox-ez.com), et pour les [produits Clueboard](https://clueboard.co/). Il prend désormais aussi en charge les processeurs ARM qui utilisent ChibiOS. Vous pouvez l'utiliser pour contrôler un clavier personnalisé soudé à la main ou alors sur un clavier avec un PCB personnalisé.
|
||||
QMK (*Quantum Mechanical Keyboard*) est une communauté open source qui maintient le firmware QMK, la QMK Toolbox (*Boite à outil*), qmk.fm et leurs documentations. QMK Firmware est un firmware dédié aux claviers qui est basé sur [tmk\_keyboard](https://github.com/tmk/tmk_keyboard). Il offre des fonctionnalités très utiles pour les contrôleurs Atmel AVR, et, plus spécifiquement pour [les produits d'OLKB](https://olkb.com), le clavier [ErgoDox EZ](https://www.ergodox-ez.com), et pour les [produits Clueboard](https://clueboard.co/). Il prend désormais aussi en charge les processeurs ARM qui utilisent ChibiOS. Vous pouvez l'utiliser pour contrôler un clavier personnalisé soudé à la main ou alors sur un clavier avec un PCB personnalisé.
|
||||
|
||||
## Comment l'obtenir
|
||||
|
||||
@@ -23,7 +23,7 @@ Avant d'être prêt à compiler vous allez devoir [installer un environnement](f
|
||||
|
||||
make planck/rev4:default
|
||||
|
||||
Cette commande compilera la révision `rev4` du clavier `planck` avec la disposition `default`. Notez que tous les claviers n'ont pas forcément de révisions (aussi appelées sous-projects ou dossiers, ou en anglais « subprojects » ou « folder »). Cette option peut donc être omise :
|
||||
Cette commande compilera la révision `rev4` du clavier `planck` avec la disposition `default`. Notez que tous les claviers n'ont pas forcément de révisions (aussi appelées sous-projects ou dossiers, ou en anglais «subprojects» ou «folder»). Cette option peut donc être omise:
|
||||
|
||||
make preonic:default
|
||||
|
||||
|
@@ -9,7 +9,7 @@ Nous vous recommandons d'utiliser l'utilitaire [Zadig](https://zadig.akeo.ie/).
|
||||
## Installation
|
||||
|
||||
Passez votre clavier en mode bootloader, soit en appuyant sur le keycode `RESET` (qui peut se trouver dans un calque différent) ou en appuyant sur le bouton reset qui se trouve en général sous la board. Si votre clavier n'a aucune de ces options, essayez de le brancher en maintenant Escape ou Espace+`B` appuyés (voir la documentation de [Bootmagic](feature_bootmagic.md) pour plus de détails). Certaines boards utilisent [Command](feature_command.md) à la place de Bootmagic. Dans ce cas, vous pouvez entrer en mode bootloader en appuyant, à n'importe quel moment lorsque le clavier est branché, sur les combinaisons de touches Shift Gauche+Shift Droit+`B` ou Shift Gauche+Shift Droit+Escape.
|
||||
Certains claviers ont des instructions spécifiques pour passer en mode bootloader. Par exemple, la touche [Bootmagic Lite]](feature_bootmagic.md#bootmagic-lite) (défaut : Échap) peut être sur une touche différente telle que Contrôle Gauche. La combinaison pour la Command (défaut : Shift Gauche+Shift Droit) peut être différente, par exemple Contrôle Gauche+Contrôle Droit. Référez-vous au fichier README de votre clavier.
|
||||
Certains claviers ont des instructions spécifiques pour passer en mode bootloader. Par exemple, la touche [Bootmagic Lite]](feature_bootmagic.md#bootmagic-lite) (défaut: Échap) peut être sur une touche différente telle que Contrôle Gauche. La combinaison pour la Command (défaut: Shift Gauche+Shift Droit) peut être différente, par exemple Contrôle Gauche+Contrôle Droit. Référez-vous au fichier README de votre clavier.
|
||||
|
||||
Pour mettre un clavier en mode bootloader avec USBaspLoader, appuyez sur le bouton `RESET` tout en maintenant le bouton `BOOT`. Vous pouvez aussi maintenir le bouton `BOOT` en branchant le câble USB.
|
||||
|
||||
@@ -43,4 +43,4 @@ Cliquez dessus avec le bouton droit et sélectionner **Désinstaller le périph
|
||||
|
||||

|
||||
|
||||
Appuyez sur **Action → Analyser les changements de hardware**. A ce stade, vous devriez pouvoir saisir à nouveau. Vérifiez dans Zadig que les périphériques utilisent bien le pilote `HidUsb`. Si c'est le cas, vous avez corrigé le problème, votre clavier devrait fonctionner à nouveau !
|
||||
Appuyez sur **Action → Analyser les changements de hardware**. A ce stade, vous devriez pouvoir saisir à nouveau. Vérifiez dans Zadig que les périphériques utilisent bien le pilote `HidUsb`. Si c'est le cas, vous avez corrigé le problème, votre clavier devrait fonctionner à nouveau!
|
||||
|
@@ -20,7 +20,7 @@ Veuillez noter que lancer `make` avec `sudo` est généralement une **mauvaise**
|
||||
|
||||
### Règles `udev` pour Linux
|
||||
|
||||
Sous Linux, vous aurez besoin des permissions appropriées pour accéder au MCU (le micro-contrôleur). Vous avez le choix d'utiliser `sudo` en flashant le firmware, ou placer ces fichiers dans `/etc/udev/rules.d`. Une fois ajouté, lancez les commandes suivantes :
|
||||
Sous Linux, vous aurez besoin des permissions appropriées pour accéder au MCU (le micro-contrôleur). Vous avez le choix d'utiliser `sudo` en flashant le firmware, ou placer ces fichiers dans `/etc/udev/rules.d`. Une fois ajouté, lancez les commandes suivantes:
|
||||
|
||||
```console
|
||||
sudo udevadm control --reload-rules
|
||||
|
@@ -6,13 +6,13 @@ Cette page détaille diverses questions fréquemment posées par les utilisateur
|
||||
|
||||
## `hid_listen` ne reconnaît pas de périphérique
|
||||
|
||||
Lorsque la console de débugage sur votre périphérique n'est pas prêt, vous obtiendrez un message similaire :
|
||||
Lorsque la console de débugage sur votre périphérique n'est pas prêt, vous obtiendrez un message similaire:
|
||||
|
||||
```
|
||||
Waiting for device:.........
|
||||
```
|
||||
|
||||
Une fois le périphérique connecté, *hid_listen* le trouve et vous obtiendrez ce message :
|
||||
Une fois le périphérique connecté, *hid_listen* le trouve et vous obtiendrez ce message:
|
||||
|
||||
```
|
||||
Waiting for new device:.........................
|
||||
@@ -61,7 +61,7 @@ Vous ne voulez probablement pas "briquer" votre clavier, rendre impossible d'éc
|
||||
|
||||
- Si votre map de clavier n'inclut pas de RESET, pour entrer en mode DFU, vous devrez appuyer sur le bouton reset du PCB. Cela implique que vous devrez certainement dévisser certaines pièces de votre clavier pour y accéder.
|
||||
- Modifier les fichiers tmk_core / common peut rendre le clavier inutilisable
|
||||
- Si un fichier .hex trop large est la cause du problème : `make dfu` supprime le bloc puis teste la taille (il ne fait pas les choses dans le bon ordre), ce qui provoque une erreur. En résultat, le flash n’aura pas été fait et le clavier restera en mode DFU.
|
||||
- Si un fichier .hex trop large est la cause du problème: `make dfu` supprime le bloc puis teste la taille (il ne fait pas les choses dans le bon ordre), ce qui provoque une erreur. En résultat, le flash n’aura pas été fait et le clavier restera en mode DFU.
|
||||
- Pour finir, notez que la taille maximale d'un fichier .hex sur un Plank est de 7000h (28672 decimal)
|
||||
|
||||
```
|
||||
@@ -118,7 +118,7 @@ Sous Windows, activez l'option `Permettre au périphérique de sortir l'ordinate
|
||||
|
||||
Appuyer sur n'importe quelle touche en mode veille devrait sortir l'ordinateur de veille.
|
||||
|
||||
## Vous utilisez un Arduino ?
|
||||
## Vous utilisez un Arduino?
|
||||
|
||||
**Faites attention au fait que le nommage des pin d'un Arduino diffère de la puce**. Par exemple, la pin `D0` n'est pas `PD0`. Vérifiez le circuit avec la fiche technique.
|
||||
|
||||
|
@@ -44,7 +44,7 @@ Le premier n'est reconnu que sur macOS, alors que le dernier, `KC_SLEP` et `KC_W
|
||||
|
||||
## Modificateur "One Shot"
|
||||
|
||||
Cette fonctionnalité permet de corriger un problème avec la touche Shift. En effet, il arrive de saisir plusieurs majuscules en ne voulant en saisir qu'une sur un mot. Ex : `CEtte` à la place de `Cette`. La fonctionnalité « One shot » shift permet de corriger ça.
|
||||
Cette fonctionnalité permet de corriger un problème avec la touche Shift. En effet, il arrive de saisir plusieurs majuscules en ne voulant en saisir qu'une sur un mot. Ex: `CEtte` à la place de `Cette`. La fonctionnalité «One shot» shift permet de corriger ça.
|
||||
|
||||
https://github.com/tmk/tmk_keyboard/issues/67
|
||||
|
||||
@@ -59,7 +59,7 @@ Pour les touches de modification et les actions de calque, vous devez placer `KC
|
||||
|
||||
## Support de touche à verrouillage mécanique
|
||||
|
||||
Cette fonctionnalité permet l'usage de *touches à verrouillage mécanique* comme [ces interrupteurs Alps](https://deskthority.net/wiki/Alps_SKCL_Lock). Vous pouvez l'activer en ajoutant ceci à votre `config.h` :
|
||||
Cette fonctionnalité permet l'usage de *touches à verrouillage mécanique* comme [ces interrupteurs Alps](https://deskthority.net/wiki/Alps_SKCL_Lock). Vous pouvez l'activer en ajoutant ceci à votre `config.h`:
|
||||
|
||||
```
|
||||
#define LOCKING_SUPPORT_ENABLE
|
||||
|
@@ -27,15 +27,15 @@ Méthodes de flash compatibles :
|
||||
* [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) (interface graphique recommandé)
|
||||
* [dfu-programmer](https://github.com/dfu-programmer/dfu-programmer) / `:dfu` avec QMK (outil en ligne de commande recommandé)
|
||||
|
||||
Ordre des actions :
|
||||
Ordre des actions:
|
||||
|
||||
1. Pressez le keycode `RESET`, ou appuyez sur le bouton physique RESET ou alors créez un contact entre RST et GND.
|
||||
2. Attendez que l'OS detecte l'appareil.
|
||||
3. Éffacez la mémoire, cela peut être fait automatiquement.
|
||||
4. Flasher le fichier .hex.
|
||||
5. Redémarrez l'appareil en mode « application », cela peut être fait automatiquement.
|
||||
5. Redémarrez l'appareil en mode «application», cela peut être fait automatiquement.
|
||||
|
||||
Alternativement :
|
||||
Alternativement:
|
||||
|
||||
make <keyboard>:<keymap>:dfu
|
||||
|
||||
@@ -48,11 +48,11 @@ QMK a un fork du bootloader LUFA DFU qui vous permet de faire un simple scan de
|
||||
#define QMK_LED E6
|
||||
#define QMK_SPEAKER C6
|
||||
|
||||
Le fabricant et le nom du produit proviennent de vos définitions dans fichier `config.h`, et la chaîne de caractère « bootloader » est ajoutée au nom du produit.
|
||||
Le fabricant et le nom du produit proviennent de vos définitions dans fichier `config.h`, et la chaîne de caractère «bootloader» est ajoutée au nom du produit.
|
||||
|
||||
Pour génerer le bootloader, utilisez la cible `bootloader`. Exemple : `make planck/rev4:default:bootloader`.
|
||||
Pour génerer le bootloader, utilisez la cible `bootloader`. Exemple: `make planck/rev4:default:bootloader`.
|
||||
|
||||
Pour génerer un fichier .hex prêt pour la production qui contiendra tant l'application que le bootloader, utilisez la cible `production`. Exemple : `make planck/rev4:default:production`.
|
||||
Pour génerer un fichier .hex prêt pour la production qui contiendra tant l'application que le bootloader, utilisez la cible `production`. Exemple: `make planck/rev4:default:production`.
|
||||
|
||||
### Commandes DFU
|
||||
|
||||
@@ -67,7 +67,7 @@ Il y a plusieurs commandes DFU que vous pouvez utiliser pour flasher le firmware
|
||||
|
||||
Les cartes arduinos et leurs clones utilisent le [bootloader Caterina](https://github.com/arduino/ArduinoCore-avr/tree/master/bootloaders/caterina) (tous les claviers utilisant un Pro Micro, ou un clone). Ils utilisent aussi le protocole avr109 pour communiquer en virtuellement en série (serial en anglais). Les bootloaders comme le [A-Star](https://www.pololu.com/docs/0J61/9) sont basés sur Caterina.
|
||||
|
||||
Pour vérifier la compatibilité avec un bootloader Caterina, vérifiez que ce bloc est présent dans votre fichier `rules.mk` :
|
||||
Pour vérifier la compatibilité avec un bootloader Caterina, vérifiez que ce bloc est présent dans votre fichier `rules.mk`:
|
||||
|
||||
```make
|
||||
# Bootloader selection
|
||||
@@ -81,20 +81,20 @@ Pour vérifier la compatibilité avec un bootloader Caterina, vérifiez que ce b
|
||||
BOOTLOADER = caterina
|
||||
```
|
||||
|
||||
Flashers compatibles :
|
||||
Flashers compatibles:
|
||||
|
||||
* [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) (Interface graphique recommandée)
|
||||
* [avrdude](https://www.nongnu.org/avrdude/) avec avr109 / `:avrdude` (Outil en ligne de commande recommandé)
|
||||
* [AVRDUDESS](https://github.com/zkemble/AVRDUDESS)
|
||||
|
||||
Séquence de flash :
|
||||
Séquence de flash :
|
||||
|
||||
1. Pressez la touche avec le keycode `RESET`, ou reliez les ports GND et RST. Vous n'avez que 7 secondes pour flasher une fois que l'opération a été faite.
|
||||
2. Attendez que l'OS détecte l'appareil.
|
||||
3. Flasher le fichier .hex.
|
||||
4. Attendez que l'appareil redémarre automatiquement.
|
||||
|
||||
ou, utilisez :
|
||||
ou, utilisez:
|
||||
|
||||
make <keyboard>:<keymap>:avrdude
|
||||
|
||||
@@ -111,7 +111,7 @@ Il existe un certain nombre de commandes DFU que vous pouvez utiliser pour mettr
|
||||
|
||||
Halfkay est un protocole ultra-simple développé par PJRC qui utilise HID et qui est fourni avec tous les Teensys après le modèle 2.0.
|
||||
|
||||
Pour vérifier la compatibilité avec le booloader Halfkay, vérifiez que ce bloc est présent dans votre fichier `rules.mk` :
|
||||
Pour vérifier la compatibilité avec le booloader Halfkay, vérifiez que ce bloc est présent dans votre fichier `rules.mk`:
|
||||
|
||||
```make
|
||||
# Bootloader selection
|
||||
@@ -125,24 +125,24 @@ Pour vérifier la compatibilité avec le booloader Halfkay, vérifiez que ce blo
|
||||
BOOTLOADER = halfkay
|
||||
```
|
||||
|
||||
Flasher compatibles :
|
||||
Flasher compatibles:
|
||||
|
||||
* [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) (Interface graphique recomandée)
|
||||
* [Teensy Loader](https://www.pjrc.com/teensy/loader.html) (petit utilitaire ultra simple)
|
||||
[Teensy Loader en ligne de commande](https://www.pjrc.com/teensy/loader_cli.html) (Outil en ligne de commande recommandé)
|
||||
|
||||
Séquence de flash :
|
||||
Séquence de flash:
|
||||
|
||||
1. Pressez la touche du keycode `RESET`, ou reliez les ports RST et GND rapidement. Vous avez ensuite 7 secondes pour réaliser le flash.
|
||||
2. Attendez que l'OS détecte l'appareil.
|
||||
3. Flasher le fichier .hex.
|
||||
4. Redémarrez l'appareil en mode « application ». Cela peut être fait automatiquement.
|
||||
4. Redémarrez l'appareil en mode «application». Cela peut être fait automatiquement.
|
||||
|
||||
## USBasploader
|
||||
|
||||
USBasploader est un bootloader développé par matrixstorm. Il est utilisé sur des processeurs AVR non-USB comme le ATmega328P, qui fonctionne grâce à V-USB.
|
||||
|
||||
Pour vérifier la compatibilité avec le booloader USBasploader, vérifiez que ce bloc est présent dans votre fichier `rules.mk` :
|
||||
Pour vérifier la compatibilité avec le booloader USBasploader, vérifiez que ce bloc est présent dans votre fichier `rules.mk`:
|
||||
|
||||
```make
|
||||
# Bootloader selection
|
||||
@@ -156,24 +156,24 @@ Pour vérifier la compatibilité avec le booloader USBasploader, vérifiez que c
|
||||
BOOTLOADER = USBasp
|
||||
```
|
||||
|
||||
Flashers compatibles :
|
||||
Flashers compatibles:
|
||||
|
||||
* [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) (Interface graphique recommandé)
|
||||
* [avrdude](https://www.nongnu.org/avrdude/) avec le programmeur `usbasp`.
|
||||
* [AVRDUDESS](https://github.com/zkemble/AVRDUDESS)
|
||||
|
||||
Séquence de flash :
|
||||
Séquence de flash:
|
||||
|
||||
1. Pressez la touche du keycode `RESET`, ou reliez le port de boot pendant que RST et GND snt reliés. Cela doit être fait très rapidement.
|
||||
2. Attendez que l'OS détecte l'appareil.
|
||||
3. Flasher le fichier .hex.
|
||||
4. Redémarrez l'appareil en mode « application ». Cela peut être fait automatiquement.
|
||||
4. Redémarrez l'appareil en mode «application». Cela peut être fait automatiquement.
|
||||
|
||||
## BootloadHID
|
||||
|
||||
BootloadHID est un bootloader pour les microcontrôleurs AVR. L'utilitaire de téleversement ne demande pas de drivers au niveau du kernel et peut être lancé sans installer aucune DLLs.
|
||||
|
||||
Pour vérifier la compatibilité avec le bootloader bootloadHID, vérifiez que ce bloc existe dans votre fichier `rules.mk` :
|
||||
Pour vérifier la compatibilité avec le bootloader bootloadHID, vérifiez que ce bloc existe dans votre fichier `rules.mk` :
|
||||
|
||||
```make
|
||||
# Bootloader selection
|
||||
@@ -187,50 +187,50 @@ Pour vérifier la compatibilité avec le bootloader bootloadHID, vérifiez que c
|
||||
BOOTLOADER = bootloadHID
|
||||
```
|
||||
|
||||
Utilitaires de flash compatibles :
|
||||
Utilitaires de flash compatibles:
|
||||
|
||||
* [HIDBootFlash](http://vusb.wikidot.com/project:hidbootflash) (Utilitaire avec interface graphique recommandé)
|
||||
* [bootloadhid Command Line](https://www.obdev.at/products/vusb/bootloadhid.html) / `:BootloadHID` avec QMK (utilitaire en ligne de commande recommandé)
|
||||
|
||||
Séquence de flash
|
||||
|
||||
1. Entrez dans le bootloader en utilisant l'une de ces méthodes :
|
||||
1. Entrez dans le bootloader en utilisant l'une de ces méthodes:
|
||||
* Pressez la touche du keycode `RESET` (Cela ne fonctionnera pas sur certains appareils).
|
||||
* Verrouillez la touche « Salt » tout en branchant le clavier (Généralement ce principe est documenté dans le fichier readme du clavier)
|
||||
* Verrouillez la touche «Salt» tout en branchant le clavier (Généralement ce principe est documenté dans le fichier readme du clavier)
|
||||
2. Attendez que l'OS détecte l'appareil.
|
||||
3. Flasher le fichier .hex.
|
||||
4. Redémarrez l'appareil en mode « application ». Cela peut être fait automatiquement.
|
||||
4. Redémarrez l'appareil en mode «application». Cela peut être fait automatiquement.
|
||||
|
||||
Ou alors :
|
||||
Ou alors:
|
||||
|
||||
make <keyboard>:<keymap>:bootloadHID
|
||||
|
||||
## STM32
|
||||
|
||||
Tous les processeurs STM32 contiennent un bootloader installé en usine qui ne peut pas être modifié ou supprimé. Certains processeurs STM32 ont des bootloaders qui ne peuvent pas être programmés par USB (ex : STM32F103) mais le processus reste le même.
|
||||
Tous les processeurs STM32 contiennent un bootloader installé en usine qui ne peut pas être modifié ou supprimé. Certains processeurs STM32 ont des bootloaders qui ne peuvent pas être programmés par USB (ex: STM32F103) mais le processus reste le même.
|
||||
|
||||
Pour le moment, aucune variable `BOOTLOADER` n'est nécessaire dans le fichier `rules.mk`.
|
||||
|
||||
Flashers compatibles :
|
||||
Flashers compatibles:
|
||||
|
||||
* [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) (interface graphique recommandé)
|
||||
* [dfu-util](https://github.com/Stefan-Schmidt/dfu-util) / `:dfu-util` (utilitaire en ligne de commande recommandé)
|
||||
|
||||
Séquence pour flasher:
|
||||
|
||||
1. Entrez dans le bootloader en utilisant l'une de ces méthodes :
|
||||
1. Entrez dans le bootloader en utilisant l'une de ces méthodes:
|
||||
* Utilisez une touche sur laquelle le keycode `RESET` (Cela peut ne pas fonctionner sur les appareils STM32F042)
|
||||
* Si un circuit de réinitialisation (Reset) est présent alors utilisé le bouton qui lui est dédié.
|
||||
* Autrement, vous devez réaliser une liaison entre BOOT0 et VCC (en appuyant sur le bouton ou à l'aide d'un pont) puis faire un pont entre RESET et GND et enfin relacher le pont BOOT0.
|
||||
2. Attendre que l'os détecte l'appareil.
|
||||
3. Flasher un fichier `.bin`.h
|
||||
* Vous allez recevoir un avertissement à propos de la signature DFU. Ignorez-la.
|
||||
4. Réinitialisez l'appareil en mode « application ». Cela peut être fait automatiquement.
|
||||
* Si vous êtes en train de travailler en ligne de commande, par exemple avec un `make planck/rev6:default:dfu-util` alors soyez bien sur que l'argument `:leave` est passé aux arguments DFU grâce à la variable `DFU_ARGS` à l'intérieur de votre fichier `rules.mk` (Ex : `DFU_ARGS = -d 0483:df11 -a 0 -s 0x08000000:leave`) afin que votre appareil redémarre après avoir été flashé.
|
||||
4. Réinitialisez l'appareil en mode «application». Cela peut être fait automatiquement.
|
||||
* Si vous êtes en train de travailler en ligne de commande, par exemple avec un `make planck/rev6:default:dfu-util` alors soyez bien sur que l'argument `:leave` est passé aux arguments DFU grâce à la variable `DFU_ARGS` à l'intérieur de votre fichier `rules.mk` (Ex: `DFU_ARGS = -d 0483:df11 -a 0 -s 0x08000000:leave`) afin que votre appareil redémarre après avoir été flashé.
|
||||
|
||||
### Commandes STM32
|
||||
|
||||
Il y a différentes commandes que vous pouvez utiliser pour flasher un firmware dans un appareil STM32 :
|
||||
Il y a différentes commandes que vous pouvez utiliser pour flasher un firmware dans un appareil STM32:
|
||||
|
||||
* `:dfu-util` - C'est l'option standard pour flasher un appareil STM32. Le script attendra qu'un bootloader STM32 soit présent.
|
||||
* `:dfu-util-split-left` - Permet de flasher un firmware normalement, tout comme l'option précédente mais permet de configurer le côté gauche des paramètres EEPROM sur un clavier scindé.
|
||||
|
@@ -88,7 +88,7 @@ Par exemple, si votre keymap s'appelle "xyverz" et que vous fabriquez une keymap
|
||||
|
||||
La commande va vérifier la configuration du clavier, puis tentera de le flasher en fonction du bootloader (chargeur d’amorçage) spécifié. Cela signifie que vous n'avez pas besoin de savoir quel bootloader votre clavier utilise. Exécutez simplement la commande et laissez-le faire le gros du travail.
|
||||
|
||||
Cependant, tout dépend du bootloader qui est installé sur le clavier. Si cette information n’est pas configurée ou si vous tentez de flasher un clavier qui ne permet pas d’être flashé alors vous obtiendrez cette erreur :
|
||||
Cependant, tout dépend du bootloader qui est installé sur le clavier. Si cette information n’est pas configurée ou si vous tentez de flasher un clavier qui ne permet pas d’être flashé alors vous obtiendrez cette erreur:
|
||||
|
||||
WARNING: This board's bootloader is not specified or is not supported by the ":flash" target at this time.
|
||||
|
||||
@@ -326,7 +326,7 @@ Il y aun certain nombre de commandes du DFU que vous pouvez utiliser pour flash
|
||||
|
||||
### BootloadHID
|
||||
|
||||
Pour les claviers basés sur Bootmapper Client(BMC)/bootloadHID/ATmega32A, si vous êtes prêts à compiler et flasher le firmware, ouvrez votre fenêtre de terminal et lancez la commande suivante :
|
||||
Pour les claviers basés sur Bootmapper Client(BMC)/bootloadHID/ATmega32A, si vous êtes prêts à compiler et flasher le firmware, ouvrez votre fenêtre de terminal et lancez la commande suivante:
|
||||
|
||||
make <my_keyboard>:<my_keymap>:bootloaderHID
|
||||
|
||||
@@ -351,7 +351,7 @@ Error opening HIDBoot device: The specified device was not found
|
||||
Trying again in 5s.
|
||||
```
|
||||
|
||||
Une fois ce résultat obtenu, réinitialisez le contrôleur. Le résultat suivant devrait s’afficher :
|
||||
Une fois ce résultat obtenu, réinitialisez le contrôleur. Le résultat suivant devrait s’afficher:
|
||||
|
||||
```
|
||||
Page size = 128 (0x80)
|
||||
|
@@ -113,7 +113,7 @@ Don't hold the iron on the solder/joint longer than necessary. Heat will be cond
|
||||
|
||||
#### Soldering the Diodes
|
||||
|
||||
Starting at the top-left switch, place the diode (with tweezers if you have them) on the switch so that the diode itself is vertically aligned, and the black line is facing toward you. The input lead of the diode should be touching the left contact on the switch, and the bent, output end should be facing to the right and resting on the switch there, like this:
|
||||
Starting at the top-left switch, place the diode (with tweezers if you have them) on the switch so that the diode itself is vertically aligned, and the black line is facing toward you. Make sure the diodes are soldered in parallel (diode outputs shouldn't connect to diode inputs). The input lead of the diode should be touching the left contact on the switch, and the bent, output end should be facing to the right and resting on the switch there, like this:
|
||||
|
||||

|
||||
|
||||
|
@@ -3,7 +3,6 @@
|
||||
* [セットアップ](ja/newbs_getting_started.md)
|
||||
* [初めてのファームウェアの構築](ja/newbs_building_firmware.md)
|
||||
* [ファームウェアのフラッシュ](ja/newbs_flashing.md)
|
||||
* [テストとデバッグ](ja/newbs_testing_debugging.md)
|
||||
* [手助けを得る/サポート](ja/support.md)
|
||||
* [他のリソース](ja/newbs_learn_more_resources.md)
|
||||
* [シラバス](ja/syllabus.md)
|
||||
@@ -11,7 +10,8 @@
|
||||
* FAQ
|
||||
* [一般的な FAQ](ja/faq_general.md)
|
||||
* [QMK のビルド/コンパイル](ja/faq_build.md)
|
||||
* [QMK のデバッグ/トラブルシューティング](ja/faq_debug.md)
|
||||
* [QMK のデバッグ](ja/faq_debug.md)
|
||||
* [QMK のトラブルシューティング](ja/faq_misc.md)
|
||||
* [キーマップ FAQ](ja/faq_keymap.md)
|
||||
* [用語](ja/reference_glossary.md)
|
||||
|
||||
@@ -23,11 +23,13 @@
|
||||
* [概要](ja/api_overview.md)
|
||||
* [API ドキュメント](ja/api_docs.md)
|
||||
* [キーボードサポート](ja/reference_configurator_support.md)
|
||||
* [デフォルトキーマップの追加](ja/configurator_default_keymaps.md)
|
||||
|
||||
* CLI
|
||||
* [概要](ja/cli.md)
|
||||
* [設定](ja/cli_configuration.md)
|
||||
* [コマンド](ja/cli_commands.md)
|
||||
* [Tab 補完](ja/cli_tab_complete.md)
|
||||
|
||||
* QMK を使う
|
||||
* ガイド
|
||||
@@ -41,8 +43,8 @@
|
||||
* [書き込み](ja/flashing.md)
|
||||
* [ATmega32A の書き込み (ps2avrgb)](ja/flashing_bootloadhid.md)
|
||||
* IDE
|
||||
* [Eclipse で QMK を使用](ja/other_eclipse.md)
|
||||
* [VSCode で QMK を使用](ja/other_vscode.md)
|
||||
* [QMK での Eclipse の使用](ja/other_eclipse.md)
|
||||
* [QMK での VSCode の使用](ja/other_vscode.md)
|
||||
* Git のベストプラクティス
|
||||
* [入門](ja/newbs_git_best_practices.md)
|
||||
* [フォーク](ja/newbs_git_using_your_master_branch.md)
|
||||
@@ -79,6 +81,7 @@
|
||||
* [ワンショットキー](ja/one_shot_keys.md)
|
||||
* [ポインティング デバイス](ja/feature_pointing_device.md)
|
||||
* [ロー HID](ja/feature_rawhid.md)
|
||||
* [シーケンサー](ja/feature_sequencer.md)
|
||||
* [スワップハンド](ja/feature_swap_hands.md)
|
||||
* [タップダンス](ja/feature_tap_dance.md)
|
||||
* [タップホールド設定](ja/tap_hold.md)
|
||||
@@ -103,6 +106,7 @@
|
||||
* [DIP スイッチ](ja/feature_dip_switch.md)
|
||||
* [エンコーダ](ja/feature_encoders.md)
|
||||
* [触覚フィードバック](ja/feature_haptic_feedback.md)
|
||||
* [ジョイスティック](ja/feature_joystick.md)
|
||||
* [LED インジケータ](ja/feature_led_indicators.md)
|
||||
* [Proton C 変換](ja/proton_c_conversion.md)
|
||||
* [PS/2 マウス](ja/feature_ps2_mouse.md)
|
||||
@@ -116,11 +120,8 @@
|
||||
* 互換性を破る変更/Breaking changes
|
||||
* [概要](ja/breaking_changes.md)
|
||||
* [プルリクエストにフラグが付けられた](ja/breaking_changes_instructions.md)
|
||||
* 履歴
|
||||
* [2020年8月29日](ja/ChangeLog/20200829.md)
|
||||
* [2020年5月30日](ja/ChangeLog/20200530.md)
|
||||
* [2020年2月29日](ja/ChangeLog/20200229.md)
|
||||
* [2019年8月30日](ja/ChangeLog/20190830.md)
|
||||
* [最近の変更履歴](ChangeLog/20210227.md "QMK v0.12.0 - 2021 Feb 27")
|
||||
* [過去の互換性を破る変更](ja/breaking_changes_history.md)
|
||||
|
||||
* C 開発
|
||||
* [ARM デバッグ ガイド](ja/arm_debugging.md)
|
||||
@@ -129,11 +130,13 @@
|
||||
* [互換性のあるマイクロコントローラ](ja/compatible_microcontrollers.md)
|
||||
* [ドライバ](ja/hardware_drivers.md)
|
||||
* [ADC ドライバ](ja/adc_driver.md)
|
||||
* [オーディオドライバ](ja/audio_driver.md)
|
||||
* [I2C ドライバ](ja/i2c_driver.md)
|
||||
* [SPI ドライバ](ja/spi_driver.md)
|
||||
* [WS2812 ドライバ](ja/ws2812_driver.md)
|
||||
* [EEPROM ドライバ](ja/eeprom_driver.md)
|
||||
* [シリアル ドライバ](ja/serial_driver.md)
|
||||
* [UART ドライバ](ja/uart_driver.md)
|
||||
* [GPIO 制御](ja/internals_gpio_control.md)
|
||||
* [キーボード ガイドライン](ja/hardware_keyboard_guidelines.md)
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
# QMK API
|
||||
|
||||
<!---
|
||||
original document: 0.9.50:docs/api_docs.md
|
||||
git diff 0.9.50 HEAD -- docs/api_docs.md | cat
|
||||
original document: 0.13.15:docs/api_docs.md
|
||||
git diff 0.13.15 HEAD -- docs/api_docs.md | cat
|
||||
-->
|
||||
|
||||
このページは QMK API の使い方を説明します。もしあなたがアプリケーション開発者であれば、全ての [QMK](https://qmk.fm) キーボードのファームウェアをコンパイルするために、この API を使うことができます。
|
||||
|
@@ -1,8 +1,8 @@
|
||||
# QMK API
|
||||
|
||||
<!---
|
||||
original document: 0.9.50:docs/api_overview.md
|
||||
git diff 0.9.50 HEAD -- docs/api_overview.md | cat
|
||||
original document: 0.13.15:docs/api_overview.md
|
||||
git diff 0.13.15 HEAD -- docs/api_overview.md | cat
|
||||
-->
|
||||
|
||||
QMK API は、Web と GUI ツールが [QMK](https://qmk.fm/) によってサポートされるキーボード用の任意のキーマップをコンパイルするために使うことができる、非同期 API を提供します。標準のキーマップテンプレートは、C コードのサポートを必要としない全ての QMK キーコードをサポートします。キーボードのメンテナは独自のカスタムテンプレートを提供して、より多くの機能を実現することができます。
|
||||
|
@@ -74,7 +74,7 @@ default.keymap: None -> default
|
||||
|
||||
qmk config compile
|
||||
|
||||
### 単一キーの例
|
||||
### 単一キーの例 :id=single-key-example
|
||||
|
||||
qmk config compile.keyboard
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
# コーディング規約 (C)
|
||||
|
||||
<!---
|
||||
original document: 0.9.19:docs/coding_conventions_c.md
|
||||
git diff 0.9.19 HEAD -- docs/coding_conventions_c.md | cat
|
||||
original document: 0.13.15:docs/coding_conventions_c.md
|
||||
git diff 0.13.15 HEAD -- docs/coding_conventions_c.md | cat
|
||||
-->
|
||||
|
||||
私たちのスタイルのほとんどはかなり理解しやすいですが、現時点では完全に一貫しているわけではありません。変更箇所周辺のコードのスタイルと一致させる必要がありますが、そのコードに一貫性が無い場合や不明瞭な場合は以下のガイドラインに従ってください:
|
||||
|
@@ -1,8 +1,8 @@
|
||||
# QMK の設定
|
||||
|
||||
<!---
|
||||
original document: 0.10.33:docs/config_options.md
|
||||
git diff 0.10.33 HEAD -- docs/config_options.md | cat
|
||||
original document: 0.13.17:docs/config_options.md
|
||||
git diff 0.13.17 HEAD -- docs/config_options.md | cat
|
||||
-->
|
||||
|
||||
QMK はほぼ無制限に設定可能です。可能なところはいかなるところでも、やりすぎな程、ユーザーがコードサイズを犠牲にしてでも彼らのキーボードをカスタマイズをすることを許しています。ただし、このレベルの柔軟性により設定が困難になります。
|
||||
@@ -72,16 +72,22 @@ QMK での全ての利用可能な設定にはデフォルトがあります。
|
||||
* (循環させるために)代替音声を有効にします
|
||||
* `#define C4_AUDIO`
|
||||
* ピン C4 のオーディオを有効にします
|
||||
* 非推奨。`#define AUDIO_PIN C4` を使ってください
|
||||
* `#define C5_AUDIO`
|
||||
* ピン C5 のオーディオを有効にします
|
||||
* 非推奨。`#define AUDIO_PIN C5` を使ってください
|
||||
* `#define C6_AUDIO`
|
||||
* ピン C6 のオーディオを有効にします
|
||||
* 非推奨。`#define AUDIO_PIN C6` を使ってください
|
||||
* `#define B5_AUDIO`
|
||||
* ピン B5 のオーディオを有効にします (C[4-6]\_AUDIO の1つとともに B[5-7]\_AUDIO の1つが有効にされている場合、疑似ステレオが有効にされます)
|
||||
* ピン B5 のオーディオを有効にします (C ピンの1つとともに B ピンの1つが有効にされている場合、疑似ステレオが有効にされます)
|
||||
* 非推奨。もし `AUDIO_PIN` で `C` ピンを有効にしている場合は、`#define AUDIO_PIN_ALT B5` を使い、そうでなければ `#define AUDIO_PIN B5` を使います。
|
||||
* `#define B6_AUDIO`
|
||||
* ピン B6 のオーディオを有効にします (C[4-6]\_AUDIO の1つとともに B[5-7]\_AUDIO の1つが有効にされている場合、疑似ステレオが有効にされます)
|
||||
* ピン B6 のオーディオを有効にします (C ピンの1つとともに B ピンの1つが有効にされている場合、疑似ステレオが有効にされます)
|
||||
* 非推奨。もし `AUDIO_PIN` で `C` ピンを有効にしている場合は、`#define AUDIO_PIN_ALT B6` を使い、そうでなければ `#define AUDIO_PIN B6` を使います。
|
||||
* `#define B7_AUDIO`
|
||||
* ピン B7 のオーディオを有効にします (C[4-6]\_AUDIO の1つとともに B[5-7]\_AUDIO の1つが有効にされている場合、疑似ステレオが有効にされます)
|
||||
* ピン B7 のオーディオを有効にします (C ピンの1つとともに B ピンの1つが有効にされている場合、疑似ステレオが有効にされます)
|
||||
* 非推奨。もし `AUDIO_PIN` で `C` ピンを有効にしている場合は、`#define AUDIO_PIN_ALT B7` を使い、そうでなければ `#define AUDIO_PIN B7` を使います。
|
||||
* `#define BACKLIGHT_PIN B7`
|
||||
* バックライトのピン
|
||||
* `#define BACKLIGHT_LEVELS 3`
|
||||
@@ -93,7 +99,7 @@ QMK での全ての利用可能な設定にはデフォルトがあります。
|
||||
* `#define DEBOUNCE 5`
|
||||
* ピンの値を読み取る時の遅延 (5がデフォルト)
|
||||
* `#define LOCKING_SUPPORT_ENABLE`
|
||||
* メカニカルロックのサポート。キーマップで KC_LCAP、 KC_LNUM そして KC_LSCR を使えるようにします
|
||||
* メカニカルロックのサポート。キーマップで KC_LCAP、KC_LNUM そして KC_LSCR を使えるようにします
|
||||
* `#define LOCKING_RESYNC_ENABLE`
|
||||
* キーボードの LED の状態をスイッチの状態と一致させ続けようとします
|
||||
* `#define IS_COMMAND() (get_mods() == MOD_MASK_SHIFT)`
|
||||
@@ -102,6 +108,8 @@ QMK での全ての利用可能な設定にはデフォルトがあります。
|
||||
* デバイスの USB 経由の最大電力(mA) を設定します (デフォルト: 500)
|
||||
* `#define USB_POLLING_INTERVAL_MS 10`
|
||||
* キーボード、マウス および 共有 (NKRO/メディアキー) インタフェースのための USB ポーリングレートをミリ秒で設定します
|
||||
* `#define USB_SUSPEND_WAKEUP_DELAY 200`
|
||||
* ウェイクアップパケットを送信した後で一時停止するミリ秒を設定します
|
||||
* `#define F_SCL 100000L`
|
||||
* I2C を使用するキーボードのための I2C クロックレート速度を設定します。デフォルトは `400000L` ですが、`split_common` を使っているキーボードは別でデフォルトは `100000L` です。
|
||||
|
||||
@@ -142,6 +150,8 @@ QMK での全ての利用可能な設定にはデフォルトがあります。
|
||||
* `#define RETRO_TAPPING`
|
||||
* 押下とリリースの間に他のキーによる中断がなければ、TAPPING_TERM の後であってもとにかくタップします
|
||||
* 詳細は [Retro Tapping](ja/tap_hold.md#retro-tapping) を見てください
|
||||
* `#define RETRO_TAPPING_PER_KEY`
|
||||
* キーごとの `RETRO_TAPPING` 設定の処理を有効にします
|
||||
* `#define TAPPING_TOGGLE 2`
|
||||
* トグルを引き起こす前のタップ数
|
||||
* `#define PERMISSIVE_HOLD`
|
||||
@@ -240,7 +250,7 @@ QMK での全ての利用可能な設定にはデフォルトがあります。
|
||||
* DFU ブートローダを搭載したボードでは、これらの EEPROM ファイルを書き込むために `:dfu-split-left`/`:dfu-split-right` を使うことができます
|
||||
* Caterina ブートローダを搭載したボード (標準的な Pro Micros など)では、`:avrdude-split-left`/`:avrdude-split-right` を使ってください
|
||||
* ARM DFU ブートローダを搭載したボード (Proton C など)では、`:dfu-util-split-left`/`:dfu-util-split-right` を使ってください
|
||||
3. `MASTER_RIGHT` を設定します: USBポートに差し込まれた側はマスター側で右側であると決定されます(デフォルトの逆)
|
||||
3. `MASTER_RIGHT` を設定します: USB ポートに差し込まれた側はマスター側で右側であると決定されます(デフォルトの逆)
|
||||
4. デフォルト: USB ポートに差し込まれている側がマスター側であり、左側であると見なされます。スレーブ側は右側です
|
||||
|
||||
#### 左右を定義します
|
||||
|
@@ -1,8 +1,8 @@
|
||||
# 貢献方法
|
||||
|
||||
<!---
|
||||
original document: 0.8.62:docs/contributing.md
|
||||
git diff 0.8.62 HEAD -- docs/contributing.md | cat
|
||||
original document: 0.13.15:docs/contributing.md
|
||||
git diff 0.13.15 HEAD -- docs/contributing.md | cat
|
||||
-->
|
||||
|
||||
👍🎉 まず、これを読み貢献する時間を作ってくれてありがとうございます!🎉👍
|
||||
|
@@ -1,8 +1,8 @@
|
||||
# ドキュメントテンプレート
|
||||
|
||||
<!---
|
||||
original document: 0.9.19:docs/documentation_templates.md
|
||||
git diff 0.9.19 HEAD -- docs/documentation_templates.md | cat
|
||||
original document: 0.13.15:docs/documentation_templates.md
|
||||
git diff 0.13.15 HEAD -- docs/documentation_templates.md | cat
|
||||
-->
|
||||
|
||||
このページでは、新しいキーマップやキーボードを QMK に提出する際に使うべきテンプレートをまとめています。
|
||||
|
@@ -1,13 +1,100 @@
|
||||
# デバッグの FAQ
|
||||
|
||||
<!---
|
||||
original document: 0.10.33:docs/faq_debug.md
|
||||
git diff 0.10.33 HEAD -- docs/faq_debug.md | cat
|
||||
original document: 0.12.45:docs/faq_debug.md
|
||||
git diff 0.12.45 HEAD -- docs/faq_debug.md | cat
|
||||
-->
|
||||
|
||||
このページは、キーボードのトラブルシューティングについての様々な一般的な質問を説明します。
|
||||
|
||||
# デバッグコンソール
|
||||
## デバッグ :id=debugging
|
||||
|
||||
`rules.mk` へ `CONSOLE_ENABLE = yes` の設定をするとキーボードはデバッグ情報を出力します。デフォルトの出力は非常に限られたものですが、デバッグモードをオンにすることでデバッグ情報の量を増やすことが出来ます。キーマップの `DEBUG` キーコードを使用するか、デバッグモードを有効にする[コマンド](ja/feature_command.md)機能を使用するか、以下のコードをキーマップに追加します。
|
||||
|
||||
```c
|
||||
void keyboard_post_init_user(void) {
|
||||
// 希望する動作に合わせて値をカスタマイズします
|
||||
debug_enable=true;
|
||||
debug_matrix=true;
|
||||
//debug_keyboard=true;
|
||||
//debug_mouse=true;
|
||||
}
|
||||
```
|
||||
|
||||
## デバッグツール
|
||||
|
||||
キーボードのデバッグに使えるツールは2つあります。
|
||||
|
||||
### QMK Toolbox を使ったデバッグ
|
||||
|
||||
互換性のある環境では、[QMK Toolbox](https://github.com/qmk/qmk_toolbox) を使うことでキーボードからのデバッグメッセージを表示できます。
|
||||
|
||||
### hid_listen を使ったデバッグ
|
||||
|
||||
ターミナルベースの方法がお好みですか?PJRC が提供する [hid_listen](https://www.pjrc.com/teensy/hid_listen.html) もデバッグメッセージの表示に使用できます。ビルド済みの実行ファイルは Windows、Linux、MacOS 用が用意されています。
|
||||
|
||||
## 独自のデバッグメッセージを送信する
|
||||
|
||||
[カスタムコード](ja/custom_quantum_functions.md)内からデバッグメッセージを出力すると便利な場合があります。それはとても簡単です。ファイルの先頭に `print.h` のインクルードを追加します:
|
||||
|
||||
```c
|
||||
#include "print.h"
|
||||
```
|
||||
|
||||
その後は、いくつかの異なった print 関数を使用することが出来ます:
|
||||
|
||||
* `print("string")`: シンプルな文字列を出力します
|
||||
* `uprintf("%s string", var)`: フォーマットされた文字列を出力します
|
||||
* `dprint("string")` デバッグモードが有効な場合のみ、シンプルな文字列を出力します
|
||||
* `dprintf("%s string", var)`: デバッグモードが有効な場合のみ、フォーマットされた文字列を出力します
|
||||
|
||||
## デバッグの例
|
||||
|
||||
以下は現実世界での実際のデバッグ手法の例を集めたものです。
|
||||
|
||||
### マトリックス上のどの場所でキー押下が起こったか?
|
||||
|
||||
移植する場合や、PCB の問題を診断する場合、キー入力が正しくスキャンされているかどうかを確認することが役立つ場合があります。この手法でのロギングを有効化するには、`keymap.c` へ以下のコードを追加します。
|
||||
|
||||
```c
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
// コンソールが有効化されている場合、マトリックス上の位置とキー押下状態を出力します
|
||||
#ifdef CONSOLE_ENABLE
|
||||
uprintf("KL: kc: 0x%04X, col: %u, row: %u, pressed: %b, time: %u, interrupt: %b, count: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time, record->tap.interrupted, record->tap.count);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
```
|
||||
|
||||
出力例
|
||||
```text
|
||||
Waiting for device:.......
|
||||
Listening:
|
||||
KL: kc: 169, col: 0, row: 0, pressed: 1
|
||||
KL: kc: 169, col: 0, row: 0, pressed: 0
|
||||
KL: kc: 174, col: 1, row: 0, pressed: 1
|
||||
KL: kc: 174, col: 1, row: 0, pressed: 0
|
||||
KL: kc: 172, col: 2, row: 0, pressed: 1
|
||||
KL: kc: 172, col: 2, row: 0, pressed: 0
|
||||
```
|
||||
|
||||
### キースキャンにかかる時間の測定
|
||||
|
||||
パフォーマンスの問題をテストする場合、スイッチマトリックスをスキャンする頻度を知ることが役立ちます。この手法でのロギングを有効化するには `config.h` へ以下のコードを追加します。
|
||||
|
||||
```c
|
||||
#define DEBUG_MATRIX_SCAN_RATE
|
||||
```
|
||||
|
||||
出力例
|
||||
```text
|
||||
> matrix scan frequency: 315
|
||||
> matrix scan frequency: 313
|
||||
> matrix scan frequency: 316
|
||||
> matrix scan frequency: 316
|
||||
> matrix scan frequency: 316
|
||||
> matrix scan frequency: 316
|
||||
```
|
||||
|
||||
## `hid_listen` がデバイスを認識できない
|
||||
デバイスのデバッグコンソールの準備ができていない場合、以下のように表示されます:
|
||||
@@ -25,116 +112,20 @@ Listening:
|
||||
|
||||
この 'Listening:' のメッセージが表示されない場合は、[Makefile] を `CONSOLE_ENABLE=yes` に設定してビルドしてみてください
|
||||
|
||||
Linux のような OS でデバイスにアクセスするには、権限が必要かもしれません。
|
||||
- `sudo hid_listen` を試してください
|
||||
Linux のような OS でデバイスにアクセスするには、特権が必要かもしれません。`sudo hid_listen` を試してください。
|
||||
|
||||
多くの Linux ディストリビューションでは、次の内容で `/etc/udev/rules.d/70-hid-listen.rules` というファイルを作成することで、root として hid_listen を実行する必要がなくなります:
|
||||
|
||||
```
|
||||
SUBSYSTEM=="hidraw", ATTRS{idVendor}=="abcd", ATTRS{idProduct}=="def1", TAG+="uaccess", RUN{builtin}+="uaccess"
|
||||
```
|
||||
|
||||
abcd と def1 をキーボードのベンダーとプロダクト IDに置き換えてください。文字は小文字でなければなりません。`RUN{builtin}+="uaccess"` の部分は、古いディストリビューションでのみ必要です。
|
||||
|
||||
## コンソールにメッセージが表示されない
|
||||
以下を調べてください:
|
||||
- *hid_listen* がデバイスを検出する。上記を見てください。
|
||||
- **Magic**+d を使ってデバッグを有効にする。[マジックコマンド](https://github.com/tmk/tmk_keyboard#magic-commands)を見てください。
|
||||
- `debug_enable=true` を設定します。[テストとデバッグ](ja/newbs_testing_debugging.md#debugging)を見てください
|
||||
- デバッグ print の代わりに 'print' 関数を使ってみてください。**common/print.h** を見てください。
|
||||
- `debug_enable=true` を設定します。[デバッグ](#debugging)を見てください。
|
||||
- デバッグプリントの代わりに `print` 関数を使ってみてください。**common/print.h** を見てください。
|
||||
- コンソール機能を持つ他のデバイスを切断します。[Issue #97](https://github.com/tmk/tmk_keyboard/issues/97) を見てください。
|
||||
|
||||
***
|
||||
|
||||
# 雑多なこと
|
||||
## 安全性の考慮
|
||||
|
||||
あなたはおそらくキーボードを「文鎮化」したくないでしょう。文鎮化するとファームウェアを書き換えられないようになります。リスクがあまりに高い(そしてそうでないかもしれない)ものの一部のリストを示します。
|
||||
|
||||
- キーボードマップに RESET が含まれない場合、DFU モードに入るには、PCB のリセットボタンを押す必要があります。底部のネジを外す必要があります。
|
||||
- tmk_core / common にあるファイルを触るとキーボードが操作不能になるかもしれません。
|
||||
- .hex ファイルが大きすぎると問題を引き起こします; `make dfu` コマンドはブロックを削除し、
|
||||
サイズを検査し(おっと、間違った順序です!)、エラーを出力し、
|
||||
キーボードへの書き込みに失敗し、DFU モードのままになります。
|
||||
- この目的のためには、Planck の最大の .hex ファイルサイズは 7000h (10進数で28672)であることに注意してください。
|
||||
|
||||
```
|
||||
Linking: .build/planck_rev4_cbbrowne.elf [OK]
|
||||
Creating load file for Flash: .build/planck_rev4_cbbrowne.hex [OK]
|
||||
|
||||
Size after:
|
||||
text data bss dec hex filename
|
||||
0 22396 0 22396 577c planck_rev4_cbbrowne.hex
|
||||
```
|
||||
|
||||
- 上のファイルのサイズは 22396/577ch で、28672/7000h より小さいです
|
||||
- 適切な替わりの .hex ファイルがある限り、それをロードして再試行することができます
|
||||
- あなたがキーボードの Makefile で指定したかもしれない一部のオプションは、余分なメモリを消費します; BOOTMAGIC_ENABLE、MOUSEKEY_ENABLE、EXTRAKEY_ENABLE、CONSOLE_ENABLE、API_SYSEX_ENABLE に注意してください
|
||||
- DFU ツールは(オプションの余計なフルーツサラダを投げ込まない限り)ブートローダに書き込むことを許可しないので、
|
||||
ここにはリスクはほとんどありません。
|
||||
- EEPROM の書き込みサイクルは、約100000です。ファームウェアを繰り返し継続的に書き換えるべきではありません。それは最終的に EEPROM を焼き焦がします。
|
||||
|
||||
## NKRO が動作しません
|
||||
最初に、**Makefile** 内でビルドオプション `NKRO_ENABLE` を使ってファームウェアをコンパイルする必要があります。
|
||||
|
||||
**NKRO** がまだ動作しない場合は、`Magic` **N** コマンド(デフォルトでは `LShift+RShift+N`)を試してみてください。**NKRO** モードと **6KRO** モード間を一時的に切り替えるためにこのコマンドを使うことができます。**NKRO** が機能しない状況、特に BIOS の場合は **6KRO** モードに切り替える必要があります。
|
||||
|
||||
ファームウェアを `BOOTMAGIC_ENABLE` でビルドした場合、`ブートマジック` **N** コマンドで切り替える必要があります (デフォルトでは `Space+N`)。この設定は EEPROM に格納され、電源を入れ直しても保持されます。
|
||||
|
||||
https://github.com/tmk/tmk_keyboard#boot-magic-configuration---virtual-dip-switch
|
||||
|
||||
|
||||
## TrackPoint はリセット回路が必要です (PS/2 マウスサポート)
|
||||
リセット回路が無いとハードウェアの不適切な初期化のために一貫性の無い結果になります。TPM754 の回路図を見てください。
|
||||
|
||||
- https://geekhack.org/index.php?topic=50176.msg1127447#msg1127447
|
||||
- https://www.mikrocontroller.net/attachment/52583/tpm754.pdf
|
||||
|
||||
|
||||
## 16 を超えるマトリックの列を読み込めない
|
||||
列が 16 を超える場合、[matrix.h] の `read_cols()` 内の `1<<16` の代わりに `1UL<<16` を使ってください。
|
||||
|
||||
C では、AVR の場合 `1` は [16 bit] である [int] 型の1を意味し、15 を超えて左にシフトすることはできません。`1<<16` すると予期しないゼロが発生します。`1UL` として [unsigned long] 型を使う必要があります。
|
||||
|
||||
https://deskthority.net/workshop-f7/rebuilding-and-redesigning-a-classic-thinkpad-keyboard-t6181-60.html#p146279
|
||||
|
||||
## 特別なエクストラキーが動作しない (システム、オーディオコントロールキー)
|
||||
QMK でそれらを使うには、`rules.mk` 内で `EXTRAKEY_ENABLE` を定義する必要があります。
|
||||
|
||||
```
|
||||
EXTRAKEY_ENABLE = yes # オーディオ制御とシステム制御
|
||||
```
|
||||
|
||||
## スリープから復帰しない
|
||||
|
||||
Windows では、**デバイスマネージャ**の**電源の管理**タブ内の `このデバイスで、コンピュータのスタンバイ状態を解除できるようにする` 設定を調べてください。また BIOS 設定も調べてください。
|
||||
|
||||
スリープ中に任意のキーを押すとホストが起動するはずです。
|
||||
|
||||
## Arduino を使っていますか?
|
||||
|
||||
**Arduino のピンの命名は実際のチップと異なることに注意してください。** 例えば、Arduino のピン `D0` は `PD0` ではありません。回路図を自身で確認してください。
|
||||
|
||||
- https://arduino.cc/en/uploads/Main/arduino-leonardo-schematic_3b.pdf
|
||||
- https://arduino.cc/en/uploads/Main/arduino-micro-schematic.pdf
|
||||
|
||||
Arduino の Leonardo と micro には **ATMega32U4** が載っていて、TMK 用に使うことができますが、Arduino のブートローダが問題になることがあります。
|
||||
|
||||
## JTAG を有効にする
|
||||
|
||||
デフォルトでは、キーボードが起動するとすぐに JTAG デバッグインタフェースが無効になります。JTAG 対応 MCU は `JTAGEN` ヒューズが設定された状態で出荷されており、キーボードがスイッチマトリックス、LED などに使用している可能性のある MCU の特定のピンを乗っ取ります。
|
||||
|
||||
JTAG を有効にしたままにしたい場合は、単に以下のものを `config.h` に追加します:
|
||||
|
||||
```c
|
||||
#define NO_JTAG_DISABLE
|
||||
```
|
||||
|
||||
## USB 3 の互換性
|
||||
USB 3 ポートで問題がある人がいると聞きました。USB 2 ポートを試してください。
|
||||
|
||||
|
||||
## Mac の互換性
|
||||
### OS X 10.11 と Hub
|
||||
https://geekhack.org/index.php?topic=14290.msg1884034#msg1884034
|
||||
|
||||
|
||||
## リジューム (スリープとウェークアップ)/電源サイクルの問題
|
||||
一部の人がキーボードが BIOS で動作しなくなった、またはリジューム(電源サイクル)の後で動作しなくなったと報告しました。
|
||||
|
||||
今のところ、この問題の根本は明確ではないですが、幾つかのビルドオプションが関係しているようです。Makefileで、`CONSOLE_ENABLE`、`NKRO_ENABLE`、`SLEEP_LED_ENABLE` あるいは他のオプションを無効にしてみてください。
|
||||
|
||||
https://github.com/tmk/tmk_keyboard/issues/266
|
||||
https://geekhack.org/index.php?topic=41989.msg1967778#msg1967778
|
||||
|
@@ -1,8 +1,8 @@
|
||||
# よくある質問
|
||||
|
||||
<!---
|
||||
original document: 0.8.62:docs/faq_general.md
|
||||
git diff 0.8.62 HEAD -- docs/faq_general.md | cat
|
||||
original document: 0.13.17:docs/faq_general.md
|
||||
git diff 0.13.17 HEAD -- docs/faq_general.md | cat
|
||||
-->
|
||||
|
||||
## QMK とは何か?
|
||||
|
@@ -1,8 +1,8 @@
|
||||
# キーマップの FAQ
|
||||
|
||||
<!---
|
||||
original document: 0.8.62:docs/faq_keymap.md
|
||||
git diff 0.8.62 HEAD -- docs/faq_keymap.md | cat
|
||||
original document: 0.13.15:docs/faq_keymap.md
|
||||
git diff 0.13.15 HEAD -- docs/faq_keymap.md | cat
|
||||
-->
|
||||
|
||||
このページは人々がキーマップについてしばしば持つ疑問について説明します。まだ読んだことが無い場合には、[キーマップの概要](ja/keymap.md)を最初に読むべきです。
|
||||
|
107
docs/ja/faq_misc.md
Normal file
107
docs/ja/faq_misc.md
Normal file
@@ -0,0 +1,107 @@
|
||||
# その他の FAQ
|
||||
|
||||
<!---
|
||||
original document: 0.12.45:docs/faq_misc.md
|
||||
git diff 0.12.45 HEAD -- docs/faq_misc.md | cat
|
||||
-->
|
||||
|
||||
## どうやってキーボードをテストすればいいですか? :id=testing
|
||||
|
||||
通常、キーボードのテストは非常に簡単です。全てのキーをひとつずつ押して、期待するキーが送信されることを確認します。例え QMK で動作していない場合でも、[QMK Configurator](https://config.qmk.fm/#/test/) のテストモードを使用すると、キーボードをチェックできます。
|
||||
|
||||
## 安全性の考慮
|
||||
|
||||
あなたはおそらくキーボードを「文鎮化」したくないでしょう。文鎮化するとファームウェアを書き換えられないようになります。リスクがあまりに高い(そしてそうでないかもしれない)ものの一部のリストを示します。
|
||||
|
||||
- キーボードマップに RESET が含まれない場合、DFU モードに入るには、PCB のリセットボタンを押す必要があります。底部のネジを外す必要があります。
|
||||
- tmk_core / common にあるファイルを触るとキーボードが操作不能になるかもしれません。
|
||||
- .hex ファイルが大きすぎると問題を引き起こします; `make dfu` コマンドはブロックを削除し、サイズを検査し(おっと、間違った順序です!)、エラーを出力し、
|
||||
キーボードへの書き込みに失敗し、DFU モードのままになります。
|
||||
- この目的のためには、Planck の最大の .hex ファイルサイズは 7000h (10進数で28672)であることに注意してください。
|
||||
|
||||
```
|
||||
Linking: .build/planck_rev4_cbbrowne.elf [OK]
|
||||
Creating load file for Flash: .build/planck_rev4_cbbrowne.hex [OK]
|
||||
|
||||
Size after:
|
||||
text data bss dec hex filename
|
||||
0 22396 0 22396 577c planck_rev4_cbbrowne.hex
|
||||
```
|
||||
|
||||
- 上のファイルのサイズは 22396/577ch で、28672/7000h より小さいです。
|
||||
- 適切な代わりの .hex ファイルがある限り、それをロードして再試行することができます。
|
||||
- あなたがキーボードの Makefile で指定したかもしれない一部のオプションは、余分なメモリを消費します; BOOTMAGIC_ENABLE、MOUSEKEY_ENABLE、EXTRAKEY_ENABLE、CONSOLE_ENABLE、API_SYSEX_ENABLE に注意してください。
|
||||
- DFU ツールは(オプションの余計なフルーツサラダを投げ込まない限り)ブートローダに書き込むことを許可しないので、ここにはリスクはほとんどありません。
|
||||
- EEPROM の書き込みサイクルは、約100000(10万)です。ファームウェアを繰り返し継続的に書き換えるべきではありません。それは最終的に EEPROM を焼き焦がします。
|
||||
|
||||
## NKRO が動作しません
|
||||
最初に、**Makefile** 内でビルドオプション `NKRO_ENABLE` を使ってファームウェアをコンパイルする必要があります。
|
||||
|
||||
**NKRO** がまだ動作しない場合は、`Magic` **N** コマンド(デフォルトでは `LShift+RShift+N`)を試してみてください。**NKRO** モードと **6KRO** モード間を一時的に切り替えるためにこのコマンドを使うことができます。**NKRO** が機能しない状況、特に BIOS の場合は **6KRO** モードに切り替える必要があります。
|
||||
|
||||
ファームウェアを `BOOTMAGIC_ENABLE` でビルドした場合、`ブートマジック` **N** コマンドで切り替える必要があります(デフォルトでは `Space+N`)。この設定は EEPROM に格納され、電源を入れ直しても保持されます。
|
||||
|
||||
https://github.com/tmk/tmk_keyboard#boot-magic-configuration---virtual-dip-switch
|
||||
|
||||
|
||||
## トラックポイントははリセット回路が必要です (PS/2 マウスサポート)
|
||||
リセット回路が無いとハードウェアの不適切な初期化のために一貫性の無い結果になります。TPM754 の回路図を見てください:
|
||||
|
||||
- https://geekhack.org/index.php?topic=50176.msg1127447#msg1127447
|
||||
- https://www.mikrocontroller.net/attachment/52583/tpm754.pdf
|
||||
|
||||
|
||||
## 16 を超えるマトリックの列を読み込めない
|
||||
列が 16 を超える場合、[matrix.h] の `read_cols()` 内の `1<<16` の代わりに `1UL<<16` を使ってください。
|
||||
|
||||
C では、AVR の場合 `1` は [16 bit] である [int] 型の1を意味し、15を超えて左にシフトすることはできません。従って、`1<<16` を計算すると予期せずゼロになります。これを回避するには `1UL` として [unsigned long] 型を使う必要があります。
|
||||
|
||||
https://deskthority.net/workshop-f7/rebuilding-and-redesigning-a-classic-thinkpad-keyboard-t6181-60.html#p146279
|
||||
|
||||
## 特別なエクストラキーが動作しない(システム、オーディオコントロールキー)
|
||||
QMK でそれらを使うには、`rules.mk` 内で `EXTRAKEY_ENABLE` を定義する必要があります。
|
||||
|
||||
```
|
||||
EXTRAKEY_ENABLE = yes # オーディオ制御とシステム制御
|
||||
```
|
||||
|
||||
## スリープから復帰しない
|
||||
|
||||
**デバイスマネージャ**の**電源の管理**タブ内の `このデバイスで、コンピュータのスタンバイ状態を解除できるようにする` 設定を調べてください。また BIOS 設定も調べてください。スリープ中に任意のキーを押すとホストが起動するはずです。
|
||||
|
||||
## Arduino を使っていますか?
|
||||
|
||||
**Arduino のピンの命名は実際のチップと異なることに注意してください。** 例えば、Arduino のピン `D0` は `PD0` ではありません。回路図を自身で確認してください。
|
||||
|
||||
- https://arduino.cc/en/uploads/Main/arduino-leonardo-schematic_3b.pdf
|
||||
- https://arduino.cc/en/uploads/Main/arduino-micro-schematic.pdf
|
||||
|
||||
Arduino の Leonardo と micro には **ATMega32U4** が載っていて、TMK 用に使うことができますが、Arduino のブートローダが問題になることがあります。
|
||||
|
||||
## JTAG を有効にする
|
||||
|
||||
デフォルトでは、キーボードが起動するとすぐに JTAG デバッグインタフェースが無効になります。JTAG 対応 MCU は `JTAGEN` ヒューズが設定された状態で出荷されており、キーボードがスイッチマトリックス、LED などに使用している可能性のある MCU の特定のピンを乗っ取ります。
|
||||
|
||||
JTAG を有効にしたままにしたい場合は、単に以下のものを `config.h` に追加します:
|
||||
|
||||
```c
|
||||
#define NO_JTAG_DISABLE
|
||||
```
|
||||
|
||||
## USB 3 の互換性
|
||||
一部の問題は、USB 3.x ポートから USB 2.0 ポートに切り替えることで修正できます。
|
||||
|
||||
|
||||
## Mac の互換性
|
||||
### OS X 10.11 と Hub
|
||||
こちらを見てください: https://geekhack.org/index.php?topic=14290.msg1884034#msg1884034
|
||||
|
||||
|
||||
## BIOS (UEFI) 設定/リジューム (スリープとウェークアップ)/電源サイクルの問題
|
||||
一部の人がキーボードが BIOS で動作しなくなった、またはリジューム(電源サイクル)の後で動作しなくなったと報告しました。
|
||||
|
||||
今のところ、この問題の根本は明確ではないですが、幾つかのビルドオプションが関係しているようです。Makefile で、`CONSOLE_ENABLE`、`NKRO_ENABLE`、`SLEEP_LED_ENABLE` あるいは他のオプションを無効にしてみてください。
|
||||
|
||||
より詳しい情報:
|
||||
- https://github.com/tmk/tmk_keyboard/issues/266
|
||||
- https://geekhack.org/index.php?topic=41989.msg1967778#msg1967778
|
@@ -1,30 +1,166 @@
|
||||
# 修飾キー :id=modifier-keys
|
||||
|
||||
<!---
|
||||
original document: 0.9.0:docs/feature_advanced_keycodes.md
|
||||
git diff 0.9.0 HEAD -- docs/feature_advanced_keycodes.md | cat
|
||||
original document: 0.12.29:docs/feature_advanced_keycodes.md
|
||||
git diff 0.12.29 HEAD -- docs/feature_advanced_keycodes.md | cat
|
||||
-->
|
||||
|
||||
以下のようにキーコードとモディファイアを組み合わせることができます。押すと、モディファイアのキーダウンイベントが送信され、次に `kc` のキーダウンイベントが送信されます。放すと、`kc` のキーアップイベントが送信され、次にモディファイアのキーアップイベントが送信されます。
|
||||
|
||||
| キー | エイリアス | 説明 |
|
||||
|----------|-------------------------------|----------------------------------------------------|
|
||||
| `LCTL(kc)` | `C(kc)` | 左 Control を押しながら `kc` を押します。 |
|
||||
| `LSFT(kc)` | `S(kc)` | 左 Shift を押しながら `kc` を押します。 |
|
||||
| `LALT(kc)` | `A(kc)`, `LOPT(kc)` | 左 Alt を押しながら `kc`を押します。 |
|
||||
| `LGUI(kc)` | `G(kc)`, `LCMD(kc)`, `LWIN(kc)` | 左 GUI を押しながら `kc` を押します。 |
|
||||
| `RCTL(kc)` | | 右 Control を押しながら `kc` を押します。 |
|
||||
| `RSFT(kc)` | | 右 Shift を押しながら `kc` を押します。 |
|
||||
| `RALT(kc)` | `ROPT(kc)`, `ALGR(kc)` | 右 Alt を押しながら `kc` を押します。 |
|
||||
| `RGUI(kc)` | `RCMD(kc)`, `LWIN(kc)` | 右 GUI を押しながら `kc` を押します。 |
|
||||
| `SGUI(kc)` | `SCMD(kc)`, `SWIN(kc)` | 左 Shift と左 GUI を押しながら `kc` を押します。 |
|
||||
| `LCA(kc)` | | 左 Control と左 Alt を押しながら `kc` を押します。 |
|
||||
| `LCAG(kc)` | | 左 Control、左 Alt、左 GUI を押しながら `kc` を押します。 |
|
||||
| `MEH(kc)` | | 左 Control、左 Shift、左 Alt を押しながら `kc` を押します。 |
|
||||
| `HYPR(kc)` | | 左 Control、左 Shift、左 Alt、左 GUI を押しながら `kc` を押します。 |
|
||||
| キー | エイリアス | 説明 |
|
||||
| ---------- | ------------------------------- | ------------------------------------------------------------------- |
|
||||
| `LCTL(kc)` | `C(kc)` | 左 Control を押しながら `kc` を押します。 |
|
||||
| `LSFT(kc)` | `S(kc)` | 左 Shift を押しながら `kc` を押します。 |
|
||||
| `LALT(kc)` | `A(kc)`, `LOPT(kc)` | 左 Alt を押しながら `kc`を押します。 |
|
||||
| `LGUI(kc)` | `G(kc)`, `LCMD(kc)`, `LWIN(kc)` | 左 GUI を押しながら `kc` を押します。 |
|
||||
| `RCTL(kc)` | | 右 Control を押しながら `kc` を押します。 |
|
||||
| `RSFT(kc)` | | 右 Shift を押しながら `kc` を押します。 |
|
||||
| `RALT(kc)` | `ROPT(kc)`, `ALGR(kc)` | 右 Alt を押しながら `kc` を押します。 |
|
||||
| `RGUI(kc)` | `RCMD(kc)`, `LWIN(kc)` | 右 GUI を押しながら `kc` を押します。 |
|
||||
| `SGUI(kc)` | `SCMD(kc)`, `SWIN(kc)` | 左 Shift と左 GUI を押しながら `kc` を押します。 |
|
||||
| `LCA(kc)` | | 左 Control と左 Alt を押しながら `kc` を押します。 |
|
||||
| `LSA(kc)` | | 左 Shift と左 Alt を押しながら `kc` を押します。 |
|
||||
| `RSA(kc)` | `SAGR(kc)` | 右 Shift と右 Alt (AltGr) を押しながら `kc` を押します。 |
|
||||
| `RCS(kc)` | | 右 Control と右 Shift を押しながら `kc` を押します。 |
|
||||
| `LCAG(kc)` | | 左 Control、左 Alt、左 GUI を押しながら `kc` を押します。 |
|
||||
| `MEH(kc)` | | 左 Control、左 Shift、左 Alt を押しながら `kc` を押します。 |
|
||||
| `HYPR(kc)` | | 左 Control、左 Shift、左 Alt、左 GUI を押しながら `kc` を押します。 |
|
||||
|
||||
また、それらを繋げることができます。例えば、`LCTL(LALT(KC_DEL))` または `C(A(KC_DEL))` は1回のキー押下で Control+Alt+Delete を送信するキーを作成します。
|
||||
|
||||
# モディファイアの状態を確認 :id=checking-modifier-state
|
||||
|
||||
|
||||
現在のモディファイアの状態は、2つの関数によって主にアクセスされます。: `get_mods()` 関数は通常のモディファイアとモッドタップの状態を、`get_oneshot_mods()` 関数はワンショットモディファイアの状態を確認する関数です。(ワンショットモディファイアはキーが押されていない限り、通常のモディファイアキーのように動作します。)
|
||||
|
||||
1つ以上の特定のモディファイアが現在のモディファイアの状態に含まれているかどうかは、モディファイアの状態と、照合したいモディファイアの組み合わせに相当するモッドマスクとを AND 演算することで検出できます。
|
||||
ビット演算が使われる理由は、モディファイアの状態が (GASC)<sub>R</sub>(GASC)<sub>L</sub> の形式で1バイトとして格納されるためです。
|
||||
|
||||
従って、例を挙げると、`01000010` は LShift+RALT の内部表現です。
|
||||
C 言語におけるビット演算のより詳しい情報は、[ここ](https://en.wikipedia.org/wiki/Bitwise_operations_in_C) をクリックして、Wikipedia のページのトピックを開いてください。
|
||||
|
||||
実際には、`get_mods() & MOD_BIT(KC_<modifier>)`([モディファイアキーコードのリスト](ja/keycodes_basic.md#modifiers) 参照) で、あるモディファイアが有効かどうかをチェックできるということです、また左右のモディファイアの違いが重要ではなく、両方にマッチさせたい場合は、`get_mods() & MOD_MASK_<modifier>`とします。ワンショットモディファイアについても、`get_mods()` を `get_oneshot_mods()` に置き換えれば同じことができます。
|
||||
|
||||
モディファイアの特定の組み合わせが同時にアクティブなのか確認する*だけ*なら、上で説明したモディファイアの状態とモッドマスクの論理積と、モッドマスク自身の結果を比較します。: `get_mods() & <mod mask> == <mod mask>`
|
||||
|
||||
例えば、左 Control キーと 左 Shift キーのワンショットモディファイアがオンで、その他のワンショットモディファイアがオフの場合にカスタムコードを起動したいとしましょう。そうするには、`(MOD_BIT(KC_LCTL) | MOD_BIT(KC_LSFT))` で左 Control キーと Shift キーのモッドビットを組み合わせて目的のモッドマスクを構成し、それらを差し込みます: `get_oneshot_mods & (MOD_BIT(KC_LCTL) | MOD_BIT(KC_LSFT)) == (MOD_BIT(KC_LCTL) | MOD_BIT(KC_LSFT))`。モッドビットマスクの代わりに `MOD_MASK_CS` 使うと、条件を満たすために4つのモディファイアキー (左右両方の Control キーと Shift キー) を押す必要があります。
|
||||
|
||||
モッドマスクの完全なリストは、以下のとおりです。
|
||||
|
||||
| モッドマスク名 | マッチするモディファイア |
|
||||
|--------------------|-------------------------------------------------------------|
|
||||
| `MOD_MASK_CTRL` | 左 Control , 右 Control |
|
||||
| `MOD_MASK_SHIFT` | 左 Shift , 右 Shift |
|
||||
| `MOD_MASK_ALT` | 左 Alt , 右 Alt |
|
||||
| `MOD_MASK_GUI` | 左 GUI , 右 GUI |
|
||||
| `MOD_MASK_CS` | Control , Shift |
|
||||
| `MOD_MASK_CA` | (左/右) Control , (左/右) Alt |
|
||||
| `MOD_MASK_CG` | (左/右) Control , (左/右) GUI |
|
||||
| `MOD_MASK_SA` | (左/右) Shift , (左/右) Alt |
|
||||
| `MOD_MASK_SG` | (左/右) Shift , (左/右) GUI |
|
||||
| `MOD_MASK_AG` | (左/右) Alt , (左/右) GUI |
|
||||
| `MOD_MASK_CSA` | (左/右) Control , (左/右) Shift , (左/右) Alt |
|
||||
| `MOD_MASK_CSG` | (左/右) Control , (左/右) Shift , (左/右) GUI |
|
||||
| `MOD_MASK_CAG` | (左/右) Control , (左/右) Alt , (左/右) GUI |
|
||||
| `MOD_MASK_SAG` | (左/右) Shift , (左/右) Alt , (左/右) GUI |
|
||||
| `MOD_MASK_CSAG` | (左/右) Control , (左/右) Shift , (左/右) Alt , (左/右) GUI |
|
||||
|
||||
`get_mods()` 関数を使って現在アクティブなモディファイアにアクセスする以外に、モディファイアの状態を変更するために使えるいくつかの関数があります。ここでは、`mods` 引数はモディファイアビットマスクを表します。
|
||||
|
||||
* `add_mods(mods)`: その他のモディファイアに影響を与えずに `mods` を有効にします。
|
||||
* `register_mods(mods)`: `add_mods` に似ていますが、キーボードにすぐにレポートを送信します。
|
||||
* `del_mods(mods)`: その他のモディファイアに影響を与えずに `mods` を無効にします。
|
||||
* `unregister_mods(mods)`: `del_mods` に似ていますが、キーボードにすぐにレポートを送信します。
|
||||
* `set_mods(mods)`: `mods` で現在のモディファイアの状態を上書きします
|
||||
* `clear_mods()`: 全てのモディファイアを無効にすることによって、モディファイアの状態をリセットします。
|
||||
|
||||
同様に、`get_oneshot_mods()` 関数に加えて、ワンショットモディファイアのための関数もあります。
|
||||
|
||||
* `add_oneshot_mods(mods)`: その他のワンショットモディファイアに影響を与えずに `mods` を有効にします
|
||||
* `del_oneshot_mods(mods)`: その他のワンショットモディファイアに影響を与えずに `mods` を無効にします
|
||||
* `set_oneshot_mods(mods)`: `mods` で現在のワンショットモディファイアの状態を上書きします
|
||||
* `clear_oneshot_mods()`: 全てのワンショットモディファイアを無効にすることによって、ワンショットモディファイアの状態をリセットします。
|
||||
|
||||
## 例 :id=examples
|
||||
|
||||
次の例は、[マクロについてのページ](ja/feature_macros.md) で読める [高度なマクロ](ja/feature_macros.md?id=advanced-macro-functions) を使っています。
|
||||
### Alt + Tab の代わりの Alt + Escape :id=alt-escape-for-alt-tab
|
||||
|
||||
左 Alt と `KC_ESC` が押されたときに、アプリ切り替えの(左 Alt と) `KC_TAB` のように振る舞うことを実現する単純な例です。この例は、左 Alt だけがアクティブになっているかを厳格に確認します。つまり、Alt+Shift+Esc によるアプリの逆順での切り替えはできません。また、この例は、実際の Alt+Escape キーボードショートカットを起動することはできなくなりますが、AltGr+Escape キーボードショートカットを起動することはできることに留意してください。
|
||||
|
||||
```c
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
|
||||
case KC_ESC:
|
||||
// 左 Alt だけがアクティブか検知します
|
||||
if ((get_mods() & MOD_BIT(KC_LALT)) == MOD_BIT(KC_LALT)) {
|
||||
if (record->event.pressed) {
|
||||
// KC_LALT を登録する必要はありません。既にアクティブだからです。
|
||||
// Alt モディファイアはこの KC_TAB に適用されます。
|
||||
register_code(KC_TAB);
|
||||
} else {
|
||||
unregister_code(KC_TAB);
|
||||
}
|
||||
// QMK にこれ以上キーコードの処理をさせません。
|
||||
return false;
|
||||
}
|
||||
// それ以外の場合は、QMK に通常通り KC_ESC の処理をさせます。
|
||||
return true;
|
||||
|
||||
}
|
||||
return true;
|
||||
};
|
||||
```
|
||||
|
||||
### Delete の代わりの Shift + Backspace :id=shift-backspace-for-delete
|
||||
|
||||
`KC_BSPC` と組み合わせることで Shift の本来の動作が取り消され、そして、`KC_DEL` に完全に置き換えられる高度な例です。この例を適切に動作させるために2つのメイン変数が作られます。: `mod_state` と `delkey_registered` です。最初の1つ目の変数は、モディファイアの状態を記憶し、`KC_DEL` を登録した後に元に戻すために使われます。2つ目の変数はブール型変数 (true または false) で、`KC_DEL` の状態を追跡して Backspace/Delete キー全体のリリースを正確に管理します。
|
||||
|
||||
前の例と対照的に、この例は厳格なモディファイアの確認を行いません。このカスタムコードを起動するには、1つまたは2つの Shift キーがアクティブな間に `KC_BSPC` を押せば十分で、他のモディファイアの状態は関係ありません。この方法は、いくつかの特典を提供します。: Ctrl+Shift+Backspace は次の単語を削除 (Control+Delete) し、Ctrl+Alt+Shift+Backspace は Ctrl+Alt+Del キーボードショートカットを実行します。
|
||||
|
||||
```c
|
||||
// アクティブなモディファイアを表すバイナリデータを保持する変数を初期化します
|
||||
uint8_t mod_state;
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
// 後々の参照のために現在のモディファイアの状態を変数に格納します
|
||||
mod_state = get_mods();
|
||||
switch (keycode) {
|
||||
|
||||
case KC_BSPC:
|
||||
{
|
||||
// Delete キーの状態(登録されているかどうか)を追跡するブール型変数を初期化します。
|
||||
static bool delkey_registered;
|
||||
if (record->event.pressed) {
|
||||
// いずれかの Shift がアクティブか検知します
|
||||
if (mod_state & MOD_MASK_SHIFT) {
|
||||
// 最初に、 Shift キーを KC_DEL に適用しないため、
|
||||
// 一時的に左右両方の Shift キーをキャンセルします
|
||||
del_mods(MOD_MASK_SHIFT);
|
||||
register_code(KC_DEL);
|
||||
// KC_DEL の状態を反映させるためにブール型変数を更新します
|
||||
delkey_registered = true;
|
||||
// Backspace/Delete キーをタップした後でも押し続けている Shift キーが機能するように、
|
||||
// モディファイアの状態を再適用します。
|
||||
set_mods(mod_state);
|
||||
return false;
|
||||
}
|
||||
} else { // KC_BSPC キーを離した場合
|
||||
// KC_BSPC を離しても KC_DEL が送信されている場合
|
||||
if (delkey_registered) {
|
||||
unregister_code(KC_DEL);
|
||||
delkey_registered = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// QMK に Shift キーを除いて KC_BSPC を通常通り処理させます
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
};
|
||||
```
|
||||
# 過去の内容 :id=legacy-content
|
||||
|
||||
このページには多くの機能が含まれていました。このページを構成していた多くのセクションをそれぞれのページに移動しました。これより下は全て単なるリダイレクトであるため、web上で古いリンクをたどっている人は探しているものを見つけることができます。
|
||||
|
@@ -210,7 +210,7 @@ SEND_STRING(".."SS_TAP(X_END));
|
||||
```
|
||||
|
||||
|
||||
## 高度なマクロ関数
|
||||
## 高度なマクロ関数 :id=advanced-macro-functions
|
||||
|
||||
マクロの生成に役立つ関数が幾つかあります。マクロの中にかなり高度なコードを書くことができますが、機能が複雑になりすぎる場合は、代わりにカスタムキーコードを定義することをお勧めします。マクロはシンプルにしなければなりません。
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
# PS/2 マウスサポート :id=ps2-mouse-support
|
||||
|
||||
<!---
|
||||
original document: 0.9.44:docs/feature_ps2_mouse.md
|
||||
git diff 0.9.44 HEAD -- docs/feature_ps2_mouse.md | cat
|
||||
original document: 0.13.17:docs/feature_ps2_mouse.md
|
||||
git diff 0.13.17 HEAD -- docs/feature_ps2_mouse.md | cat
|
||||
-->
|
||||
|
||||
PS/2 マウス (例えばタッチパッドあるいはトラックポイント)を複合デバイスとしてキーボードに接続することができます。
|
||||
@@ -210,7 +210,7 @@ void ps2_mouse_set_sample_rate(ps2_mouse_sample_rate_t sample_rate);
|
||||
この機能を有効にするには、以下のようにスクロールボタンマスクを設定する必要があります:
|
||||
|
||||
```c
|
||||
#define PS2_MOUSE_SCROLL_BTN_MASK (1<<PS2_MOUSE_BUTTON_MIDDLE) /* Default */
|
||||
#define PS2_MOUSE_SCROLL_BTN_MASK (1<<PS2_MOUSE_BTN_MIDDLE) /* Default */
|
||||
```
|
||||
|
||||
スクロールボタン機能を無効にするには:
|
||||
|
@@ -1,8 +1,8 @@
|
||||
# QMK での速記 :id=stenography-in-qmk
|
||||
|
||||
<!---
|
||||
original document: 0.10.33:docs/feature_stenography.md
|
||||
git diff 0.10.33 HEAD -- docs/feature_stenography.md | cat
|
||||
original document: 0.13.15:docs/feature_stenography.md
|
||||
git diff 0.13.15 HEAD -- docs/feature_stenography.md | cat
|
||||
-->
|
||||
|
||||
[速記](https://en.wikipedia.org/wiki/Stenotype)は裁判所のレポート、字幕および耳が不自由な人のためのリアルタイムの文字起こしで最もよく使われる記述方法です。速記では単語はスペル、音声およびショートカット(短い)ストロークが混在する音節ごとに音節化されます。プロの速記者は、標準的なタイピングで通常見られる負担を掛けずに、はるかに少ないエラー(99.9%より高い精度)で、200-300 WPM に到達できます。
|
||||
|
@@ -1,8 +1,8 @@
|
||||
# スワップハンドアクション
|
||||
|
||||
<!---
|
||||
original document: 0.8.177:docs/feature_swap_hands.md
|
||||
git diff 0.8.177 HEAD -- docs/feature_swap_hands.md | cat
|
||||
original document: 0.13.17:docs/feature_swap_hands.md
|
||||
git diff 0.13.17 HEAD -- docs/feature_swap_hands.md | cat
|
||||
-->
|
||||
|
||||
スワップハンドアクションにより、別のレイヤーを必要とせずに片手入力をサポートします。Makefile に `SWAP_HANDS_ENABLE` を設定し、キーマップに `hand_swap_config` エントリを定義します。これで `ACTION_SWAP_HANDS` コマンドキーが押されるたびにキーボードがミラーされます。例えば、QWERTY で "Hello, World" を入力するには、`^Ge^s^s^w^c W^wr^sd` を入力します。
|
||||
|
@@ -1,8 +1,8 @@
|
||||
# ユーザスペース: キーマップ間でのコードの共有
|
||||
|
||||
<!---
|
||||
original document: 0.9.43:docs/feature_userspace.md
|
||||
git diff 0.9.43 HEAD -- docs/feature_userspace.md | cat
|
||||
original document: 0.13.17:docs/feature_userspace.md
|
||||
git diff 0.13.17 HEAD -- docs/feature_userspace.md | cat
|
||||
-->
|
||||
|
||||
似たキーマップを複数のキーボードで使う場合、それらの間でコードを共有できるという利点が得られることがあります。`users/`に以下の構造でキーマップ(理想的には GitHub のユーザ名、`<name>`)と同じ名前の独自のフォルダを作成します:
|
||||
|
@@ -1,8 +1,8 @@
|
||||
# キーボードマトリックスの仕組み
|
||||
|
||||
<!---
|
||||
original document: 0.9.32:docs/how_a_matrix_works.md
|
||||
git diff 0.9.32 HEAD -- docs/how_a_matrix_works.md | cat
|
||||
original document: 0.13.15:docs/how_a_matrix_works.md
|
||||
git diff 0.13.15 HEAD -- docs/how_a_matrix_works.md | cat
|
||||
-->
|
||||
|
||||
キーボードスイッチのマトリックスは行と列に配置されます。マトリックス回路がなければ、各スイッチはコントローラに直接配線する必要があります。
|
||||
|
@@ -1,8 +1,8 @@
|
||||
# GPIO 制御 :id=gpio-control
|
||||
|
||||
<!---
|
||||
original document: 0.9.34:docs/internals_gpio_control.md
|
||||
git diff 0.9.34 HEAD -- docs/internals_gpio_control.md | cat
|
||||
original document: 0.13.15:docs/internals_gpio_control.md
|
||||
git diff 0.13.15 HEAD -- docs/internals_gpio_control.md | cat
|
||||
-->
|
||||
|
||||
QMK には、マイクロコントローラに依存しない GPIO 制御抽象レイヤーがあります。これは異なるプラットフォーム間でピン制御に簡単にアクセスできるようにするためのものです。
|
||||
@@ -26,3 +26,22 @@ QMK には、マイクロコントローラに依存しない GPIO 制御抽象
|
||||
## 高度な設定 :id=advanced-settings
|
||||
|
||||
各マイクロコントローラは GPIO に関して複数の高度な設定を持つことができます。この抽象レイヤーは、アーキテクチャー固有の機能の使用法を制限しません。上級ユーザは、目的のデバイスのデータシートを参照し、必要なライブラリを含めてください。AVR については、標準 avr/io.h ライブラリが使われます; STM32 については ChibiOS [PAL ライブラリ](https://chibios.sourceforge.net/docs3/hal/group___p_a_l.html)が使われます。
|
||||
|
||||
## アトミック操作 :id=atomic-operation
|
||||
|
||||
上記の関数は、必ずしもアトミックに動作することが保証されているわけではありません。そのため、上記の関数を複数組み合わせて使用する際に、操作の途中での割り込みを防ぎたい場合は、以下の `ATOMIC_BLOCK_FORCEON` マクロを使用してください。
|
||||
|
||||
例:
|
||||
```c
|
||||
void some_function() {
|
||||
// 通常の処理
|
||||
ATOMIC_BLOCK_FORCEON {
|
||||
// アトミックであることが必要な処理
|
||||
}
|
||||
// 通常の処理
|
||||
}
|
||||
```
|
||||
|
||||
`ATOMIC_BLOCK_FORCEON` は、ブロックが実行される前に、割り込みが有効か無効かに関わらず、強制的に割り込みを無効にします。そして、ブロックが実行された後に、割り込みを有効にします。
|
||||
|
||||
したがって、`ATOMIC_BLOCK_FORCEON`は、ブロックの実行前に割り込みが有効になっていることがわかっている場合や、ブロックの完了時に割り込みを有効にしても問題ないことがわかっている場合のみ使用できることに注意してください。
|
||||
|
261
docs/ja/keycodes_basic.md
Normal file
261
docs/ja/keycodes_basic.md
Normal file
@@ -0,0 +1,261 @@
|
||||
# 基本的なキーコード
|
||||
|
||||
<!---
|
||||
original document: 0.11.25:docs/keycodes_basic.md
|
||||
git diff 0.11.25 HEAD -- docs/keycodes_basic.md | cat
|
||||
-->
|
||||
|
||||
基本的なキーコードのセットは、`KC_NO`、`KC_TRNS` と `0xA5-DF` の範囲のキーコードを除いて、[HID Keyboard/Keypad Usage Page (0x07)](https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf) に基づいています。
|
||||
|
||||
## 文字と数字
|
||||
|
||||
|キー |説明 |
|
||||
|------|----------|
|
||||
|`KC_A`|`a` と `A`|
|
||||
|`KC_B`|`b` と `B`|
|
||||
|`KC_C`|`c` と `C`|
|
||||
|`KC_D`|`d` と `D`|
|
||||
|`KC_E`|`e` と `E`|
|
||||
|`KC_F`|`f` と `F`|
|
||||
|`KC_G`|`g` と `G`|
|
||||
|`KC_H`|`h` と `H`|
|
||||
|`KC_I`|`i` と `I`|
|
||||
|`KC_J`|`j` と `J`|
|
||||
|`KC_K`|`k` と `K`|
|
||||
|`KC_L`|`l` と `L`|
|
||||
|`KC_M`|`m` と `M`|
|
||||
|`KC_N`|`n` と `N`|
|
||||
|`KC_O`|`o` と `O`|
|
||||
|`KC_P`|`p` と `P`|
|
||||
|`KC_Q`|`q` と `Q`|
|
||||
|`KC_R`|`r` と `R`|
|
||||
|`KC_S`|`s` と `S`|
|
||||
|`KC_T`|`t` と `T`|
|
||||
|`KC_U`|`u` と `U`|
|
||||
|`KC_V`|`v` と `V`|
|
||||
|`KC_W`|`w` と `W`|
|
||||
|`KC_X`|`x` と `X`|
|
||||
|`KC_Y`|`y` と `Y`|
|
||||
|`KC_Z`|`z` と `Z`|
|
||||
|`KC_1`|`1` と `!`|
|
||||
|`KC_2`|`2` と `@`|
|
||||
|`KC_3`|`3` と `#`|
|
||||
|`KC_4`|`4` と `$`|
|
||||
|`KC_5`|`5` と `%`|
|
||||
|`KC_6`|`6` と `^`|
|
||||
|`KC_7`|`7` と `&`|
|
||||
|`KC_8`|`8` と `*`|
|
||||
|`KC_9`|`9` と `(`|
|
||||
|`KC_0`|`0` と `)`|
|
||||
|
||||
## ファンクションキー
|
||||
|
||||
|キー |説明 |
|
||||
|--------|-----|
|
||||
|`KC_F1` |F1 |
|
||||
|`KC_F2` |F2 |
|
||||
|`KC_F3` |F3 |
|
||||
|`KC_F4` |F4 |
|
||||
|`KC_F5` |F5 |
|
||||
|`KC_F6` |F6 |
|
||||
|`KC_F7` |F7 |
|
||||
|`KC_F8` |F8 |
|
||||
|`KC_F9` |F9 |
|
||||
|`KC_F10`|F10 |
|
||||
|`KC_F11`|F11 |
|
||||
|`KC_F12`|F12 |
|
||||
|`KC_F13`|F13 |
|
||||
|`KC_F14`|F14 |
|
||||
|`KC_F15`|F15 |
|
||||
|`KC_F16`|F16 |
|
||||
|`KC_F17`|F17 |
|
||||
|`KC_F18`|F18 |
|
||||
|`KC_F19`|F19 |
|
||||
|`KC_F20`|F20 |
|
||||
|`KC_F21`|F21 |
|
||||
|`KC_F22`|F22 |
|
||||
|`KC_F23`|F23 |
|
||||
|`KC_F24`|F24 |
|
||||
|
||||
## パンクチュエーション
|
||||
|
||||
|キー |エイリアス |説明 |
|
||||
|-----------------|-------------------|----------------------------------------------|
|
||||
|`KC_ENTER` |`KC_ENT` |Return (Enter) |
|
||||
|`KC_ESCAPE` |`KC_ESC` |Escape |
|
||||
|`KC_BSPACE` |`KC_BSPC` |Delete (Backspace) |
|
||||
|`KC_TAB` | |Tab |
|
||||
|`KC_SPACE` |`KC_SPC` |Spacebar |
|
||||
|`KC_MINUS` |`KC_MINS` |`-` と `_` |
|
||||
|`KC_EQUAL` |`KC_EQL` |`=` と `+` |
|
||||
|`KC_LBRACKET` |`KC_LBRC` |`[` と `{` |
|
||||
|`KC_RBRACKET` |`KC_RBRC` |`]` と `}` |
|
||||
|`KC_BSLASH` |`KC_BSLS` |`\` と `\|` |
|
||||
|`KC_NONUS_HASH` |`KC_NUHS` |Non-US `#` と `~` |
|
||||
|`KC_SCOLON` |`KC_SCLN` |`;` と `:` |
|
||||
|`KC_QUOTE` |`KC_QUOT` |`'` と `"` |
|
||||
|`KC_GRAVE` |`KC_GRV`, `KC_ZKHK`|<code>`</code> と `~`, JIS 全角/半角 |
|
||||
|`KC_COMMA` |`KC_COMM` |`,` と `<` |
|
||||
|`KC_DOT` | |`.` と `>` |
|
||||
|`KC_SLASH` |`KC_SLSH` |`/` と `?` |
|
||||
|`KC_NONUS_BSLASH`|`KC_NUBS` |Non-US `\` と `\|` |
|
||||
|
||||
## ロックキー
|
||||
|
||||
|キー |エイリアス |説明 |
|
||||
|-------------------|--------------------|---------------------------------------|
|
||||
|`KC_CAPSLOCK` |`KC_CLCK`, `KC_CAPS`|Caps Lock |
|
||||
|`KC_SCROLLLOCK` |`KC_SLCK`, `KC_BRMD`|Scroll Lock, 画面の明るさダウン (macOS)|
|
||||
|`KC_NUMLOCK` |`KC_NLCK` |テンキー Num Lock と Clear |
|
||||
|`KC_LOCKING_CAPS` |`KC_LCAP` |Caps Lock のロック |
|
||||
|`KC_LOCKING_NUM` |`KC_LNUM` |Num Lock のロック |
|
||||
|`KC_LOCKING_SCROLL`|`KC_LSCR` |Scroll Lock のロック |
|
||||
|
||||
## 修飾キー
|
||||
|
||||
|キー |エイリアス |説明 |
|
||||
|-----------|--------------------|---------------------------------|
|
||||
|`KC_LCTRL` |`KC_LCTL` |左 Control |
|
||||
|`KC_LSHIFT`|`KC_LSFT` |左 Shift |
|
||||
|`KC_LALT` |`KC_LOPT` |左 Alt (Option) |
|
||||
|`KC_LGUI` |`KC_LCMD`, `KC_LWIN`|左 GUI (Windows/Command/Meta キー)|
|
||||
|`KC_RCTRL` |`KC_RCTL` |右 Control |
|
||||
|`KC_RSHIFT`|`KC_RSFT` |右 Shift |
|
||||
|`KC_RALT` |`KC_ROPT`, `KC_ALGR`|右 Alt (Option/AltGr) |
|
||||
|`KC_RGUI` |`KC_RCMD`, `KC_RWIN`|右 GUI (Windows/Command/Meta キー)|
|
||||
|
||||
## 国際化対応キー
|
||||
|
||||
|キー |エイリアス|説明 |
|
||||
|----------|----------|---------------------|
|
||||
|`KC_INT1` |`KC_RO` |JIS `\` と ` _` |
|
||||
|`KC_INT2` |`KC_KANA` |JIS カタカナ/ひらがな|
|
||||
|`KC_INT3` |`KC_JYEN` |JIS `¥` と `\ |` |
|
||||
|`KC_INT4` |`KC_HENK` |JIS 変換 |
|
||||
|`KC_INT5` |`KC_MHEN` |JIS 無変換 |
|
||||
|`KC_INT6` | |JIS テンキー `,` |
|
||||
|`KC_INT7` | |International 7 |
|
||||
|`KC_INT8` | |International 8 |
|
||||
|`KC_INT9` | |International 9 |
|
||||
|`KC_LANG1`|`KC_HAEN` |ハングル/英語 |
|
||||
|`KC_LANG2`|`KC_HANJ` |韓文漢字 |
|
||||
|`KC_LANG3`| |JIS カタカナ |
|
||||
|`KC_LANG4`| |JIS ひらがな |
|
||||
|`KC_LANG5`| |JIS 全角/半角 |
|
||||
|`KC_LANG6`| |Language 6 |
|
||||
|`KC_LANG7`| |Language 7 |
|
||||
|`KC_LANG8`| |Language 8 |
|
||||
|`KC_LANG9`| |Language 9 |
|
||||
|
||||
## コマンドキー
|
||||
|
||||
|キー |エイリアス |説明 |
|
||||
|------------------|------------------------------|-------------------------------------------------------|
|
||||
|`KC_PSCREEN` |`KC_PSCR` |Print Screen |
|
||||
|`KC_PAUSE` |`KC_PAUS`, `KC_BRK`, `KC_BRMU`|Pause, 画面の明るさアップ (macOS) |
|
||||
|`KC_INSERT` |`KC_INS` |Insert |
|
||||
|`KC_HOME` | |Home |
|
||||
|`KC_PGUP` | |Page Up |
|
||||
|`KC_DELETE` |`KC_DEL` |Forward Delete |
|
||||
|`KC_END` | |End |
|
||||
|`KC_PGDOWN` |`KC_PGDN` |Page Down |
|
||||
|`KC_RIGHT` |`KC_RGHT` |右矢印 |
|
||||
|`KC_LEFT` | |左矢印 |
|
||||
|`KC_DOWN` | |下矢印 |
|
||||
|`KC_UP` | |上矢印 |
|
||||
|`KC_APPLICATION` |`KC_APP` |アプリケーションキー (Windows コンテキストメニューキー)|
|
||||
|`KC_POWER` | |システム電源 |
|
||||
|`KC_EXECUTE` |`KC_EXEC` |Execute |
|
||||
|`KC_HELP` | |Help |
|
||||
|`KC_MENU` | |Menu |
|
||||
|`KC_SELECT` |`KC_SLCT` |Select |
|
||||
|`KC_STOP` | |Stop |
|
||||
|`KC_AGAIN` |`KC_AGIN` |Again |
|
||||
|`KC_UNDO` | |アンドゥ |
|
||||
|`KC_CUT` | |カット |
|
||||
|`KC_COPY` | |コピー |
|
||||
|`KC_PASTE` |`KC_PSTE` |ペースト |
|
||||
|`KC_FIND` | |検索 |
|
||||
|`KC__MUTE` | |ミュート |
|
||||
|`KC__VOLUP` | |音量アップ |
|
||||
|`KC__VOLDOWN` | |音量ダウン |
|
||||
|`KC_ALT_ERASE` |`KC_ERAS` |Alternate Erase |
|
||||
|`KC_SYSREQ` | |SysReq/Attention |
|
||||
|`KC_CANCEL` | |Cancel |
|
||||
|`KC_CLEAR` |`KC_CLR` |Clear |
|
||||
|`KC_PRIOR` | |Prior |
|
||||
|`KC_RETURN` | |Return |
|
||||
|`KC_SEPARATOR` | |Separator |
|
||||
|`KC_OUT` | |Out |
|
||||
|`KC_OPER` | |Oper |
|
||||
|`KC_CLEAR_AGAIN` | |Clear/Again |
|
||||
|`KC_CRSEL` | |CrSel/Props |
|
||||
|`KC_EXSEL` | |ExSel |
|
||||
|
||||
## メディアキー
|
||||
|
||||
これらのキーコードは、HID Keyboard/Keypad usage ページにはありません。`SYSTEM_` キーコードは、Generic Desktop ページで見つかります。また、その他は Consumer ページにあります。
|
||||
|
||||
?> これらのキーコードのいくつかは、OS によって異なる動作をする可能性があります。例として、macOS では `KC_MEDIA_FAST_FORWARD`、`KC_MEDIA_REWIND`、`KC_MEDIA_NEXT_TRACK`、`KC_MEDIA_PREV_TRACK` は、押している間は現在の曲の中でスキップしますが、タップした時は曲全体をスキップします。
|
||||
|
||||
|キー |エイリアス |説明 |
|
||||
|-----------------------|-----------|----------------------|
|
||||
|`KC_SYSTEM_POWER` |`KC_PWR` |システム電源オフ |
|
||||
|`KC_SYSTEM_SLEEP` |`KC_SLEP` |システムスリープ |
|
||||
|`KC_SYSTEM_WAKE` |`KC_WAKE` |システムスリープ解除 |
|
||||
|`KC_AUDIO_MUTE` |`KC_MUTE` |ミュート |
|
||||
|`KC_AUDIO_VOL_UP` |`KC_VOLU` |音量アップ |
|
||||
|`KC_AUDIO_VOL_DOWN` |`KC_VOLD` |音量ダウン |
|
||||
|`KC_MEDIA_NEXT_TRACK` |`KC_MNXT` |次の曲へ |
|
||||
|`KC_MEDIA_PREV_TRACK` |`KC_MPRV` |前の曲へ |
|
||||
|`KC_MEDIA_STOP` |`KC_MSTP` |再生停止 |
|
||||
|`KC_MEDIA_PLAY_PAUSE` |`KC_MPLY` |再生/一時停止 |
|
||||
|`KC_MEDIA_SELECT` |`KC_MSEL` |Media Player 起動 |
|
||||
|`KC_MEDIA_EJECT` |`KC_EJCT` |イジェクト |
|
||||
|`KC_MAIL` | |メール起動 |
|
||||
|`KC_CALCULATOR` |`KC_CALC` |電卓起動 |
|
||||
|`KC_MY_COMPUTER` |`KC_MYCM` |マイコンピュータを開く|
|
||||
|`KC_WWW_SEARCH` |`KC_WSCH` |ブラウザ検索 |
|
||||
|`KC_WWW_HOME` |`KC_WHOM` |ブラウザホーム画面 |
|
||||
|`KC_WWW_BACK` |`KC_WBAK` |ブラウザ戻る |
|
||||
|`KC_WWW_FORWARD` |`KC_WFWD` |ブラウザ進む |
|
||||
|`KC_WWW_STOP` |`KC_WSTP` |ブラウザ読み込み中止 |
|
||||
|`KC_WWW_REFRESH` |`KC_WREF` |ブラウザ再読み込み |
|
||||
|`KC_WWW_FAVORITES` |`KC_WFAV` |ブラウザお気に入り |
|
||||
|`KC_MEDIA_FAST_FORWARD`|`KC_MFFD` |次の曲へ |
|
||||
|`KC_MEDIA_REWIND` |`KC_MRWD` |前の曲へ |
|
||||
|`KC_BRIGHTNESS_UP` |`KC_BRIU` |画面の明るさアップ |
|
||||
|`KC_BRIGHTNESS_DOWN` |`KC_BRID` |画面の明るさダウン |
|
||||
|
||||
## テンキー
|
||||
|
||||
|キー |エイリアス |説明 |
|
||||
|-------------------|-----------|-------------------------------|
|
||||
|`KC_KP_SLASH` |`KC_PSLS` |テンキー `/` |
|
||||
|`KC_KP_ASTERISK` |`KC_PAST` |テンキー `*` |
|
||||
|`KC_KP_MINUS` |`KC_PMNS` |テンキー `-` |
|
||||
|`KC_KP_PLUS` |`KC_PPLS` |テンキー `+` |
|
||||
|`KC_KP_ENTER` |`KC_PENT` |テンキー Enter |
|
||||
|`KC_KP_1` |`KC_P1` |テンキー `1` と End |
|
||||
|`KC_KP_2` |`KC_P2` |テンキー `2` と 下矢印 |
|
||||
|`KC_KP_3` |`KC_P3` |テンキー `3` と Page Down |
|
||||
|`KC_KP_4` |`KC_P4` |テンキー `4` と 左矢印 |
|
||||
|`KC_KP_5` |`KC_P5` |テンキー `5` |
|
||||
|`KC_KP_6` |`KC_P6` |テンキー `6` と 右矢印 |
|
||||
|`KC_KP_7` |`KC_P7` |テンキー `7` と Home |
|
||||
|`KC_KP_8` |`KC_P8` |テンキー `8` と 上矢印 |
|
||||
|`KC_KP_9` |`KC_P9` |テンキー `9` と Page Up |
|
||||
|`KC_KP_0` |`KC_P0` |テンキー `0` と Insert |
|
||||
|`KC_KP_DOT` |`KC_PDOT` |テンキー `.` と Delete |
|
||||
|`KC_KP_EQUAL` |`KC_PEQL` |テンキー `=` |
|
||||
|`KC_KP_COMMA` |`KC_PCMM` |テンキー `,` |
|
||||
|`KC_KP_EQUAL_AS400`| |AS/400 キーボードのテンキー `=`|
|
||||
|
||||
## 特別なキー
|
||||
|
||||
これらのキーコードに加えて、`0xA5-DF` の範囲のキーコードは、内部処理のために予約されています。
|
||||
|
||||
|キー |エイリアス |説明 |
|
||||
|----------------|--------------------|-----------------------------------|
|
||||
|`KC_NO` |`XXXXXXX` |このキーを無視します (NOOP) |
|
||||
|`KC_TRANSPARENT`|`KC_TRNS`, `_______`|次に低いレイヤーの非透過キーを使う |
|
@@ -2,125 +2,180 @@
|
||||
|
||||
<!---
|
||||
grep --no-filename "^[ ]*git diff" docs/ja/*.md | sh
|
||||
original document: 0.9.44:docs/newbs_getting_started.md
|
||||
git diff 0.9.44 HEAD -- docs/newbs_getting_started.md | cat
|
||||
original document: 0.13.20:docs/newbs_getting_started.md
|
||||
git diff 0.13.20 HEAD -- docs/newbs_getting_started.md | cat
|
||||
-->
|
||||
|
||||
キーマップをビルドする前に、いくつかのソフトウェアをインストールしてビルド環境を構築する必要があります。
|
||||
ファームウェアをコンパイルするキーボードの数に関わらず、この作業を一度だけ実行する必要があります。
|
||||
|
||||
## 1. ソフトウェアのダウンロード
|
||||
## 1. 前提条件
|
||||
|
||||
始めるために必要なソフトウェアがいくつかあります。
|
||||
|
||||
### テキストエディタ
|
||||
* [テキストエディタ](ja/newbs_learn_more_resources.md#text-editor-resources)
|
||||
* プレーンテキストファイルを編集して保存できるプログラムが必要です。多くの OS に付属するデフォルトのエディタはプレーンテキストファイルを保存しないため、選択したエディタがプレーンテキストファイルを保存することを確認する必要があります。
|
||||
* [Toolbox (オプション)](https://github.com/qmk/qmk_toolbox)
|
||||
* Windows と macOS で使える GUI を備えたプログラムで、カスタムキーボードのプログラミングとデバッグの両方ができます。
|
||||
|
||||
**プレーンテキスト** ファイルを編集して保存できるプログラムが必要です。
|
||||
Windows の場合、メモ帳が使えます。Linux の場合、gedit が使えます。どちらもシンプルですが機能的なテキストエディタです。
|
||||
macOS では、デフォルトのテキストエディットアプリに注意してください。_フォーマット_ メニューから _標準テキストにする_ を選択しない限り、プレーンテキストとして保存されません。
|
||||
|
||||
[Sublime Text](https://www.sublimetext.com/) や [VS Code](https://code.visualstudio.com/) のような専用のテキストエディタをダウンロードしてインストールすることもできます。これらのプログラムはコードを編集するために特別に作成されているため、これはプラットフォームに関係なくベストな方法です。
|
||||
|
||||
?> どのエディタを使えば良いか分からない場合、Laurence Bradford が書いたこの記事 [a great introduction](https://learntocodewith.me/programming/basics/text-editors/) を読んでください。
|
||||
|
||||
### QMK Toolbox
|
||||
|
||||
QMK Toolbox は、Windows と macOS で使える GUI を備えたプログラムで、カスタムキーボードのプログラミングとデバッグの両方ができます。
|
||||
このプログラムは、キーボードに簡単にファームウェアを書き込んだり、出力されるデバッグメッセージを確認する際に、かけがえのないものであることがわかるでしょう。
|
||||
|
||||
[QMK Toolbox の最新版](https://github.com/qmk/qmk_toolbox/releases/latest)
|
||||
|
||||
* Windows 版: `qmk_toolbox.exe` (portable) または `qmk_toolbox_install.exe` (installer)
|
||||
* macOS 版: `QMK.Toolbox.app.zip` (portable) または `QMK.Toolbox.pkg` (installer)
|
||||
|
||||
### Unix ライクな環境
|
||||
|
||||
Linux や macOS には既に実行可能な unix シェルが付属しています。ビルド環境を構築するだけで済みます。
|
||||
|
||||
Windows では、MSYS2 や WSL をインストールして、これらの環境を使う必要があります。MSYS2 の構築手順を以下に示します。
|
||||
?> もし、Linux か Unix のコマンドを使ったことがない場合、こちらで基本的な概念や各種コマンドを学んでください。[これらの教材](ja/newbs_learn_more_resources.md#command-line-resources)で QMK を使うのに必要なことを学ぶことができます。
|
||||
|
||||
## 2. ビルド環境を準備する :id=set-up-your-environment
|
||||
|
||||
私たちは、QMK を可能な限り簡単に構築できるように努力しています。
|
||||
Linux か Unix 環境を用意するだけで、QMK に残りをインストールさせることができます。
|
||||
私たちは、QMK を可能な限り簡単に構築できるように努力しています。Linux か Unix 環境を用意するだけで、QMK に残りをインストールさせることができます。
|
||||
|
||||
?> もし、Linux か Unix のコマンドを使ったことがない場合、こちらで基本的な概念や各種コマンドを学んでください。これらの教材で QMK を使うのに必要なことを学ぶことができます:<br>
|
||||
[Must Know Linux Commands](https://www.guru99.com/must-know-linux-commands.html)<br>
|
||||
[Some Basic Unix Commands](https://www.tjhsst.edu/~dhyatt/superap/unixcmd.html)
|
||||
<!-- tabs:start -->
|
||||
|
||||
### Windows
|
||||
### ** Windows **
|
||||
|
||||
MSYS2 と Git と QMK CLI のインストールが必要です。
|
||||
QMK は、MSYS2、CLI、および必要な全ての依存関係のバンドルを保守しています。また、正しい環境で直接起動するための便利な `QMK MSYS` ターミナルショートカットも提供しています。
|
||||
|
||||
[MSYS2 homepage](https://www.msys2.org) のインストール手順に従ってください。開いている MSYS2 の全ターミナル画面を閉じて、新しい MinGW 64-bit ターミナル画面を開きます。**注意: これはインストールが完了した時に開く MSYS ターミナルと同じ *ではありません*。**
|
||||
#### 前提条件
|
||||
|
||||
[QMK MSYS](https://msys.qmk.fm/) をインストールする必要があります。最新リリースは[ここ](https://github.com/qmk/qmk_distro_msys/releases/latest)から入手できます。
|
||||
|
||||
または、MSYS2 を手動でインストールしたい場合、次のセクションでプロセスを説明します。
|
||||
|
||||
<details>
|
||||
<summary>手動インストール</summary>
|
||||
|
||||
?> `QMK MSYS` を使う場合、次のステップは無視してください。
|
||||
|
||||
#### 前提条件
|
||||
|
||||
MSYS2 と Git と Python をインストールする必要があります。https://www.msys2.org のインストール手順に従ってください。
|
||||
|
||||
MSYS2 をインストールしたら、開いている MSYS の全ターミナル画面を閉じて、新しい MinGW 64-bit ターミナル画面を開きます。
|
||||
|
||||
!> **注意:** MinGW 64-bit ターミナルは、インストールが完了した時に開く MSYS ターミナルと*同じではありません*。プロンプトには、「MSYS」ではなく、紫色のテキストで「MINGW64」と表示されます。違いについての詳細は[このページ](https://www.msys2.org/wiki/MSYS2-introduction/#subsystems)を参照してください。
|
||||
|
||||
それから、次のように実行します:
|
||||
|
||||
pacman --needed --noconfirm --disable-download-timeout -S git mingw-w64-x86_64-toolchain mingw-w64-x86_64-python3-pip
|
||||
|
||||
#### インストール
|
||||
|
||||
次のコマンドを実行して、QMK CLI をインストールします:
|
||||
|
||||
python3 -m pip install qmk
|
||||
|
||||
### macOS
|
||||
</details>
|
||||
|
||||
Homebrew のインストールが必要です。[Homebrew homepage](https://brew.sh) の手順に従ってください。
|
||||
### ** macOS **
|
||||
|
||||
Homebrew をインストールした後で、以下のコマンドを実行します:
|
||||
QMK は CLI と全ての必要な依存関係を自動的にインストールする Homebrew tap と formula を保守しています。
|
||||
|
||||
#### 前提条件
|
||||
|
||||
Homebrew のインストールが必要です。https://brew.sh の手順に従ってください。
|
||||
|
||||
#### インストール
|
||||
|
||||
次のコマンドを実行して、QMK CLI をインストールします:
|
||||
|
||||
brew install qmk/qmk/qmk
|
||||
|
||||
### Linux
|
||||
### ** Linux/WSL **
|
||||
|
||||
?> **WSL ユーザーへの注意**: デフォルトでは、インストールプロセスは QMK リポジトリを WSL ホームディレクトリに clone しますが、手動で clone した場合、Windows ファイルシステムではなく、WSL インスタンス内にある(つまり `/mnt` 内にない)ことを確認してください。これは、現在アクセスが[非常に遅い](https://github.com/microsoft/WSL/issues/4197)ためです。
|
||||
|
||||
#### 前提条件
|
||||
|
||||
Git と Python をインストールする必要があります。両方とも既にインストールされている可能性は高いですが、そうでない場合、次のコマンドのいずれかでそれらをインストールできます:
|
||||
|
||||
* Debian / Ubuntu / Devuan: `sudo apt install git python3 python3-pip`
|
||||
* Fedora / Red Hat / CentOS: `sudo yum install git python3 python3-pip`
|
||||
* Arch / Manjaro: `sudo pacman -S git python python-pip python-setuptools libffi`
|
||||
* Debian / Ubuntu / Devuan: `sudo apt install -y git python3-pip`
|
||||
* Fedora / Red Hat / CentOS: `sudo yum -y install git python3-pip`
|
||||
* Arch / Manjaro: `sudo pacman --needed --noconfirm -S git python-pip libffi`
|
||||
* Void: `sudo xbps-install -y git python3-pip`
|
||||
* Solus: `sudo eopkg -y install git python3`
|
||||
* Sabayon: `sudo equo install dev-vcs/git dev-python/pip`
|
||||
* Gentoo: `sudo emerge dev-vcs/git dev-python/pip`
|
||||
|
||||
グローバル CLI をインストールして、システムをブートストラップします:
|
||||
#### インストール
|
||||
|
||||
`python3 -m pip install --user qmk` (Arch ベースのディストリビューションでは AUR から `qmk` パッケージを試すこともできます(**メモ**: コミュニティメンバーによって保守されています): `yay -S qmk`)
|
||||
|
||||
### FreeBSD
|
||||
|
||||
Git と Python をインストールする必要があります。両方とも既にインストールされている可能性は高いですが、そうでない場合、次のコマンドを実行してそれらをインストールします:
|
||||
|
||||
pkg install git python3
|
||||
|
||||
ローカルにインストールした Python パッケージが利用できるように、`$HOME/.local/bin` が `$PATH` に追加されていることを確認してください。
|
||||
|
||||
インストール完了後、QMK CLI をインストールできます:
|
||||
次のコマンドを実行して、QMK CLI をインストールします:
|
||||
|
||||
python3 -m pip install --user qmk
|
||||
|
||||
#### コミュニティパッケージ
|
||||
|
||||
これらのパッケージはコミュニティメンバーによって保守されているため、最新ではないか、完全には機能しない可能性があります。問題が発生した場合は、それぞれのメンテナに報告してください。
|
||||
|
||||
Arch ベースのディストリビューションでは、公式リポジトリから CLI をインストールできます(注意: 執筆時点では、このパッケージは一部の依存関係をオプションとしてマークしていますが、そうではありません):
|
||||
|
||||
sudo pacman -S qmk
|
||||
|
||||
AUR から `qmk-git` パッケージを試すこともできます:
|
||||
|
||||
yay -S qmk-git
|
||||
|
||||
### ** FreeBSD **
|
||||
|
||||
#### インストール
|
||||
|
||||
次のコマンドを実行して、QMK CLI の FreeBSD パッケージをインストールします:
|
||||
|
||||
pkg install -g "py*-qmk"
|
||||
|
||||
注意: インストールの最後に表示された指示に従うことを忘れないでください(再度表示するには、`pkg info -Dg "py*-qmk"` を使ってください)。
|
||||
|
||||
<!-- tabs:end -->
|
||||
|
||||
## 3. QMK の設定を行う :id=set-up-qmk
|
||||
|
||||
<!-- tabs:start -->
|
||||
|
||||
### ** Windows **
|
||||
|
||||
QMK のインストール後に、このコマンドで設定できます:
|
||||
|
||||
qmk setup
|
||||
|
||||
ほとんどの場合、全てのプロンプトに Yes と答えます。
|
||||
ほとんどの場合、全てのプロンプトに `y` と答えます。
|
||||
|
||||
### ** macOS **
|
||||
|
||||
QMK のインストール後に、このコマンドで設定できます:
|
||||
|
||||
qmk setup
|
||||
|
||||
ほとんどの場合、全てのプロンプトに `y` と答えます。
|
||||
|
||||
### ** Linux/WSL **
|
||||
|
||||
QMK のインストール後に、このコマンドで設定できます:
|
||||
|
||||
qmk setup
|
||||
|
||||
ほとんどの場合、全てのプロンプトに `y` と答えます。
|
||||
|
||||
?>**Debian、Ubuntu、それらの派生に関する注意**:
|
||||
次のようなエラーが表示される可能性があります: `bash: qmk: command not found`.
|
||||
これは Debian の Bash 4.4 リリースで導入された [バグ](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=839155) で、`$HOME/.local/bin` が PATH から削除されました。このバグは後に Debian や Ubuntu で修正されました。
|
||||
これは Debian の Bash 4.4 リリースで導入された[バグ](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=839155)で、`$HOME/.local/bin` が PATH から削除されました。このバグは後に Debian や Ubuntu で修正されました。
|
||||
残念なことに、Ubuntu はこのバグを再導入し、[まだ修正していません](https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1588562)。
|
||||
幸い、修正は簡単です。これをあなたのユーザで実行します: `echo 'PATH="$HOME/.local/bin:$PATH"' >> $HOME/.bashrc && source $HOME/.bashrc`
|
||||
|
||||
?>**FreeBSD に関する注意**:
|
||||
まず、`root` 以外のユーザで `qmk setup` を実行することをお勧めしますが、これはおそらく `pkg` を使って基本システムにインストールする必要があるパッケージを識別します。
|
||||
しかし、特権のないユーザで実行すると、インストールはおそらく失敗します。
|
||||
基本的な依存関係を手動でインストールするには、`./util/qmk_install.sh` を `root` として実行するか、`sudo` をつけて実行します。
|
||||
それが完了したら、`qmk setup` を再実行して設定と確認を完了させます。
|
||||
### ** FreeBSD **
|
||||
|
||||
?> 既に [GitHub の使いかた](ja/getting_started_github.md)を知っているなら、fork を作成し、`qmk setup <github_username>/qmk_firmware` を使って個人用の fork から clone することをお勧めします。この一文の意味が分からない場合、このメッセージは無視してかまいません。
|
||||
QMK のインストール後に、このコマンドで設定できます:
|
||||
|
||||
qmk setup
|
||||
|
||||
ほとんどの場合、全てのプロンプトに `y` と答えます。
|
||||
|
||||
<!-- tabs:end -->
|
||||
|
||||
?> qmk ホームフォルダは、セットアップ時に `qmk setup -H <path>` を使って指定し、[cli 構成](ja/cli_configuration.md?id=single-key-example)と変数 `user.qmk_home` を使って変更できます。利用可能な全てのオプションについては、`qmk setup --help` を実行します。
|
||||
|
||||
?> 既に GitHub の使い方を知っている場合、[これらの手順に従うことをお勧めします](ja/getting_started_github.md)。そして `qmk setup <github_username>/qmk_firmware` を使って個人用の fork から clone します。この一文の意味が分からない場合、このメッセージは無視してかまいません。
|
||||
|
||||
## 4. ビルド環境の確認
|
||||
|
||||
これで QMK のビルド環境が用意できたので、キーボードのファームウェアをビルドできます。
|
||||
キーボードのデフォルトキーマップをビルドすることから始めます。次の形式のコマンドでビルドできるはずです。
|
||||
これで QMK のビルド環境が用意できたので、キーボードのファームウェアをビルドできます。キーボードのデフォルトキーマップをビルドすることから始めます。次の形式のコマンドでビルドできるはずです:
|
||||
|
||||
qmk compile -kb <keyboard> -km default
|
||||
|
||||
例えば、Clueboard 66% のファームウェアをビルドする場合:
|
||||
例えば、Clueboard 66% のファームウェアをビルドする場合、次のようにします:
|
||||
|
||||
qmk compile -kb clueboard/66/rev3 -km default
|
||||
|
||||
@@ -152,5 +207,4 @@ QMK を初めて使うほとんどの人は、キーボードを1つしか持っ
|
||||
|
||||
# キーマップの作成
|
||||
|
||||
これであなた専用のキーマップを作成する準備ができました!
|
||||
次は [初めてのファームウェアの構築](ja/newbs_building_firmware.md) で専用のキーマップを作成します。
|
||||
これであなた専用のキーマップを作成する準備ができました!次は[初めてのファームウェアの構築](ja/newbs_building_firmware.md)で専用のキーマップを作成します。
|
||||
|
@@ -2,105 +2,14 @@
|
||||
|
||||
<!---
|
||||
grep --no-filename "^[ ]*git diff" docs/ja/*.md | sh
|
||||
original document: 0.9.0:docs/newbs_testing_debugging.md
|
||||
git diff 0.9.0 HEAD -- docs/newbs_testing_debugging.md | cat
|
||||
original document: 0.12.45:docs/newbs_testing_debugging.md
|
||||
git diff 0.12.45 HEAD -- docs/newbs_testing_debugging.md | cat
|
||||
-->
|
||||
|
||||
カスタムファームウェアをキーボードへ書き込んだら、テストする準備が整います。運が良ければ全て問題なく動作しているはずですが、もしそうでなければこのドキュメントがどこが悪いのか調べるのに役立ちます。
|
||||
|
||||
## テスト
|
||||
|
||||
通常、キーボードをテストするのは非常に簡単です。
|
||||
全てのキーをひとつずつ押して、期待されるキーが送信されていることを確認します。
|
||||
QMK を実行していなくても、[QMK Configurator](https://config.qmk.fm/#/test/) のテストモードを使ってキーボードを確認することができます。
|
||||
[ここに移動しました](ja/faq_misc.md#testing)
|
||||
|
||||
## デバッグ :id=debugging
|
||||
|
||||
`rules.mk`へ`CONSOLE_ENABLE = yes`の設定をするとキーボードはデバッグ情報を出力します。デフォルトの出力は非常に限られたものですが、デバッグモードをオンにすることでデバッグ情報の量を増やすことが出来ます。キーマップの`DEBUG`キーコードを使用するか、デバッグモードを有効にする [コマンド](ja/feature_command.md) 機能を使用するか、以下のコードをキーマップに追加します。
|
||||
|
||||
```c
|
||||
void keyboard_post_init_user(void) {
|
||||
// Customise these values to desired behaviour
|
||||
debug_enable=true;
|
||||
debug_matrix=true;
|
||||
//debug_keyboard=true;
|
||||
//debug_mouse=true;
|
||||
}
|
||||
```
|
||||
|
||||
## デバッグツール :id=debugging-tools
|
||||
|
||||
キーボードのデバッグに使えるツールは2つあります。
|
||||
|
||||
### QMK Toolboxを使ったデバッグ
|
||||
|
||||
互換性のある環境では、[QMK Toolbox](https://github.com/qmk/qmk_toolbox)を使うことでキーボードからのデバッグメッセージを表示できます。
|
||||
|
||||
### hid_listenを使ったデバッグ
|
||||
|
||||
ターミナルベースの方法がお好みですか?PJRC が提供する[hid_listen](https://www.pjrc.com/teensy/hid_listen.html)もデバッグメッセージの表示に使用できます。ビルド済みの実行ファイルは Windows, Linux, MacOS 用が用意されています。
|
||||
|
||||
|
||||
## 独自のデバッグメッセージを送信する
|
||||
|
||||
[custom code](ja/custom_quantum_functions.md)内からデバッグメッセージを出力すると便利な場合があります。それはとても簡単です。ファイルの先頭に`print.h`のインクルードを追加します:
|
||||
|
||||
```c
|
||||
#include "print.h"
|
||||
```
|
||||
|
||||
そのあとは、いくつかの異なった print 関数を使用することが出来ます。
|
||||
|
||||
* `print("string")`: シンプルな文字列を出力します
|
||||
* `uprintf("%s string", var)`: フォーマットされた文字列を出力します
|
||||
* `dprint("string")` デバッグモードが有効な場合のみ、シンプルな文字列を出力します
|
||||
* `dprintf("%s string", var)`: デバッグモードが有効な場合のみ、フォーマットされた文字列を出力します
|
||||
|
||||
## デバッグの例
|
||||
|
||||
以下は現実世界での実際のデバッグ手法の例を集めたものです。追加情報は[Debugging/Troubleshooting QMK](ja/faq_debug.md)を参照してください。
|
||||
|
||||
### マトリックス上のどの場所でキー押下が起こったか?
|
||||
|
||||
移植する、PCBの問題を診断する場合、キー入力が正しくスキャンされているかどうかを確認することが役立つ場合があります。この手法でのロギングを有効化するには、`keymap.c`へ以下のコードを追加します。
|
||||
|
||||
```c
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
// コンソールが有効化されている場合、マトリックス上の位置とキー押下状態を出力します
|
||||
#ifdef CONSOLE_ENABLE
|
||||
uprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
```
|
||||
|
||||
出力の例
|
||||
```text
|
||||
Waiting for device:.......
|
||||
Listening:
|
||||
KL: kc: 169, col: 0, row: 0, pressed: 1
|
||||
KL: kc: 169, col: 0, row: 0, pressed: 0
|
||||
KL: kc: 174, col: 1, row: 0, pressed: 1
|
||||
KL: kc: 174, col: 1, row: 0, pressed: 0
|
||||
KL: kc: 172, col: 2, row: 0, pressed: 1
|
||||
KL: kc: 172, col: 2, row: 0, pressed: 0
|
||||
```
|
||||
|
||||
### キースキャンにかかる時間の測定
|
||||
|
||||
パフォーマンスの問題をテストする場合、スイッチマトリックスをスキャンする頻度を知ることが役立ちます。この手法でのロギングを有効化するには`config.h`へ以下のコードを追加します。
|
||||
|
||||
|
||||
```c
|
||||
#define DEBUG_MATRIX_SCAN_RATE
|
||||
```
|
||||
|
||||
出力例
|
||||
```text
|
||||
> matrix scan frequency: 315
|
||||
> matrix scan frequency: 313
|
||||
> matrix scan frequency: 316
|
||||
> matrix scan frequency: 316
|
||||
> matrix scan frequency: 316
|
||||
> matrix scan frequency: 316
|
||||
```
|
||||
[ここに移動しました](ja/faq_debug.md#debugging)
|
||||
|
@@ -1,8 +1,8 @@
|
||||
# QMK 開発のための Eclipse セットアップ
|
||||
|
||||
<!---
|
||||
original document: 0.9.34:docs/other_eclipse.md
|
||||
git diff 0.9.34 HEAD -- docs/other_eclipse.md | cat
|
||||
original document: 0.12.41:docs/other_eclipse.md
|
||||
git diff 0.12.41 HEAD -- docs/other_eclipse.md | cat
|
||||
-->
|
||||
|
||||
[Eclipse][1]は Java 開発のために広く使われているオープンソースの [統合開発環境](https://en.wikipedia.org/wiki/Integrated_development_environment) (IDE) ですが、他の言語および用途のためにカスタマイズできる拡張可能なプラグインシステムがあります。
|
||||
@@ -55,7 +55,7 @@ Workspace 選択で入力を促された場合は、Eclipse メタデータと
|
||||
### [ANSI Escape in Console](https://marketplace.eclipse.org/content/ansi-escape-console)
|
||||
このプラグインは QMK makefile によって生成された色付きビルド出力を適切に表示するために必要です。
|
||||
|
||||
1. <kbd><kbd>Help</kbd> > <kbd>Eclipse Marketplace…</kbd></kbd> を開きます
|
||||
1. <kbd>Help</kbd> > <kbd>Eclipse Marketplace…</kbd> を開きます
|
||||
2. _ANSI Escape in Console_ を検索します
|
||||
3. プラグインの <samp>Install</samp> ボタンをクリックします
|
||||
4. 指示に従い、未署名コンテンツのセキュリティ警告に再度同意します。
|
||||
@@ -64,7 +64,7 @@ Workspace 選択で入力を促された場合は、Eclipse メタデータと
|
||||
|
||||
# QMK 用の Eclipse の設定
|
||||
## プロジェクトのインポート
|
||||
1. <kbd><kbd>File</kbd> > <kbd>New</kbd> > <kbd>Makefile Project with Existing Code</kbd></kbd> をクリックします
|
||||
1. <kbd>File</kbd> > <kbd>New</kbd> > <kbd>Makefile Project with Existing Code</kbd> をクリックします
|
||||
2. 次の画面で:
|
||||
* _Existing Code Location_ としてリポジトリをクローンしたディレクトリを選択します。
|
||||
* (オプション) プロジェクトに別の名前を付けます¹ 例えば _QMK_ あるいは _Quantum_;
|
||||
@@ -78,16 +78,12 @@ Workspace 選択で入力を促された場合は、Eclipse メタデータと
|
||||
¹ カスタム名でプロジェクトをインポートすると問題が発生するかもしれません。正しく動作しない場合は、デフォルトのプロジェクト名 (つまり、ディレクトリの名前、おそらく `qmk_firmware`) のままにしてみてください。
|
||||
|
||||
## キーボードのビルド
|
||||
ここで、プロジェクトをクリーンし、選択したキーマップをビルドする make target を設定します。
|
||||
|
||||
1. 画面の右側で、<kbd>Make Target</kbd> タブを選択します
|
||||
2. フォルダツリーを選択したキーボードまで展開します。例えば、`qmk_firmware/keyboards/ergodox`
|
||||
3. キーボードフォルダを右クリックして、<kbd>New…</kbd> を選択します (あるいはフォルダを選択し、ツリーの上にある <kbd>New Make Target</kbd> アイコンをクリックします)
|
||||
4. ビルド target の名前を選択します。例えば、_clean \<your keymap\>_
|
||||
5. Make Target: これはコマンドラインからビルドする時に `make` に渡す引数です。target 名がこれらの引数と一致しない場合は、<kbd>Same as target name</kbd> のチェックを外し、正しい引数を入力します。例えば、`clean <your keymap>`
|
||||
6. 他のオプションはチェックしたままにして、<kbd>OK</kbd> をクリックします。これで、選択されたキーボードの下に、make target が表示されます。
|
||||
7. (オプション) target ツリーの上にある <kbd>Hide Empty Folders</kbd> アイコンボタンを、ビルド target だけが表示されるように切り替えます。
|
||||
8. 作成したビルド target をダブルクリックし、ビルドを起動します。
|
||||
9. 下部の <kbd>Console</kbd> ビューを選択し、実行中のビルドを眺めます。
|
||||
プロジェクトのデフォルトの make 対象を `all` から私たちが取り組んでいる特定のキーボードとキーマップの組み合わせ、例えば `kinesis/kint36:stapelberg` に変更します。このようにすると、プロジェクトのクリーニングやビルドのようなプロジェクト全体のアクションは迅速に完了し、長い時間がかかったり Eclipse が完全にロックしたりすることがなくなります。
|
||||
|
||||
1. プロジェクト内の editor タブへフォーカスします
|
||||
2. `Project` > `Properties` ウィンドウを開き、`C/C++ Build` リストエントリを選択して、`Behavior` タブに切り替えます。
|
||||
3. 有効な全てのビルドのデフォルトの `Make build target` テキストフィールドを、`all` から例えば `kinesis/kint41:stapelberg` に変更します。
|
||||
4. `Project` > `Clean...` を選択して、セットアップが動作することを確認します。
|
||||
|
||||
[1]: https://en.wikipedia.org/wiki/Eclipse_(software)
|
||||
|
@@ -1,8 +1,8 @@
|
||||
# QMK 開発用の Visual Studio Code のセットアップ
|
||||
|
||||
<!---
|
||||
original document: 0.10.33:docs/other_vscode.md
|
||||
git diff 0.10.33 HEAD -- docs/other_vscode.md | cat
|
||||
original document: 0.13.17:docs/other_vscode.md
|
||||
git diff 0.13.17 HEAD -- docs/other_vscode.md | cat
|
||||
-->
|
||||
|
||||
[Visual Studio Code](https://code.visualstudio.com/) (VS Code) は多くの異なるプログラミング言語をサポートするオープンソースのコードエディタです。
|
||||
|
@@ -2,8 +2,8 @@
|
||||
|
||||
<!---
|
||||
grep --no-filename "^[ ]*git diff" docs/ja/*.md | sh
|
||||
original document: 0.9.46:docs/proton_c_conversion.md
|
||||
git diff 0.9.46 HEAD -- docs/proton_c_conversion.md | cat
|
||||
original document: 0.13.17:docs/proton_c_conversion.md
|
||||
git diff 0.13.17 HEAD -- docs/proton_c_conversion.md | cat
|
||||
-->
|
||||
|
||||
Proton C は Pro Micro の差し替え可能品であるため、簡単に使用することができます。
|
||||
|
@@ -1,8 +1,8 @@
|
||||
# QMK Configurator でのキーボードのサポート
|
||||
|
||||
<!---
|
||||
original document: 0.9.46:docs/reference_configurator_support.md
|
||||
git diff 0.9.46 HEAD -- docs/reference_configurator_support.md | cat
|
||||
original document: 0.13.15:docs/reference_configurator_support.md
|
||||
git diff 0.13.15 HEAD -- docs/reference_configurator_support.md | cat
|
||||
-->
|
||||
|
||||
このページは [QMK Configurator](https://config.qmk.fm/) でキーボードを適切にサポートする方法について説明します。
|
||||
|
@@ -1,8 +1,8 @@
|
||||
# QMK 用語集
|
||||
|
||||
<!---
|
||||
original document: 0.9.46:docs/reference_glossary.md
|
||||
git diff 0.9.46 HEAD -- docs/reference_glossary.md | cat
|
||||
original document: 0.13.15:docs/reference_glossary.md
|
||||
git diff 0.13.15 HEAD -- docs/reference_glossary.md | cat
|
||||
-->
|
||||
|
||||
## ARM
|
||||
|
@@ -1,8 +1,8 @@
|
||||
# QMK のコードの理解
|
||||
|
||||
<!---
|
||||
original document: 0.9.55:docs/understanding_qmk.md
|
||||
git diff 0.9.55 HEAD -- docs/understanding_qmk.md | cat
|
||||
original document: 0.13.15:docs/understanding_qmk.md
|
||||
git diff 0.13.15 HEAD -- docs/understanding_qmk.md | cat
|
||||
-->
|
||||
|
||||
このドキュメントでは、QMK ファームウェアがどのように機能するかを非常に高いレベルから説明しようとしています。基本的なプログラミングの概念を理解していることを前提としていますが、(実例を示す必要がある場合を除き) C に精通していることを前提にはしていません。以下のドキュメントの基本的な知識があることを前提としています。
|
||||
|
151
docs/keycodes.md
151
docs/keycodes.md
@@ -354,6 +354,157 @@ See also: [Leader Key](feature_leader_key.md)
|
||||
|---------|------------------------|
|
||||
|`KC_LEAD`|Begins a leader sequence|
|
||||
|
||||
## MIDI :id=midi
|
||||
|
||||
See also: [MIDI](feature_midi.md)
|
||||
|
||||
|Key |Aliases |Description |
|
||||
|------------|---------|---------------------------------|
|
||||
|`MI_ON` | |Turn MIDI on |
|
||||
|`MI_OFF` | |Turn MIDI off |
|
||||
|`MI_TOG` | |Toggle MIDI enabled |
|
||||
|`MI_C` | |C octave 0 |
|
||||
|`MI_Cs` |`MI_Db` |C♯/D♭ octave 0 |
|
||||
|`MI_D` | |D octave 0 |
|
||||
|`MI_Ds` |`MI_Eb` |D♯/E♭ octave 0 |
|
||||
|`MI_E` | |E octave 0 |
|
||||
|`MI_F` | |F octave 0 |
|
||||
|`MI_Fs` |`MI_Gb` |F♯/G♭ octave 0 |
|
||||
|`MI_G` | |G octave 0 |
|
||||
|`MI_Gs` |`MI_Gs` |G♯/A♭ octave 0 |
|
||||
|`MI_A` | |A octave 0 |
|
||||
|`MI_As` |`MI_Bb` |A♯/B♭ octave 0 |
|
||||
|`MI_B` | |B octave 0 |
|
||||
|`MI_C_1` | |C octave 1 |
|
||||
|`MI_Cs_1` |`MI_Db_1`|C♯/D♭ octave 1 |
|
||||
|`MI_D_1` | |D octave 1 |
|
||||
|`MI_Ds_1` |`MI_Eb_1`|D♯/E♭ octave 1 |
|
||||
|`MI_E_1` | |E octave 1 |
|
||||
|`MI_F_1` | |F octave 1 |
|
||||
|`MI_Fs_1` |`MI_Gb_1`|F♯/G♭ octave 1 |
|
||||
|`MI_G_1` | |G octave 1 |
|
||||
|`MI_Gs_1` |`MI_Ab_1`|G♯/A♭ octave 1 |
|
||||
|`MI_A_1` | |A octave 1 |
|
||||
|`MI_As_1` |`MI_Bb_1`|A♯/B♭ octave 1 |
|
||||
|`MI_B_1` | |B octave 1 |
|
||||
|`MI_C_2` | |C octave 2 |
|
||||
|`MI_Cs_2` |`MI_Db_2`|C♯/D♭ octave 2 |
|
||||
|`MI_D_2` | |D octave 2 |
|
||||
|`MI_Ds_2` |`MI_Eb_2`|D♯/E♭ octave 2 |
|
||||
|`MI_E_2` | |E octave 2 |
|
||||
|`MI_F_2` | |F octave 2 |
|
||||
|`MI_Fs_2` |`MI_Gb_2`|F♯/G♭ octave 2 |
|
||||
|`MI_G_2` | |G octave 2 |
|
||||
|`MI_Gs_2` |`MI_Ab_2`|G♯/A♭ octave 2 |
|
||||
|`MI_A_2` | |A octave 2 |
|
||||
|`MI_As_2` |`MI_Bb_2`|A♯/B♭ octave 2 |
|
||||
|`MI_B_2` | |B octave 2 |
|
||||
|`MI_C_3` | |C octave 3 |
|
||||
|`MI_Cs_3` |`MI_Db_3`|C♯/D♭ octave 3 |
|
||||
|`MI_D_3` | |D octave 3 |
|
||||
|`MI_Ds_3` |`MI_Eb_3`|D♯/E♭ octave 3 |
|
||||
|`MI_E_3` | |E octave 3 |
|
||||
|`MI_F_3` | |F octave 3 |
|
||||
|`MI_Fs_3` |`MI_Gb_3`|F♯/G♭ octave 3 |
|
||||
|`MI_G_3` | |G octave 3 |
|
||||
|`MI_Gs_3` |`MI_Ab_3`|G♯/A♭ octave 3 |
|
||||
|`MI_A_3` | |A octave 3 |
|
||||
|`MI_As_3` |`MI_Bb_3`|A♯/B♭ octave 3 |
|
||||
|`MI_B_3` | |B octave 3 |
|
||||
|`MI_C_4` | |C octave 4 |
|
||||
|`MI_Cs_4` |`MI_Db_4`|C♯/D♭ octave 4 |
|
||||
|`MI_D_4` | |D octave 4 |
|
||||
|`MI_Ds_4` |`MI_Eb_4`|D♯/E♭ octave 4 |
|
||||
|`MI_E_4` | |E octave 4 |
|
||||
|`MI_F_4` | |F octave 4 |
|
||||
|`MI_Fs_4` |`MI_Gb_4`|F♯/G♭ octave 4 |
|
||||
|`MI_G_4` | |G octave 4 |
|
||||
|`MI_Gs_4` |`MI_Ab_4`|G♯/A♭ octave 4 |
|
||||
|`MI_A_4` | |A octave 4 |
|
||||
|`MI_As_4` |`MI_Bb_4`|A♯/B♭ octave 4 |
|
||||
|`MI_B_4` | |B octave 4 |
|
||||
|`MI_C_5` | |C octave 5 |
|
||||
|`MI_Cs_5` |`MI_Db_5`|C♯/D♭ octave 5 |
|
||||
|`MI_D_5` | |D octave 5 |
|
||||
|`MI_Ds_5` |`MI_Eb_5`|D♯/E♭ octave 5 |
|
||||
|`MI_E_5` | |E octave 5 |
|
||||
|`MI_F_5` | |F octave 5 |
|
||||
|`MI_Fs_5` |`MI_Gb_5`|F♯/G♭ octave 5 |
|
||||
|`MI_G_5` | |G octave 5 |
|
||||
|`MI_Gs_5` |`MI_Ab_5`|G♯/A♭ octave 5 |
|
||||
|`MI_A_5` | |A octave 5 |
|
||||
|`MI_As_5` |`MI_Bb_5`|A♯/B♭ octave 5 |
|
||||
|`MI_B_5` | |B octave 5 |
|
||||
|`MI_OCT_N2` | |Set octave to -2 |
|
||||
|`MI_OCT_N1` | |Set octave to -1 |
|
||||
|`MI_OCT_0` | |Set octave to 0 |
|
||||
|`MI_OCT_1` | |Set octave to 1 |
|
||||
|`MI_OCT_2` | |Set octave to 2 |
|
||||
|`MI_OCT_3` | |Set octave to 3 |
|
||||
|`MI_OCT_4` | |Set octave to 4 |
|
||||
|`MI_OCT_5` | |Set octave to 5 |
|
||||
|`MI_OCT_6` | |Set octave to 6 |
|
||||
|`MI_OCT_7` | |Set octave to 7 |
|
||||
|`MI_OCTD` | |Move down an octave |
|
||||
|`MI_OCTU` | |Move up an octave |
|
||||
|`MI_TRNS_N6`| |Set transposition to -6 semitones|
|
||||
|`MI_TRNS_N5`| |Set transposition to -5 semitones|
|
||||
|`MI_TRNS_N4`| |Set transposition to -4 semitones|
|
||||
|`MI_TRNS_N3`| |Set transposition to -3 semitones|
|
||||
|`MI_TRNS_N2`| |Set transposition to -2 semitones|
|
||||
|`MI_TRNS_N1`| |Set transposition to -1 semitone |
|
||||
|`MI_TRNS_0` | |No transposition |
|
||||
|`MI_TRNS_1` | |Set transposition to +1 semitone |
|
||||
|`MI_TRNS_2` | |Set transposition to +2 semitones|
|
||||
|`MI_TRNS_3` | |Set transposition to +3 semitones|
|
||||
|`MI_TRNS_4` | |Set transposition to +4 semitones|
|
||||
|`MI_TRNS_5` | |Set transposition to +5 semitones|
|
||||
|`MI_TRNS_6` | |Set transposition to +6 semitones|
|
||||
|`MI_TRNSD` | |Decrease transposition |
|
||||
|`MI_TRNSU` | |Increase transposition |
|
||||
|`MI_VEL_0` | |Set velocity to 0 |
|
||||
|`MI_VEL_1` | |Set velocity to 12 |
|
||||
|`MI_VEL_2` | |Set velocity to 25 |
|
||||
|`MI_VEL_3` | |Set velocity to 38 |
|
||||
|`MI_VEL_4` | |Set velocity to 51 |
|
||||
|`MI_VEL_5` | |Set velocity to 64 |
|
||||
|`MI_VEL_6` | |Set velocity to 76 |
|
||||
|`MI_VEL_7` | |Set velocity to 89 |
|
||||
|`MI_VEL_8` | |Set velocity to 102 |
|
||||
|`MI_VEL_9` | |Set velocity to 114 |
|
||||
|`MI_VEL_10` | |Set velocity to 127 |
|
||||
|`MI_VELD` | |Decrease velocity |
|
||||
|`MI_VELU` | |Increase velocity |
|
||||
|`MI_CH1` | |Set channel to 1 |
|
||||
|`MI_CH2` | |Set channel to 2 |
|
||||
|`MI_CH3` | |Set channel to 3 |
|
||||
|`MI_CH4` | |Set channel to 4 |
|
||||
|`MI_CH5` | |Set channel to 5 |
|
||||
|`MI_CH6` | |Set channel to 6 |
|
||||
|`MI_CH7` | |Set channel to 7 |
|
||||
|`MI_CH8` | |Set channel to 8 |
|
||||
|`MI_CH9` | |Set channel to 9 |
|
||||
|`MI_CH10` | |Set channel to 10 |
|
||||
|`MI_CH11` | |Set channel to 11 |
|
||||
|`MI_CH12` | |Set channel to 12 |
|
||||
|`MI_CH13` | |Set channel to 13 |
|
||||
|`MI_CH14` | |Set channel to 14 |
|
||||
|`MI_CH15` | |Set channel to 15 |
|
||||
|`MI_CH16` | |Set channel to 16 |
|
||||
|`MI_CHD` | |Decrease channel |
|
||||
|`MI_CHU` | |Increase channel |
|
||||
|`MI_ALLOFF` | |Stop all notes |
|
||||
|`MI_SUS` | |Sustain |
|
||||
|`MI_PORT` | |Portmento |
|
||||
|`MI_SOST` | |Sostenuto |
|
||||
|`MI_SOFT` | |Soft Pedal |
|
||||
|`MI_LEG` | |Legato |
|
||||
|`MI_MOD` | |Modulation |
|
||||
|`MI_MODSD` | |Decrease modulation speed |
|
||||
|`MI_MODSU` | |Increase modulation speed |
|
||||
|`MI_BENDD` | |Bend pitch down |
|
||||
|`MI_BENDU` | |Bend pitch up |
|
||||
|
||||
## Mouse Keys :id=mouse-keys
|
||||
|
||||
See also: [Mouse Keys](feature_mouse_keys.md)
|
||||
|
@@ -19,7 +19,7 @@ You can control the behavior of one shot keys by defining these in `config.h`:
|
||||
* `OSL(layer)` - momentary switch to *layer*.
|
||||
* `OS_ON` - Turns on One Shot keys.
|
||||
* `OS_OFF` - Turns off One Shot keys. OSM act as regular mod keys, OSL act like `MO`.
|
||||
* `ON_TOGG` - Toggles the one shot key status.
|
||||
* `OS_TOGG` - Toggles the one shot key status.
|
||||
|
||||
Sometimes, you want to activate a one-shot key as part of a macro or tap dance routine.
|
||||
|
||||
|
@@ -65,14 +65,17 @@ Now, we will set up the MSYS2 window to show up in VSCode as the integrated term
|
||||
|
||||
```json
|
||||
{
|
||||
"terminal.integrated.shell.windows": "C:\\msys64\\usr\\bin\\bash.exe",
|
||||
"terminal.integrated.env.windows": {
|
||||
"MSYSTEM": "MINGW64",
|
||||
"CHERE_INVOKING": "1"
|
||||
"terminal.integrated.profiles.windows": {
|
||||
"QMK_MSYS": {
|
||||
"path": "C:/QMK_MSYS/usr/bin/bash.exe",
|
||||
"env": {
|
||||
"MSYSTEM": "MINGW64",
|
||||
"CHERE_INVOKING": "1"
|
||||
},
|
||||
"args": ["--login"]
|
||||
}
|
||||
},
|
||||
"terminal.integrated.shellArgs.windows": [
|
||||
"--login"
|
||||
],
|
||||
|
||||
"terminal.integrated.cursorStyle": "line"
|
||||
}
|
||||
```
|
||||
|
@@ -68,7 +68,7 @@ https://github.com/qmk/qmk_firmware/pulls?q=is%3Apr+is%3Aclosed+label%3Akeyboard
|
||||
- bare minimum required code for a board to boot into QMK should be present
|
||||
- initialisation code for the matrix and critical devices
|
||||
- mirroring existing functionality of a commercial board (like custom keycodes and special animations etc.) should be handled through non-`default` keymaps
|
||||
- VIAL-related files or changes will not be accepted, as they are not used by QMK firmware (no VIAL-specific core code has been submitted or merged)
|
||||
- Vial-related files or changes will not be accepted, as they are not used by QMK firmware (no Vial-specific core code has been submitted or merged)
|
||||
- `keyboard.c`
|
||||
- empty `xxxx_xxxx_kb()` or other weak-defined default implemented functions removed
|
||||
- commented-out functions removed too
|
||||
@@ -93,6 +93,7 @@ https://github.com/qmk/qmk_firmware/pulls?q=is%3Apr+is%3Aclosed+label%3Akeyboard
|
||||
- default (and via) keymaps should be "pristine"
|
||||
- bare minimum to be used as a "clean slate" for another user to develop their own user-specific keymap
|
||||
- standard layouts preferred in these keymaps, if possible
|
||||
- default keymap should not enable VIA -- the VIA integration documentation requires a keymap called `via`
|
||||
- submitters can have a personal (or bells-and-whistles) keymap showcasing capabilities in the same PR but it shouldn't be embedded in the 'default' keymap
|
||||
- submitters can also have a "manufacturer-matching" keymap that mirrors existing functionality of the commercial product, if porting an existing board
|
||||
- Do not include VIA json files in the PR. These do not belong in the QMK repository as they are not used by QMK firmware -- they belong in the [VIA Keyboard Repo](https://github.com/the-via/keyboards)
|
||||
|
@@ -36,12 +36,20 @@ Note how there's several different tests, each mocking out a separate part. Also
|
||||
|
||||
## Running the Tests
|
||||
|
||||
To run all the tests in the codebase, type `make test`. You can also run test matching a substring by typing `make test:matchingsubstring` Note that the tests are always compiled with the native compiler of your platform, so they are also run like any other program on your computer.
|
||||
To run all the tests in the codebase, type `make test:all`. You can also run test matching a substring by typing `make test:matchingsubstring` Note that the tests are always compiled with the native compiler of your platform, so they are also run like any other program on your computer.
|
||||
|
||||
## Debugging the Tests
|
||||
|
||||
If there are problems with the tests, you can find the executable in the `./build/test` folder. You should be able to run those with GDB or a similar debugger.
|
||||
|
||||
To forward any [debug messages](unit_testing.md#debug-api) to `stderr`, the tests can run with `DEBUG=1`. For example
|
||||
|
||||
```console
|
||||
make test:all DEBUG=1
|
||||
```
|
||||
|
||||
Alternatively, add `CONSOLE_ENABLE=yes` to the tests `rules.mk`.
|
||||
|
||||
## Full Integration Tests
|
||||
|
||||
It's not yet possible to do a full integration test, where you would compile the whole firmware and define a keymap that you are going to test. However there are plans for doing that, because writing tests that way would probably be easier, at least for people that are not used to unit testing.
|
||||
|
@@ -28,14 +28,8 @@
|
||||
# define F_SCL 400000UL // SCL frequency
|
||||
#endif
|
||||
|
||||
#ifndef I2C_START_RETRY_COUNT
|
||||
# define I2C_START_RETRY_COUNT 20
|
||||
#endif // I2C_START_RETRY_COUNT
|
||||
|
||||
#define TWBR_val (((F_CPU / F_SCL) - 16) / 2)
|
||||
|
||||
#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
|
||||
|
||||
void i2c_init(void) {
|
||||
TWSR = 0; /* no prescaler */
|
||||
TWBR = (uint8_t)TWBR_val;
|
||||
@@ -53,7 +47,7 @@ void i2c_init(void) {
|
||||
#endif
|
||||
}
|
||||
|
||||
static i2c_status_t i2c_start_impl(uint8_t address, uint16_t timeout) {
|
||||
i2c_status_t i2c_start(uint8_t address, uint16_t timeout) {
|
||||
// reset TWI control register
|
||||
TWCR = 0;
|
||||
// transmit START condition
|
||||
@@ -92,17 +86,6 @@ static i2c_status_t i2c_start_impl(uint8_t address, uint16_t timeout) {
|
||||
return I2C_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
i2c_status_t i2c_start(uint8_t address, uint16_t timeout) {
|
||||
// Retry i2c_start_impl a bunch times in case the remote side has interrupts disabled.
|
||||
uint16_t timeout_timer = timer_read();
|
||||
uint16_t time_slice = MAX(1, (timeout == (I2C_TIMEOUT_INFINITE)) ? 5 : (timeout / (I2C_START_RETRY_COUNT))); // if it's infinite, wait 1ms between attempts, otherwise split up the entire timeout into the number of retries
|
||||
i2c_status_t status;
|
||||
do {
|
||||
status = i2c_start_impl(address, time_slice);
|
||||
} while ((status < 0) && ((timeout == I2C_TIMEOUT_INFINITE) || (timer_elapsed(timeout_timer) < timeout)));
|
||||
return status;
|
||||
}
|
||||
|
||||
i2c_status_t i2c_write(uint8_t data, uint16_t timeout) {
|
||||
// load data into data register
|
||||
TWDR = data;
|
||||
|
@@ -17,7 +17,6 @@
|
||||
* GitHub repository: https://github.com/g4lvanix/I2C-slave-lib
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <avr/io.h>
|
||||
#include <util/twi.h>
|
||||
#include <avr/interrupt.h>
|
||||
@@ -25,12 +24,6 @@
|
||||
|
||||
#include "i2c_slave.h"
|
||||
|
||||
#if defined(USE_I2C) && defined(SPLIT_COMMON_TRANSACTIONS)
|
||||
# include "transactions.h"
|
||||
|
||||
static volatile bool is_callback_executor = false;
|
||||
#endif // defined(USE_I2C) && defined(SPLIT_COMMON_TRANSACTIONS)
|
||||
|
||||
volatile uint8_t i2c_slave_reg[I2C_SLAVE_REG_COUNT];
|
||||
|
||||
static volatile uint8_t buffer_address;
|
||||
@@ -55,14 +48,11 @@ ISR(TWI_vect) {
|
||||
case TW_SR_SLA_ACK:
|
||||
// The device is now a slave receiver
|
||||
slave_has_register_set = false;
|
||||
#if defined(USE_I2C) && defined(SPLIT_COMMON_TRANSACTIONS)
|
||||
is_callback_executor = false;
|
||||
#endif // defined(USE_I2C) && defined(SPLIT_COMMON_TRANSACTIONS)
|
||||
break;
|
||||
|
||||
case TW_SR_DATA_ACK:
|
||||
// This device is a slave receiver and has received data
|
||||
// First byte is the location then the bytes will be writen in buffer with auto-increment
|
||||
// First byte is the location then the bytes will be writen in buffer with auto-incriment
|
||||
if (!slave_has_register_set) {
|
||||
buffer_address = TWDR;
|
||||
|
||||
@@ -70,25 +60,10 @@ ISR(TWI_vect) {
|
||||
ack = 0;
|
||||
buffer_address = 0;
|
||||
}
|
||||
slave_has_register_set = true; // address has been received now fill in buffer
|
||||
|
||||
#if defined(USE_I2C) && defined(SPLIT_COMMON_TRANSACTIONS)
|
||||
// Work out if we're attempting to execute a callback
|
||||
is_callback_executor = buffer_address == split_transaction_table[I2C_EXECUTE_CALLBACK].initiator2target_offset;
|
||||
#endif // defined(USE_I2C) && defined(SPLIT_COMMON_TRANSACTIONS)
|
||||
slave_has_register_set = true; // address has been receaved now fill in buffer
|
||||
} else {
|
||||
i2c_slave_reg[buffer_address] = TWDR;
|
||||
buffer_address++;
|
||||
|
||||
#if defined(USE_I2C) && defined(SPLIT_COMMON_TRANSACTIONS)
|
||||
// If we're intending to execute a transaction callback, do so, as we've just received the transaction ID
|
||||
if (is_callback_executor) {
|
||||
split_transaction_desc_t *trans = &split_transaction_table[split_shmem->transaction_id];
|
||||
if (trans->slave_callback) {
|
||||
trans->slave_callback(trans->initiator2target_buffer_size, split_trans_initiator2target_buffer(trans), trans->target2initiator_buffer_size, split_trans_target2initiator_buffer(trans));
|
||||
}
|
||||
}
|
||||
#endif // defined(USE_I2C) && defined(SPLIT_COMMON_TRANSACTIONS)
|
||||
}
|
||||
break;
|
||||
|
||||
|
@@ -22,18 +22,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef I2C_SLAVE_REG_COUNT
|
||||
|
||||
# if defined(USE_I2C) && defined(SPLIT_COMMON_TRANSACTIONS)
|
||||
# include "transport.h"
|
||||
# define I2C_SLAVE_REG_COUNT sizeof(split_shared_memory_t)
|
||||
# else // defined(USE_I2C) && defined(SPLIT_COMMON_TRANSACTIONS)
|
||||
# define I2C_SLAVE_REG_COUNT 30
|
||||
# endif // defined(USE_I2C) && defined(SPLIT_COMMON_TRANSACTIONS)
|
||||
|
||||
#endif // I2C_SLAVE_REG_COUNT
|
||||
|
||||
_Static_assert(I2C_SLAVE_REG_COUNT < 256, "I2C target registers must be single byte");
|
||||
#define I2C_SLAVE_REG_COUNT 30
|
||||
|
||||
extern volatile uint8_t i2c_slave_reg[I2C_SLAVE_REG_COUNT];
|
||||
|
||||
|
@@ -224,8 +224,15 @@
|
||||
# define SERIAL_DELAY_HALF2 (SERIAL_DELAY - SERIAL_DELAY / 2)
|
||||
|
||||
# define SLAVE_INT_WIDTH_US 1
|
||||
# define SLAVE_INT_ACK_WIDTH_UNIT 2
|
||||
# define SLAVE_INT_ACK_WIDTH 4
|
||||
# ifndef SERIAL_USE_MULTI_TRANSACTION
|
||||
# define SLAVE_INT_RESPONSE_TIME SERIAL_DELAY
|
||||
# else
|
||||
# define SLAVE_INT_ACK_WIDTH_UNIT 2
|
||||
# define SLAVE_INT_ACK_WIDTH 4
|
||||
# endif
|
||||
|
||||
static SSTD_t *Transaction_table = NULL;
|
||||
static uint8_t Transaction_table_size = 0;
|
||||
|
||||
inline static void serial_delay(void) ALWAYS_INLINE;
|
||||
inline static void serial_delay(void) { _delay_us(SERIAL_DELAY); }
|
||||
@@ -252,12 +259,16 @@ inline static void serial_low(void) { writePinLow(SOFT_SERIAL_PIN); }
|
||||
inline static void serial_high(void) ALWAYS_INLINE;
|
||||
inline static void serial_high(void) { writePinHigh(SOFT_SERIAL_PIN); }
|
||||
|
||||
void soft_serial_initiator_init(void) {
|
||||
void soft_serial_initiator_init(SSTD_t *sstd_table, int sstd_table_size) {
|
||||
Transaction_table = sstd_table;
|
||||
Transaction_table_size = (uint8_t)sstd_table_size;
|
||||
serial_output();
|
||||
serial_high();
|
||||
}
|
||||
|
||||
void soft_serial_target_init(void) {
|
||||
void soft_serial_target_init(SSTD_t *sstd_table, int sstd_table_size) {
|
||||
Transaction_table = sstd_table;
|
||||
Transaction_table_size = (uint8_t)sstd_table_size;
|
||||
serial_input_with_pullup();
|
||||
|
||||
// Enable INT0-INT7
|
||||
@@ -384,14 +395,19 @@ static inline uint8_t nibble_bits_count(uint8_t bits) {
|
||||
|
||||
// interrupt handle to be used by the target device
|
||||
ISR(SERIAL_PIN_INTERRUPT) {
|
||||
# ifndef SERIAL_USE_MULTI_TRANSACTION
|
||||
serial_low();
|
||||
serial_output();
|
||||
SSTD_t *trans = Transaction_table;
|
||||
# else
|
||||
// recive transaction table index
|
||||
uint8_t tid, bits;
|
||||
uint8_t pecount = 0;
|
||||
sync_recv();
|
||||
bits = serial_read_chunk(&pecount, 8);
|
||||
bits = serial_read_chunk(&pecount, 7);
|
||||
tid = bits >> 3;
|
||||
bits = (bits & 7) != (nibble_bits_count(tid) & 7);
|
||||
if (bits || pecount > 0 || tid > NUM_TOTAL_TRANSACTIONS) {
|
||||
bits = (bits & 7) != nibble_bits_count(tid);
|
||||
if (bits || pecount > 0 || tid > Transaction_table_size) {
|
||||
return;
|
||||
}
|
||||
serial_delay_half1();
|
||||
@@ -399,22 +415,18 @@ ISR(SERIAL_PIN_INTERRUPT) {
|
||||
serial_high(); // response step1 low->high
|
||||
serial_output();
|
||||
_delay_sub_us(SLAVE_INT_ACK_WIDTH_UNIT * SLAVE_INT_ACK_WIDTH);
|
||||
split_transaction_desc_t *trans = &split_transaction_table[tid];
|
||||
SSTD_t *trans = &Transaction_table[tid];
|
||||
serial_low(); // response step2 ack high->low
|
||||
|
||||
// If the transaction has a callback, we can execute it now
|
||||
if (trans->slave_callback) {
|
||||
trans->slave_callback(trans->initiator2target_buffer_size, split_trans_initiator2target_buffer(trans), trans->target2initiator_buffer_size, split_trans_target2initiator_buffer(trans));
|
||||
}
|
||||
# endif
|
||||
|
||||
// target send phase
|
||||
if (trans->target2initiator_buffer_size > 0) serial_send_packet((uint8_t *)split_trans_target2initiator_buffer(trans), trans->target2initiator_buffer_size);
|
||||
if (trans->target2initiator_buffer_size > 0) serial_send_packet((uint8_t *)trans->target2initiator_buffer, trans->target2initiator_buffer_size);
|
||||
// target switch to input
|
||||
change_sender2reciver();
|
||||
|
||||
// target recive phase
|
||||
if (trans->initiator2target_buffer_size > 0) {
|
||||
if (serial_recive_packet((uint8_t *)split_trans_initiator2target_buffer(trans), trans->initiator2target_buffer_size)) {
|
||||
if (serial_recive_packet((uint8_t *)trans->initiator2target_buffer, trans->initiator2target_buffer_size)) {
|
||||
*trans->status = TRANSACTION_ACCEPTED;
|
||||
} else {
|
||||
*trans->status = TRANSACTION_DATA_ERROR;
|
||||
@@ -436,12 +448,14 @@ ISR(SERIAL_PIN_INTERRUPT) {
|
||||
// TRANSACTION_NO_RESPONSE
|
||||
// TRANSACTION_DATA_ERROR
|
||||
// this code is very time dependent, so we need to disable interrupts
|
||||
# ifndef SERIAL_USE_MULTI_TRANSACTION
|
||||
int soft_serial_transaction(void) {
|
||||
SSTD_t *trans = Transaction_table;
|
||||
# else
|
||||
int soft_serial_transaction(int sstd_index) {
|
||||
if (sstd_index > NUM_TOTAL_TRANSACTIONS) return TRANSACTION_TYPE_ERROR;
|
||||
split_transaction_desc_t *trans = &split_transaction_table[sstd_index];
|
||||
|
||||
if (!trans->status) return TRANSACTION_TYPE_ERROR; // not registered
|
||||
|
||||
if (sstd_index > Transaction_table_size) return TRANSACTION_TYPE_ERROR;
|
||||
SSTD_t *trans = &Transaction_table[sstd_index];
|
||||
# endif
|
||||
cli();
|
||||
|
||||
// signal to the target that we want to start a transaction
|
||||
@@ -449,11 +463,27 @@ int soft_serial_transaction(int sstd_index) {
|
||||
serial_low();
|
||||
_delay_us(SLAVE_INT_WIDTH_US);
|
||||
|
||||
# ifndef SERIAL_USE_MULTI_TRANSACTION
|
||||
// wait for the target response
|
||||
serial_input_with_pullup();
|
||||
_delay_us(SLAVE_INT_RESPONSE_TIME);
|
||||
|
||||
// check if the target is present
|
||||
if (serial_read_pin()) {
|
||||
// target failed to pull the line low, assume not present
|
||||
serial_output();
|
||||
serial_high();
|
||||
*trans->status = TRANSACTION_NO_RESPONSE;
|
||||
sei();
|
||||
return TRANSACTION_NO_RESPONSE;
|
||||
}
|
||||
|
||||
# else
|
||||
// send transaction table index
|
||||
int tid = (sstd_index << 3) | (7 & nibble_bits_count(sstd_index));
|
||||
sync_send();
|
||||
_delay_sub_us(TID_SEND_ADJUST);
|
||||
serial_write_chunk(tid, 8);
|
||||
serial_write_chunk(tid, 7);
|
||||
serial_delay_half1();
|
||||
|
||||
// wait for the target response (step1 low->high)
|
||||
@@ -474,11 +504,12 @@ int soft_serial_transaction(int sstd_index) {
|
||||
}
|
||||
_delay_sub_us(SLAVE_INT_ACK_WIDTH_UNIT);
|
||||
}
|
||||
# endif
|
||||
|
||||
// initiator recive phase
|
||||
// if the target is present syncronize with it
|
||||
if (trans->target2initiator_buffer_size > 0) {
|
||||
if (!serial_recive_packet((uint8_t *)split_trans_target2initiator_buffer(trans), trans->target2initiator_buffer_size)) {
|
||||
if (!serial_recive_packet((uint8_t *)trans->target2initiator_buffer, trans->target2initiator_buffer_size)) {
|
||||
serial_output();
|
||||
serial_high();
|
||||
*trans->status = TRANSACTION_DATA_ERROR;
|
||||
@@ -492,7 +523,7 @@ int soft_serial_transaction(int sstd_index) {
|
||||
|
||||
// initiator send phase
|
||||
if (trans->initiator2target_buffer_size > 0) {
|
||||
serial_send_packet((uint8_t *)split_trans_initiator2target_buffer(trans), trans->initiator2target_buffer_size);
|
||||
serial_send_packet((uint8_t *)trans->initiator2target_buffer, trans->initiator2target_buffer_size);
|
||||
}
|
||||
|
||||
// always, release the line when not in use
|
||||
@@ -503,8 +534,9 @@ int soft_serial_transaction(int sstd_index) {
|
||||
return TRANSACTION_END;
|
||||
}
|
||||
|
||||
# ifdef SERIAL_USE_MULTI_TRANSACTION
|
||||
int soft_serial_get_and_clean_status(int sstd_index) {
|
||||
split_transaction_desc_t *trans = &split_transaction_table[sstd_index];
|
||||
SSTD_t *trans = &Transaction_table[sstd_index];
|
||||
cli();
|
||||
int retval = *trans->status;
|
||||
*trans->status = 0;
|
||||
@@ -512,6 +544,8 @@ int soft_serial_get_and_clean_status(int sstd_index) {
|
||||
sei();
|
||||
return retval;
|
||||
}
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
// Helix serial.c history
|
||||
|
62
drivers/avr/serial.h
Normal file
62
drivers/avr/serial.h
Normal file
@@ -0,0 +1,62 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
// /////////////////////////////////////////////////////////////////
|
||||
// Need Soft Serial defines in config.h
|
||||
// /////////////////////////////////////////////////////////////////
|
||||
// ex.
|
||||
// #define SOFT_SERIAL_PIN ?? // ?? = D0,D1,D2,D3,E6
|
||||
// OPTIONAL: #define SELECT_SOFT_SERIAL_SPEED ? // ? = 1,2,3,4,5
|
||||
// // 1: about 137kbps (default)
|
||||
// // 2: about 75kbps
|
||||
// // 3: about 39kbps
|
||||
// // 4: about 26kbps
|
||||
// // 5: about 20kbps
|
||||
//
|
||||
// //// USE simple API (using signle-type transaction function)
|
||||
// /* nothing */
|
||||
// //// USE flexible API (using multi-type transaction function)
|
||||
// #define SERIAL_USE_MULTI_TRANSACTION
|
||||
//
|
||||
// /////////////////////////////////////////////////////////////////
|
||||
|
||||
// Soft Serial Transaction Descriptor
|
||||
typedef struct _SSTD_t {
|
||||
uint8_t *status;
|
||||
uint8_t initiator2target_buffer_size;
|
||||
uint8_t *initiator2target_buffer;
|
||||
uint8_t target2initiator_buffer_size;
|
||||
uint8_t *target2initiator_buffer;
|
||||
} SSTD_t;
|
||||
#define TID_LIMIT(table) (sizeof(table) / sizeof(SSTD_t))
|
||||
|
||||
// initiator is transaction start side
|
||||
void soft_serial_initiator_init(SSTD_t *sstd_table, int sstd_table_size);
|
||||
// target is interrupt accept side
|
||||
void soft_serial_target_init(SSTD_t *sstd_table, int sstd_table_size);
|
||||
|
||||
// initiator resullt
|
||||
#define TRANSACTION_END 0
|
||||
#define TRANSACTION_NO_RESPONSE 0x1
|
||||
#define TRANSACTION_DATA_ERROR 0x2
|
||||
#define TRANSACTION_TYPE_ERROR 0x4
|
||||
#ifndef SERIAL_USE_MULTI_TRANSACTION
|
||||
int soft_serial_transaction(void);
|
||||
#else
|
||||
int soft_serial_transaction(int sstd_index);
|
||||
#endif
|
||||
|
||||
// target status
|
||||
// *SSTD_t.status has
|
||||
// initiator:
|
||||
// TRANSACTION_END
|
||||
// or TRANSACTION_NO_RESPONSE
|
||||
// or TRANSACTION_DATA_ERROR
|
||||
// target:
|
||||
// TRANSACTION_DATA_ERROR
|
||||
// or TRANSACTION_ACCEPTED
|
||||
#define TRANSACTION_ACCEPTED 0x8
|
||||
#ifdef SERIAL_USE_MULTI_TRANSACTION
|
||||
int soft_serial_get_and_clean_status(int sstd_index);
|
||||
#endif
|
@@ -1,166 +0,0 @@
|
||||
/* Copyright 2021 Jasper Chan
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "aw20216.h"
|
||||
#include "spi_master.h"
|
||||
|
||||
/* The AW20216 appears to be somewhat similar to the IS31FL743, although quite
|
||||
* a few things are different, such as the command byte format and page ordering.
|
||||
* The LED addresses start from 0x00 instead of 0x01.
|
||||
*/
|
||||
#define AWINIC_ID 0b1010 << 4
|
||||
|
||||
#define AW_PAGE_FUNCTION 0x00 << 1 // PG0, Function registers
|
||||
#define AW_PAGE_PWM 0x01 << 1 // PG1, LED PWM control
|
||||
#define AW_PAGE_SCALING 0x02 << 1 // PG2, LED current scaling control
|
||||
#define AW_PAGE_PATCHOICE 0x03 << 1 // PG3, Pattern choice?
|
||||
#define AW_PAGE_PWMSCALING 0x04 << 1 // PG4, LED PWM + Scaling control?
|
||||
|
||||
#define AW_WRITE 0
|
||||
#define AW_READ 1
|
||||
|
||||
#define AW_REG_CONFIGURATION 0x00 // PG0
|
||||
#define AW_REG_GLOBALCURRENT 0x01 // PG0
|
||||
|
||||
// Default value of AW_REG_CONFIGURATION
|
||||
// D7:D4 = 1011, SWSEL (SW1~SW12 active)
|
||||
// D3 = 0?, reserved (apparently this should be 1 but it doesn't seem to matter)
|
||||
// D2:D1 = 00, OSDE (open/short detection enable)
|
||||
// D0 = 0, CHIPEN (write 1 to enable LEDs when hardware enable pulled high)
|
||||
#define AW_CONFIG_DEFAULT 0b10110000
|
||||
#define AW_CHIPEN 1
|
||||
|
||||
#ifndef AW_SCALING_MAX
|
||||
# define AW_SCALING_MAX 150
|
||||
#endif
|
||||
|
||||
#ifndef AW_GLOBAL_CURRENT_MAX
|
||||
# define AW_GLOBAL_CURRENT_MAX 150
|
||||
#endif
|
||||
|
||||
#ifndef DRIVER_1_CS
|
||||
# define DRIVER_1_CS B13
|
||||
#endif
|
||||
|
||||
#ifndef DRIVER_1_EN
|
||||
# define DRIVER_1_EN C13
|
||||
#endif
|
||||
|
||||
uint8_t g_spi_transfer_buffer[20] = {0};
|
||||
aw_led g_pwm_buffer[DRIVER_LED_TOTAL];
|
||||
bool g_pwm_buffer_update_required[DRIVER_LED_TOTAL];
|
||||
|
||||
bool AW20216_write_register(pin_t slave_pin, uint8_t page, uint8_t reg, uint8_t data) {
|
||||
// Do we need to call spi_stop() if this fails?
|
||||
if (!spi_start(slave_pin, false, 0, 16)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
g_spi_transfer_buffer[0] = (AWINIC_ID | page | AW_WRITE);
|
||||
g_spi_transfer_buffer[1] = reg;
|
||||
g_spi_transfer_buffer[2] = data;
|
||||
|
||||
if (spi_transmit(g_spi_transfer_buffer, 3) != SPI_STATUS_SUCCESS) {
|
||||
spi_stop();
|
||||
return false;
|
||||
}
|
||||
spi_stop();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AW20216_init_scaling(void) {
|
||||
// Set constant current to the max, control brightness with PWM
|
||||
aw_led led;
|
||||
for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) {
|
||||
led = g_aw_leds[i];
|
||||
if (led.driver == 0) {
|
||||
AW20216_write_register(DRIVER_1_CS, AW_PAGE_SCALING, led.r, AW_SCALING_MAX);
|
||||
AW20216_write_register(DRIVER_1_CS, AW_PAGE_SCALING, led.g, AW_SCALING_MAX);
|
||||
AW20216_write_register(DRIVER_1_CS, AW_PAGE_SCALING, led.b, AW_SCALING_MAX);
|
||||
}
|
||||
#ifdef DRIVER_2_CS
|
||||
else if (led.driver == 1) {
|
||||
AW20216_write_register(DRIVER_2_CS, AW_PAGE_SCALING, led.r, AW_SCALING_MAX);
|
||||
AW20216_write_register(DRIVER_2_CS, AW_PAGE_SCALING, led.g, AW_SCALING_MAX);
|
||||
AW20216_write_register(DRIVER_2_CS, AW_PAGE_SCALING, led.b, AW_SCALING_MAX);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AW20216_soft_enable(void) {
|
||||
AW20216_write_register(DRIVER_1_CS, AW_PAGE_FUNCTION, AW_REG_CONFIGURATION, AW_CONFIG_DEFAULT | AW_CHIPEN);
|
||||
#ifdef DRIVER_2_CS
|
||||
AW20216_write_register(DRIVER_2_CS, AW_PAGE_FUNCTION, AW_REG_CONFIGURATION, AW_CONFIG_DEFAULT | AW_CHIPEN);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
void AW20216_update_pwm(int index, uint8_t red, uint8_t green, uint8_t blue) {
|
||||
aw_led led = g_aw_leds[index];
|
||||
if (led.driver == 0) {
|
||||
AW20216_write_register(DRIVER_1_CS, AW_PAGE_PWM, led.r, red);
|
||||
AW20216_write_register(DRIVER_1_CS, AW_PAGE_PWM, led.g, green);
|
||||
AW20216_write_register(DRIVER_1_CS, AW_PAGE_PWM, led.b, blue);
|
||||
}
|
||||
#ifdef DRIVER_2_CS
|
||||
else if (led.driver == 1) {
|
||||
AW20216_write_register(DRIVER_2_CS, AW_PAGE_PWM, led.r, red);
|
||||
AW20216_write_register(DRIVER_2_CS, AW_PAGE_PWM, led.g, green);
|
||||
AW20216_write_register(DRIVER_2_CS, AW_PAGE_PWM, led.b, blue);
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
void AW20216_init(void) {
|
||||
// All LEDs should start with all scaling and PWM registers as off
|
||||
setPinOutput(DRIVER_1_EN);
|
||||
writePinHigh(DRIVER_1_EN);
|
||||
AW20216_write_register(DRIVER_1_CS, AW_PAGE_FUNCTION, AW_REG_GLOBALCURRENT, AW_GLOBAL_CURRENT_MAX);
|
||||
#ifdef DRIVER_2_EN
|
||||
setPinOutput(DRIVER_2_EN);
|
||||
writePinHigh(DRIVER_2_EN);
|
||||
AW20216_write_register(DRIVER_2_CS, AW_PAGE_FUNCTION, AW_REG_GLOBALCURRENT, AW_GLOBAL_CURRENT_MAX);
|
||||
#endif
|
||||
AW20216_init_scaling();
|
||||
AW20216_soft_enable();
|
||||
return;
|
||||
}
|
||||
|
||||
void AW20216_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
|
||||
g_pwm_buffer[index].r = red;
|
||||
g_pwm_buffer[index].g = green;
|
||||
g_pwm_buffer[index].b = blue;
|
||||
g_pwm_buffer_update_required[index] = true;
|
||||
return;
|
||||
}
|
||||
void AW20216_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
|
||||
for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) {
|
||||
AW20216_set_color(i, red, green, blue);
|
||||
}
|
||||
return;
|
||||
}
|
||||
void AW20216_update_pwm_buffers(void) {
|
||||
for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) {
|
||||
if (g_pwm_buffer_update_required[i]) {
|
||||
AW20216_update_pwm(i, g_pwm_buffer[i].r, g_pwm_buffer[i].g, g_pwm_buffer[i].b);
|
||||
g_pwm_buffer_update_required[i] = false;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
@@ -1,251 +0,0 @@
|
||||
/* Copyright 2021 Jasper Chan (Gigahawk)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef struct aw_led {
|
||||
uint8_t driver : 2;
|
||||
uint8_t r;
|
||||
uint8_t g;
|
||||
uint8_t b;
|
||||
} aw_led;
|
||||
|
||||
extern const aw_led g_aw_leds[DRIVER_LED_TOTAL];
|
||||
|
||||
void AW20216_init(void);
|
||||
void AW20216_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
|
||||
void AW20216_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
|
||||
void AW20216_update_pwm_buffers(void);
|
||||
|
||||
#define CS1_SW1 0x00
|
||||
#define CS2_SW1 0x01
|
||||
#define CS3_SW1 0x02
|
||||
#define CS4_SW1 0x03
|
||||
#define CS5_SW1 0x04
|
||||
#define CS6_SW1 0x05
|
||||
#define CS7_SW1 0x06
|
||||
#define CS8_SW1 0x07
|
||||
#define CS9_SW1 0x08
|
||||
#define CS10_SW1 0x09
|
||||
#define CS11_SW1 0x0A
|
||||
#define CS12_SW1 0x0B
|
||||
#define CS13_SW1 0x0C
|
||||
#define CS14_SW1 0x0D
|
||||
#define CS15_SW1 0x0E
|
||||
#define CS16_SW1 0x0F
|
||||
#define CS17_SW1 0x10
|
||||
#define CS18_SW1 0x11
|
||||
#define CS1_SW2 0x12
|
||||
#define CS2_SW2 0x13
|
||||
#define CS3_SW2 0x14
|
||||
#define CS4_SW2 0x15
|
||||
#define CS5_SW2 0x16
|
||||
#define CS6_SW2 0x17
|
||||
#define CS7_SW2 0x18
|
||||
#define CS8_SW2 0x19
|
||||
#define CS9_SW2 0x1A
|
||||
#define CS10_SW2 0x1B
|
||||
#define CS11_SW2 0x1C
|
||||
#define CS12_SW2 0x1D
|
||||
#define CS13_SW2 0x1E
|
||||
#define CS14_SW2 0x1F
|
||||
#define CS15_SW2 0x20
|
||||
#define CS16_SW2 0x21
|
||||
#define CS17_SW2 0x22
|
||||
#define CS18_SW2 0x23
|
||||
#define CS1_SW3 0x24
|
||||
#define CS2_SW3 0x25
|
||||
#define CS3_SW3 0x26
|
||||
#define CS4_SW3 0x27
|
||||
#define CS5_SW3 0x28
|
||||
#define CS6_SW3 0x29
|
||||
#define CS7_SW3 0x2A
|
||||
#define CS8_SW3 0x2B
|
||||
#define CS9_SW3 0x2C
|
||||
#define CS10_SW3 0x2D
|
||||
#define CS11_SW3 0x2E
|
||||
#define CS12_SW3 0x2F
|
||||
#define CS13_SW3 0x30
|
||||
#define CS14_SW3 0x31
|
||||
#define CS15_SW3 0x32
|
||||
#define CS16_SW3 0x33
|
||||
#define CS17_SW3 0x34
|
||||
#define CS18_SW3 0x35
|
||||
#define CS1_SW4 0x36
|
||||
#define CS2_SW4 0x37
|
||||
#define CS3_SW4 0x38
|
||||
#define CS4_SW4 0x39
|
||||
#define CS5_SW4 0x3A
|
||||
#define CS6_SW4 0x3B
|
||||
#define CS7_SW4 0x3C
|
||||
#define CS8_SW4 0x3D
|
||||
#define CS9_SW4 0x3E
|
||||
#define CS10_SW4 0x3F
|
||||
#define CS11_SW4 0x40
|
||||
#define CS12_SW4 0x41
|
||||
#define CS13_SW4 0x42
|
||||
#define CS14_SW4 0x43
|
||||
#define CS15_SW4 0x44
|
||||
#define CS16_SW4 0x45
|
||||
#define CS17_SW4 0x46
|
||||
#define CS18_SW4 0x47
|
||||
#define CS1_SW5 0x48
|
||||
#define CS2_SW5 0x49
|
||||
#define CS3_SW5 0x4A
|
||||
#define CS4_SW5 0x4B
|
||||
#define CS5_SW5 0x4C
|
||||
#define CS6_SW5 0x4D
|
||||
#define CS7_SW5 0x4E
|
||||
#define CS8_SW5 0x4F
|
||||
#define CS9_SW5 0x50
|
||||
#define CS10_SW5 0x51
|
||||
#define CS11_SW5 0x52
|
||||
#define CS12_SW5 0x53
|
||||
#define CS13_SW5 0x54
|
||||
#define CS14_SW5 0x55
|
||||
#define CS15_SW5 0x56
|
||||
#define CS16_SW5 0x57
|
||||
#define CS17_SW5 0x58
|
||||
#define CS18_SW5 0x59
|
||||
#define CS1_SW6 0x5A
|
||||
#define CS2_SW6 0x5B
|
||||
#define CS3_SW6 0x5C
|
||||
#define CS4_SW6 0x5D
|
||||
#define CS5_SW6 0x5E
|
||||
#define CS6_SW6 0x5F
|
||||
#define CS7_SW6 0x60
|
||||
#define CS8_SW6 0x61
|
||||
#define CS9_SW6 0x62
|
||||
#define CS10_SW6 0x63
|
||||
#define CS11_SW6 0x64
|
||||
#define CS12_SW6 0x65
|
||||
#define CS13_SW6 0x66
|
||||
#define CS14_SW6 0x67
|
||||
#define CS15_SW6 0x68
|
||||
#define CS16_SW6 0x69
|
||||
#define CS17_SW6 0x6A
|
||||
#define CS18_SW6 0x6B
|
||||
#define CS1_SW7 0x6C
|
||||
#define CS2_SW7 0x6D
|
||||
#define CS3_SW7 0x6E
|
||||
#define CS4_SW7 0x6F
|
||||
#define CS5_SW7 0x70
|
||||
#define CS6_SW7 0x71
|
||||
#define CS7_SW7 0x72
|
||||
#define CS8_SW7 0x73
|
||||
#define CS9_SW7 0x74
|
||||
#define CS10_SW7 0x75
|
||||
#define CS11_SW7 0x76
|
||||
#define CS12_SW7 0x77
|
||||
#define CS13_SW7 0x78
|
||||
#define CS14_SW7 0x79
|
||||
#define CS15_SW7 0x7A
|
||||
#define CS16_SW7 0x7B
|
||||
#define CS17_SW7 0x7C
|
||||
#define CS18_SW7 0x7D
|
||||
#define CS1_SW8 0x7E
|
||||
#define CS2_SW8 0x7F
|
||||
#define CS3_SW8 0x80
|
||||
#define CS4_SW8 0x81
|
||||
#define CS5_SW8 0x82
|
||||
#define CS6_SW8 0x83
|
||||
#define CS7_SW8 0x84
|
||||
#define CS8_SW8 0x85
|
||||
#define CS9_SW8 0x86
|
||||
#define CS10_SW8 0x87
|
||||
#define CS11_SW8 0x88
|
||||
#define CS12_SW8 0x89
|
||||
#define CS13_SW8 0x8A
|
||||
#define CS14_SW8 0x8B
|
||||
#define CS15_SW8 0x8C
|
||||
#define CS16_SW8 0x8D
|
||||
#define CS17_SW8 0x8E
|
||||
#define CS18_SW8 0x8F
|
||||
#define CS1_SW9 0x90
|
||||
#define CS2_SW9 0x91
|
||||
#define CS3_SW9 0x92
|
||||
#define CS4_SW9 0x93
|
||||
#define CS5_SW9 0x94
|
||||
#define CS6_SW9 0x95
|
||||
#define CS7_SW9 0x96
|
||||
#define CS8_SW9 0x97
|
||||
#define CS9_SW9 0x98
|
||||
#define CS10_SW9 0x99
|
||||
#define CS11_SW9 0x9A
|
||||
#define CS12_SW9 0x9B
|
||||
#define CS13_SW9 0x9C
|
||||
#define CS14_SW9 0x9D
|
||||
#define CS15_SW9 0x9E
|
||||
#define CS16_SW9 0x9F
|
||||
#define CS17_SW9 0xA0
|
||||
#define CS18_SW9 0xA1
|
||||
#define CS1_SW10 0xA2
|
||||
#define CS2_SW10 0xA3
|
||||
#define CS3_SW10 0xA4
|
||||
#define CS4_SW10 0xA5
|
||||
#define CS5_SW10 0xA6
|
||||
#define CS6_SW10 0xA7
|
||||
#define CS7_SW10 0xA8
|
||||
#define CS8_SW10 0xA9
|
||||
#define CS9_SW10 0xAA
|
||||
#define CS10_SW10 0xAB
|
||||
#define CS11_SW10 0xAC
|
||||
#define CS12_SW10 0xAD
|
||||
#define CS13_SW10 0xAE
|
||||
#define CS14_SW10 0xAF
|
||||
#define CS15_SW10 0xB0
|
||||
#define CS16_SW10 0xB1
|
||||
#define CS17_SW10 0xB2
|
||||
#define CS18_SW10 0xB3
|
||||
#define CS1_SW11 0xB4
|
||||
#define CS2_SW11 0xB5
|
||||
#define CS3_SW11 0xB6
|
||||
#define CS4_SW11 0xB7
|
||||
#define CS5_SW11 0xB8
|
||||
#define CS6_SW11 0xB9
|
||||
#define CS7_SW11 0xBA
|
||||
#define CS8_SW11 0xBB
|
||||
#define CS9_SW11 0xBC
|
||||
#define CS10_SW11 0xBD
|
||||
#define CS11_SW11 0xBE
|
||||
#define CS12_SW11 0xBF
|
||||
#define CS13_SW11 0xC0
|
||||
#define CS14_SW11 0xC1
|
||||
#define CS15_SW11 0xC2
|
||||
#define CS16_SW11 0xC3
|
||||
#define CS17_SW11 0xC4
|
||||
#define CS18_SW11 0xC5
|
||||
#define CS1_SW12 0xC6
|
||||
#define CS2_SW12 0xC7
|
||||
#define CS3_SW12 0xC8
|
||||
#define CS4_SW12 0xC9
|
||||
#define CS5_SW12 0xCA
|
||||
#define CS6_SW12 0xCB
|
||||
#define CS7_SW12 0xCC
|
||||
#define CS8_SW12 0xCD
|
||||
#define CS9_SW12 0xCE
|
||||
#define CS10_SW12 0xCF
|
||||
#define CS11_SW12 0xD0
|
||||
#define CS12_SW12 0xD1
|
||||
#define CS13_SW12 0xD2
|
||||
#define CS14_SW12 0xD3
|
||||
#define CS15_SW12 0xD4
|
||||
#define CS16_SW12 0xD5
|
||||
#define CS17_SW12 0xD6
|
||||
#define CS18_SW12 0xD7
|
@@ -74,12 +74,21 @@ static THD_FUNCTION(Thread1, arg) {
|
||||
}
|
||||
}
|
||||
|
||||
void soft_serial_initiator_init(void) {
|
||||
static SSTD_t *Transaction_table = NULL;
|
||||
static uint8_t Transaction_table_size = 0;
|
||||
|
||||
void soft_serial_initiator_init(SSTD_t *sstd_table, int sstd_table_size) {
|
||||
Transaction_table = sstd_table;
|
||||
Transaction_table_size = (uint8_t)sstd_table_size;
|
||||
|
||||
serial_output();
|
||||
serial_high();
|
||||
}
|
||||
|
||||
void soft_serial_target_init(void) {
|
||||
void soft_serial_target_init(SSTD_t *sstd_table, int sstd_table_size) {
|
||||
Transaction_table = sstd_table;
|
||||
Transaction_table_size = (uint8_t)sstd_table_size;
|
||||
|
||||
serial_input();
|
||||
|
||||
palEnablePadEvent(PAL_PORT(SOFT_SERIAL_PIN), PAL_PAD(SOFT_SERIAL_PIN), PAL_EVENT_MODE_FALLING_EDGE);
|
||||
@@ -145,14 +154,16 @@ void interrupt_handler(void *arg) {
|
||||
uint8_t checksum_computed = 0;
|
||||
int sstd_index = 0;
|
||||
|
||||
#ifdef SERIAL_USE_MULTI_TRANSACTION
|
||||
sstd_index = serial_read_byte();
|
||||
sync_send();
|
||||
#endif
|
||||
|
||||
split_transaction_desc_t *trans = &split_transaction_table[sstd_index];
|
||||
SSTD_t *trans = &Transaction_table[sstd_index];
|
||||
for (int i = 0; i < trans->initiator2target_buffer_size; ++i) {
|
||||
split_trans_initiator2target_buffer(trans)[i] = serial_read_byte();
|
||||
trans->initiator2target_buffer[i] = serial_read_byte();
|
||||
sync_send();
|
||||
checksum_computed += split_trans_initiator2target_buffer(trans)[i];
|
||||
checksum_computed += trans->initiator2target_buffer[i];
|
||||
}
|
||||
checksum_computed ^= 7;
|
||||
uint8_t checksum_received = serial_read_byte();
|
||||
@@ -161,17 +172,12 @@ void interrupt_handler(void *arg) {
|
||||
// wait for the sync to finish sending
|
||||
serial_delay();
|
||||
|
||||
// Allow any slave processing to occur
|
||||
if (trans->slave_callback) {
|
||||
trans->slave_callback(trans->initiator2target_buffer_size, split_trans_initiator2target_buffer(trans), trans->target2initiator_buffer_size, split_trans_target2initiator_buffer(trans));
|
||||
}
|
||||
|
||||
uint8_t checksum = 0;
|
||||
for (int i = 0; i < trans->target2initiator_buffer_size; ++i) {
|
||||
serial_write_byte(split_trans_target2initiator_buffer(trans)[i]);
|
||||
serial_write_byte(trans->target2initiator_buffer[i]);
|
||||
sync_send();
|
||||
serial_delay_half();
|
||||
checksum += split_trans_target2initiator_buffer(trans)[i];
|
||||
checksum += trans->target2initiator_buffer[i];
|
||||
}
|
||||
serial_write_byte(checksum ^ 7);
|
||||
sync_send();
|
||||
@@ -200,10 +206,15 @@ void interrupt_handler(void *arg) {
|
||||
// TRANSACTION_NO_RESPONSE
|
||||
// TRANSACTION_DATA_ERROR
|
||||
// this code is very time dependent, so we need to disable interrupts
|
||||
#ifndef SERIAL_USE_MULTI_TRANSACTION
|
||||
int soft_serial_transaction(void) {
|
||||
int sstd_index = 0;
|
||||
#else
|
||||
int soft_serial_transaction(int sstd_index) {
|
||||
if (sstd_index > NUM_TOTAL_TRANSACTIONS) return TRANSACTION_TYPE_ERROR;
|
||||
split_transaction_desc_t *trans = &split_transaction_table[sstd_index];
|
||||
if (!trans->status) return TRANSACTION_TYPE_ERROR; // not registered
|
||||
#endif
|
||||
|
||||
if (sstd_index > Transaction_table_size) return TRANSACTION_TYPE_ERROR;
|
||||
SSTD_t *trans = &Transaction_table[sstd_index];
|
||||
|
||||
// TODO: remove extra delay between transactions
|
||||
serial_delay();
|
||||
@@ -233,13 +244,14 @@ int soft_serial_transaction(int sstd_index) {
|
||||
|
||||
uint8_t checksum = 0;
|
||||
// send data to the slave
|
||||
#ifdef SERIAL_USE_MULTI_TRANSACTION
|
||||
serial_write_byte(sstd_index); // first chunk is transaction id
|
||||
sync_recv();
|
||||
|
||||
#endif
|
||||
for (int i = 0; i < trans->initiator2target_buffer_size; ++i) {
|
||||
serial_write_byte(split_trans_initiator2target_buffer(trans)[i]);
|
||||
serial_write_byte(trans->initiator2target_buffer[i]);
|
||||
sync_recv();
|
||||
checksum += split_trans_initiator2target_buffer(trans)[i];
|
||||
checksum += trans->initiator2target_buffer[i];
|
||||
}
|
||||
serial_write_byte(checksum ^ 7);
|
||||
sync_recv();
|
||||
@@ -250,9 +262,9 @@ int soft_serial_transaction(int sstd_index) {
|
||||
// receive data from the slave
|
||||
uint8_t checksum_computed = 0;
|
||||
for (int i = 0; i < trans->target2initiator_buffer_size; ++i) {
|
||||
split_trans_target2initiator_buffer(trans)[i] = serial_read_byte();
|
||||
trans->target2initiator_buffer[i] = serial_read_byte();
|
||||
sync_recv();
|
||||
checksum_computed += split_trans_target2initiator_buffer(trans)[i];
|
||||
checksum_computed += trans->target2initiator_buffer[i];
|
||||
}
|
||||
checksum_computed ^= 7;
|
||||
uint8_t checksum_received = serial_read_byte();
|
||||
|
62
drivers/chibios/serial.h
Normal file
62
drivers/chibios/serial.h
Normal file
@@ -0,0 +1,62 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
// /////////////////////////////////////////////////////////////////
|
||||
// Need Soft Serial defines in config.h
|
||||
// /////////////////////////////////////////////////////////////////
|
||||
// ex.
|
||||
// #define SOFT_SERIAL_PIN ?? // ?? = D0,D1,D2,D3,E6
|
||||
// OPTIONAL: #define SELECT_SOFT_SERIAL_SPEED ? // ? = 1,2,3,4,5
|
||||
// // 1: about 137kbps (default)
|
||||
// // 2: about 75kbps
|
||||
// // 3: about 39kbps
|
||||
// // 4: about 26kbps
|
||||
// // 5: about 20kbps
|
||||
//
|
||||
// //// USE simple API (using signle-type transaction function)
|
||||
// /* nothing */
|
||||
// //// USE flexible API (using multi-type transaction function)
|
||||
// #define SERIAL_USE_MULTI_TRANSACTION
|
||||
//
|
||||
// /////////////////////////////////////////////////////////////////
|
||||
|
||||
// Soft Serial Transaction Descriptor
|
||||
typedef struct _SSTD_t {
|
||||
uint8_t *status;
|
||||
uint8_t initiator2target_buffer_size;
|
||||
uint8_t *initiator2target_buffer;
|
||||
uint8_t target2initiator_buffer_size;
|
||||
uint8_t *target2initiator_buffer;
|
||||
} SSTD_t;
|
||||
#define TID_LIMIT(table) (sizeof(table) / sizeof(SSTD_t))
|
||||
|
||||
// initiator is transaction start side
|
||||
void soft_serial_initiator_init(SSTD_t *sstd_table, int sstd_table_size);
|
||||
// target is interrupt accept side
|
||||
void soft_serial_target_init(SSTD_t *sstd_table, int sstd_table_size);
|
||||
|
||||
// initiator result
|
||||
#define TRANSACTION_END 0
|
||||
#define TRANSACTION_NO_RESPONSE 0x1
|
||||
#define TRANSACTION_DATA_ERROR 0x2
|
||||
#define TRANSACTION_TYPE_ERROR 0x4
|
||||
#ifndef SERIAL_USE_MULTI_TRANSACTION
|
||||
int soft_serial_transaction(void);
|
||||
#else
|
||||
int soft_serial_transaction(int sstd_index);
|
||||
#endif
|
||||
|
||||
// target status
|
||||
// *SSTD_t.status has
|
||||
// initiator:
|
||||
// TRANSACTION_END
|
||||
// or TRANSACTION_NO_RESPONSE
|
||||
// or TRANSACTION_DATA_ERROR
|
||||
// target:
|
||||
// TRANSACTION_DATA_ERROR
|
||||
// or TRANSACTION_ACCEPTED
|
||||
#define TRANSACTION_ACCEPTED 0x8
|
||||
#ifdef SERIAL_USE_MULTI_TRANSACTION
|
||||
int soft_serial_get_and_clean_status(int sstd_index);
|
||||
#endif
|
@@ -113,29 +113,37 @@ void usart_slave_init(void) {
|
||||
chThdCreateStatic(waSlaveThread, sizeof(waSlaveThread), HIGHPRIO, SlaveThread, NULL);
|
||||
}
|
||||
|
||||
void soft_serial_initiator_init(void) { usart_master_init(); }
|
||||
static SSTD_t* Transaction_table = NULL;
|
||||
static uint8_t Transaction_table_size = 0;
|
||||
|
||||
void soft_serial_target_init(void) { usart_slave_init(); }
|
||||
void soft_serial_initiator_init(SSTD_t* sstd_table, int sstd_table_size) {
|
||||
Transaction_table = sstd_table;
|
||||
Transaction_table_size = (uint8_t)sstd_table_size;
|
||||
|
||||
usart_master_init();
|
||||
}
|
||||
|
||||
void soft_serial_target_init(SSTD_t* sstd_table, int sstd_table_size) {
|
||||
Transaction_table = sstd_table;
|
||||
Transaction_table_size = (uint8_t)sstd_table_size;
|
||||
|
||||
usart_slave_init();
|
||||
}
|
||||
|
||||
void handle_soft_serial_slave(void) {
|
||||
uint8_t sstd_index = sdGet(&SERIAL_USART_DRIVER); // first chunk is always transaction id
|
||||
split_transaction_desc_t* trans = &split_transaction_table[sstd_index];
|
||||
uint8_t sstd_index = sdGet(&SERIAL_USART_DRIVER); // first chunk is always transaction id
|
||||
SSTD_t* trans = &Transaction_table[sstd_index];
|
||||
|
||||
// Always write back the sstd_index as part of a basic handshake
|
||||
sstd_index ^= HANDSHAKE_MAGIC;
|
||||
sdWrite(&SERIAL_USART_DRIVER, &sstd_index, sizeof(sstd_index));
|
||||
|
||||
if (trans->initiator2target_buffer_size) {
|
||||
sdRead(&SERIAL_USART_DRIVER, split_trans_initiator2target_buffer(trans), trans->initiator2target_buffer_size);
|
||||
}
|
||||
|
||||
// Allow any slave processing to occur
|
||||
if (trans->slave_callback) {
|
||||
trans->slave_callback(trans->initiator2target_buffer_size, split_trans_initiator2target_buffer(trans), trans->target2initiator_buffer_size, split_trans_target2initiator_buffer(trans));
|
||||
sdRead(&SERIAL_USART_DRIVER, trans->initiator2target_buffer, trans->initiator2target_buffer_size);
|
||||
}
|
||||
|
||||
if (trans->target2initiator_buffer_size) {
|
||||
sdWrite(&SERIAL_USART_DRIVER, split_trans_target2initiator_buffer(trans), trans->target2initiator_buffer_size);
|
||||
sdWrite(&SERIAL_USART_DRIVER, trans->target2initiator_buffer, trans->target2initiator_buffer_size);
|
||||
}
|
||||
|
||||
if (trans->status) {
|
||||
@@ -152,14 +160,17 @@ void handle_soft_serial_slave(void) {
|
||||
// TRANSACTION_END
|
||||
// TRANSACTION_NO_RESPONSE
|
||||
// TRANSACTION_DATA_ERROR
|
||||
#ifndef SERIAL_USE_MULTI_TRANSACTION
|
||||
int soft_serial_transaction(void) {
|
||||
uint8_t sstd_index = 0;
|
||||
#else
|
||||
int soft_serial_transaction(int index) {
|
||||
uint8_t sstd_index = index;
|
||||
#endif
|
||||
|
||||
if (sstd_index > NUM_TOTAL_TRANSACTIONS) return TRANSACTION_TYPE_ERROR;
|
||||
split_transaction_desc_t* trans = &split_transaction_table[sstd_index];
|
||||
msg_t res = 0;
|
||||
|
||||
if (!trans->status) return TRANSACTION_TYPE_ERROR; // not registered
|
||||
if (sstd_index > Transaction_table_size) return TRANSACTION_TYPE_ERROR;
|
||||
SSTD_t* trans = &Transaction_table[sstd_index];
|
||||
msg_t res = 0;
|
||||
|
||||
sdClear(&SERIAL_USART_DRIVER);
|
||||
|
||||
@@ -178,7 +189,7 @@ int soft_serial_transaction(int index) {
|
||||
}
|
||||
|
||||
if (trans->initiator2target_buffer_size) {
|
||||
res = sdWriteTimeout(&SERIAL_USART_DRIVER, split_trans_initiator2target_buffer(trans), trans->initiator2target_buffer_size, TIME_MS2I(SERIAL_USART_TIMEOUT));
|
||||
res = sdWriteTimeout(&SERIAL_USART_DRIVER, trans->initiator2target_buffer, trans->initiator2target_buffer_size, TIME_MS2I(SERIAL_USART_TIMEOUT));
|
||||
if (res < 0) {
|
||||
dprintf("serial::usart_transmit NO_RESPONSE\n");
|
||||
return TRANSACTION_NO_RESPONSE;
|
||||
@@ -186,7 +197,7 @@ int soft_serial_transaction(int index) {
|
||||
}
|
||||
|
||||
if (trans->target2initiator_buffer_size) {
|
||||
res = sdReadTimeout(&SERIAL_USART_DRIVER, split_trans_target2initiator_buffer(trans), trans->target2initiator_buffer_size, TIME_MS2I(SERIAL_USART_TIMEOUT));
|
||||
res = sdReadTimeout(&SERIAL_USART_DRIVER, trans->target2initiator_buffer, trans->target2initiator_buffer_size, TIME_MS2I(SERIAL_USART_TIMEOUT));
|
||||
if (res < 0) {
|
||||
dprintf("serial::usart_receive NO_RESPONSE\n");
|
||||
return TRANSACTION_NO_RESPONSE;
|
||||
|
@@ -18,13 +18,8 @@
|
||||
|
||||
#include "timer.h"
|
||||
|
||||
static pin_t currentSlavePin = NO_PIN;
|
||||
|
||||
#if defined(K20x) || defined(KL2x)
|
||||
static SPIConfig spiConfig = {NULL, 0, 0, 0};
|
||||
#else
|
||||
static SPIConfig spiConfig = {false, NULL, 0, 0, 0, 0};
|
||||
#endif
|
||||
static pin_t currentSlavePin = NO_PIN;
|
||||
static SPIConfig spiConfig = {false, NULL, 0, 0, 0, 0};
|
||||
|
||||
__attribute__((weak)) void spi_init(void) {
|
||||
static bool is_initialised = false;
|
||||
@@ -32,15 +27,15 @@ __attribute__((weak)) void spi_init(void) {
|
||||
is_initialised = true;
|
||||
|
||||
// Try releasing special pins for a short time
|
||||
setPinInput(SPI_SCK_PIN);
|
||||
setPinInput(SPI_MOSI_PIN);
|
||||
setPinInput(SPI_MISO_PIN);
|
||||
palSetPadMode(PAL_PORT(SPI_SCK_PIN), PAL_PAD(SPI_SCK_PIN), PAL_MODE_INPUT);
|
||||
palSetPadMode(PAL_PORT(SPI_MOSI_PIN), PAL_PAD(SPI_MOSI_PIN), PAL_MODE_INPUT);
|
||||
palSetPadMode(PAL_PORT(SPI_MISO_PIN), PAL_PAD(SPI_MISO_PIN), PAL_MODE_INPUT);
|
||||
|
||||
chThdSleepMilliseconds(10);
|
||||
#if defined(USE_GPIOV1)
|
||||
palSetPadMode(PAL_PORT(SPI_SCK_PIN), PAL_PAD(SPI_SCK_PIN), SPI_SCK_PAL_MODE);
|
||||
palSetPadMode(PAL_PORT(SPI_MOSI_PIN), PAL_PAD(SPI_MOSI_PIN), SPI_MOSI_PAL_MODE);
|
||||
palSetPadMode(PAL_PORT(SPI_MISO_PIN), PAL_PAD(SPI_MISO_PIN), SPI_MISO_PAL_MODE);
|
||||
palSetPadMode(PAL_PORT(SPI_SCK_PIN), PAL_PAD(SPI_SCK_PIN), PAL_MODE_STM32_ALTERNATE_PUSHPULL);
|
||||
palSetPadMode(PAL_PORT(SPI_MOSI_PIN), PAL_PAD(SPI_MOSI_PIN), PAL_MODE_STM32_ALTERNATE_PUSHPULL);
|
||||
palSetPadMode(PAL_PORT(SPI_MISO_PIN), PAL_PAD(SPI_MISO_PIN), PAL_MODE_STM32_ALTERNATE_PUSHPULL);
|
||||
#else
|
||||
palSetPadMode(PAL_PORT(SPI_SCK_PIN), PAL_PAD(SPI_SCK_PIN), PAL_MODE_ALTERNATE(SPI_SCK_PAL_MODE) | PAL_STM32_OTYPE_PUSHPULL | PAL_STM32_OSPEED_HIGHEST);
|
||||
palSetPadMode(PAL_PORT(SPI_MOSI_PIN), PAL_PAD(SPI_MOSI_PIN), PAL_MODE_ALTERNATE(SPI_MOSI_PAL_MODE) | PAL_STM32_OTYPE_PUSHPULL | PAL_STM32_OSPEED_HIGHEST);
|
||||
@@ -63,54 +58,6 @@ bool spi_start(pin_t slavePin, bool lsbFirst, uint8_t mode, uint16_t divisor) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(K20x) || defined(KL2x)
|
||||
spiConfig.tar0 = SPIx_CTARn_FMSZ(7) | SPIx_CTARn_ASC(1);
|
||||
|
||||
if (lsbFirst) {
|
||||
spiConfig.tar0 |= SPIx_CTARn_LSBFE;
|
||||
}
|
||||
|
||||
switch (mode) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
spiConfig.tar0 |= SPIx_CTARn_CPHA;
|
||||
break;
|
||||
case 2:
|
||||
spiConfig.tar0 |= SPIx_CTARn_CPOL;
|
||||
break;
|
||||
case 3:
|
||||
spiConfig.tar0 |= SPIx_CTARn_CPHA | SPIx_CTARn_CPOL;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (roundedDivisor) {
|
||||
case 2:
|
||||
spiConfig.tar0 |= SPIx_CTARn_BR(0);
|
||||
break;
|
||||
case 4:
|
||||
spiConfig.tar0 |= SPIx_CTARn_BR(1);
|
||||
break;
|
||||
case 8:
|
||||
spiConfig.tar0 |= SPIx_CTARn_BR(3);
|
||||
break;
|
||||
case 16:
|
||||
spiConfig.tar0 |= SPIx_CTARn_BR(4);
|
||||
break;
|
||||
case 32:
|
||||
spiConfig.tar0 |= SPIx_CTARn_BR(5);
|
||||
break;
|
||||
case 64:
|
||||
spiConfig.tar0 |= SPIx_CTARn_BR(6);
|
||||
break;
|
||||
case 128:
|
||||
spiConfig.tar0 |= SPIx_CTARn_BR(7);
|
||||
break;
|
||||
case 256:
|
||||
spiConfig.tar0 |= SPIx_CTARn_BR(8);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
spiConfig.cr1 = 0;
|
||||
|
||||
if (lsbFirst) {
|
||||
@@ -156,7 +103,6 @@ bool spi_start(pin_t slavePin, bool lsbFirst, uint8_t mode, uint16_t divisor) {
|
||||
spiConfig.cr1 |= SPI_CR1_BR_2 | SPI_CR1_BR_1 | SPI_CR1_BR_0;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
currentSlavePin = slavePin;
|
||||
spiConfig.ssport = PAL_PORT(slavePin);
|
||||
|
@@ -21,7 +21,6 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "gpio.h"
|
||||
#include "chibios_config.h"
|
||||
|
||||
#ifndef SPI_DRIVER
|
||||
# define SPI_DRIVER SPID2
|
||||
@@ -32,11 +31,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef SPI_SCK_PAL_MODE
|
||||
# if defined(USE_GPIOV1)
|
||||
# define SPI_SCK_PAL_MODE PAL_MODE_STM32_ALTERNATE_PUSHPULL
|
||||
# else
|
||||
# define SPI_SCK_PAL_MODE 5
|
||||
# endif
|
||||
# define SPI_SCK_PAL_MODE 5
|
||||
#endif
|
||||
|
||||
#ifndef SPI_MOSI_PIN
|
||||
@@ -44,11 +39,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef SPI_MOSI_PAL_MODE
|
||||
# if defined(USE_GPIOV1)
|
||||
# define SPI_MOSI_PAL_MODE PAL_MODE_STM32_ALTERNATE_PUSHPULL
|
||||
# else
|
||||
# define SPI_MOSI_PAL_MODE 5
|
||||
# endif
|
||||
# define SPI_MOSI_PAL_MODE 5
|
||||
#endif
|
||||
|
||||
#ifndef SPI_MISO_PIN
|
||||
@@ -56,11 +47,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef SPI_MISO_PAL_MODE
|
||||
# if defined(USE_GPIOV1)
|
||||
# define SPI_MISO_PAL_MODE PAL_MODE_STM32_ALTERNATE_PUSHPULL
|
||||
# else
|
||||
# define SPI_MISO_PAL_MODE 5
|
||||
# endif
|
||||
# define SPI_MISO_PAL_MODE 5
|
||||
#endif
|
||||
|
||||
typedef int16_t spi_status_t;
|
||||
|
@@ -291,73 +291,6 @@ void haptic_play(void) {
|
||||
#endif
|
||||
}
|
||||
|
||||
__attribute__((weak)) bool get_haptic_enabled_key(uint16_t keycode, keyrecord_t *record) {
|
||||
switch(keycode) {
|
||||
# ifdef NO_HAPTIC_MOD
|
||||
case QK_MOD_TAP ... QK_MOD_TAP_MAX:
|
||||
if (record->tap.count == 0) return false;
|
||||
break;
|
||||
case QK_LAYER_TAP_TOGGLE ... QK_LAYER_TAP_TOGGLE_MAX:
|
||||
if (record->tap.count != TAPPING_TOGGLE) return false;
|
||||
break;
|
||||
case QK_LAYER_TAP ... QK_LAYER_TAP_MAX:
|
||||
if (record->tap.count == 0) return false;
|
||||
break;
|
||||
case KC_LCTRL ... KC_RGUI:
|
||||
case QK_MOMENTARY ... QK_MOMENTARY_MAX:
|
||||
# endif
|
||||
# ifdef NO_HAPTIC_FN
|
||||
case KC_FN0 ... KC_FN31:
|
||||
# endif
|
||||
# ifdef NO_HAPTIC_ALPHA
|
||||
case KC_A ... KC_Z:
|
||||
# endif
|
||||
# ifdef NO_HAPTIC_PUNCTUATION
|
||||
case KC_ENTER:
|
||||
case KC_ESCAPE:
|
||||
case KC_BSPACE:
|
||||
case KC_SPACE:
|
||||
case KC_MINUS:
|
||||
case KC_EQUAL:
|
||||
case KC_LBRACKET:
|
||||
case KC_RBRACKET:
|
||||
case KC_BSLASH:
|
||||
case KC_NONUS_HASH:
|
||||
case KC_SCOLON:
|
||||
case KC_QUOTE:
|
||||
case KC_GRAVE:
|
||||
case KC_COMMA:
|
||||
case KC_SLASH:
|
||||
case KC_DOT:
|
||||
case KC_NONUS_BSLASH:
|
||||
# endif
|
||||
# ifdef NO_HAPTIC_LOCKKEYS
|
||||
case KC_CAPSLOCK:
|
||||
case KC_SCROLLLOCK:
|
||||
case KC_NUMLOCK:
|
||||
# endif
|
||||
# ifdef NO_HAPTIC_NAV
|
||||
case KC_PSCREEN:
|
||||
case KC_PAUSE:
|
||||
case KC_INSERT:
|
||||
case KC_DELETE:
|
||||
case KC_PGDOWN:
|
||||
case KC_PGUP:
|
||||
case KC_LEFT:
|
||||
case KC_UP:
|
||||
case KC_RIGHT:
|
||||
case KC_DOWN:
|
||||
case KC_END:
|
||||
case KC_HOME:
|
||||
# endif
|
||||
# ifdef NO_HAPTIC_NUMERIC
|
||||
case KC_1 ... KC_0:
|
||||
# endif
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool process_haptic(uint16_t keycode, keyrecord_t *record) {
|
||||
if (keycode == HPT_ON && record->event.pressed) {
|
||||
haptic_enable();
|
||||
@@ -402,12 +335,12 @@ bool process_haptic(uint16_t keycode, keyrecord_t *record) {
|
||||
if (haptic_config.enable) {
|
||||
if (record->event.pressed) {
|
||||
// keypress
|
||||
if (haptic_config.feedback < 2 && get_haptic_enabled_key(keycode, record)) {
|
||||
if (haptic_config.feedback < 2) {
|
||||
haptic_play();
|
||||
}
|
||||
} else {
|
||||
// keyrelease
|
||||
if (haptic_config.feedback > 0 && get_haptic_enabled_key(keycode, record)) {
|
||||
if (haptic_config.feedback > 0) {
|
||||
haptic_play();
|
||||
}
|
||||
}
|
||||
|
@@ -1,496 +0,0 @@
|
||||
/*
|
||||
Copyright 2021
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "st7565.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "keyboard.h"
|
||||
#include "progmem.h"
|
||||
#include "timer.h"
|
||||
#include "wait.h"
|
||||
|
||||
#include ST7565_FONT_H
|
||||
|
||||
// Fundamental Commands
|
||||
#define CONTRAST 0x81
|
||||
#define DISPLAY_ALL_ON 0xA5
|
||||
#define DISPLAY_ALL_ON_RESUME 0xA4
|
||||
#define NORMAL_DISPLAY 0xA6
|
||||
#define INVERT_DISPLAY 0xA7
|
||||
#define DISPLAY_ON 0xAF
|
||||
#define DISPLAY_OFF 0xAE
|
||||
#define NOP 0xE3
|
||||
|
||||
// Addressing Setting Commands
|
||||
#define PAM_SETCOLUMN_LSB 0x00
|
||||
#define PAM_SETCOLUMN_MSB 0x10
|
||||
#define PAM_PAGE_ADDR 0xB0 // 0xb0 -- 0xb7
|
||||
|
||||
// Hardware Configuration Commands
|
||||
#define DISPLAY_START_LINE 0x40
|
||||
#define SEGMENT_REMAP 0xA0
|
||||
#define SEGMENT_REMAP_INV 0xA1
|
||||
#define COM_SCAN_INC 0xC0
|
||||
#define COM_SCAN_DEC 0xC8
|
||||
#define LCD_BIAS_7 0xA3
|
||||
#define LCD_BIAS_9 0xA2
|
||||
#define RESISTOR_RATIO 0x20
|
||||
#define POWER_CONTROL 0x28
|
||||
|
||||
// Misc defines
|
||||
#ifndef ST7565_BLOCK_COUNT
|
||||
# define ST7565_BLOCK_COUNT (sizeof(ST7565_BLOCK_TYPE) * 8)
|
||||
#endif
|
||||
#ifndef ST7565_BLOCK_SIZE
|
||||
# define ST7565_BLOCK_SIZE (ST7565_MATRIX_SIZE / ST7565_BLOCK_COUNT)
|
||||
#endif
|
||||
|
||||
#define ST7565_ALL_BLOCKS_MASK (((((ST7565_BLOCK_TYPE)1 << (ST7565_BLOCK_COUNT - 1)) - 1) << 1) | 1)
|
||||
|
||||
#define HAS_FLAGS(bits, flags) ((bits & flags) == flags)
|
||||
|
||||
// Display buffer's is the same as the display memory layout
|
||||
// this is so we don't end up with rounding errors with
|
||||
// parts of the display unusable or don't get cleared correctly
|
||||
// and also allows for drawing & inverting
|
||||
uint8_t st7565_buffer[ST7565_MATRIX_SIZE];
|
||||
uint8_t * st7565_cursor;
|
||||
ST7565_BLOCK_TYPE st7565_dirty = 0;
|
||||
bool st7565_initialized = false;
|
||||
bool st7565_active = false;
|
||||
bool st7565_inverted = false;
|
||||
display_rotation_t st7565_rotation = DISPLAY_ROTATION_0;
|
||||
#if ST7565_TIMEOUT > 0
|
||||
uint32_t st7565_timeout;
|
||||
#endif
|
||||
#if ST7565_UPDATE_INTERVAL > 0
|
||||
uint16_t st7565_update_timeout;
|
||||
#endif
|
||||
|
||||
// Flips the rendering bits for a character at the current cursor position
|
||||
static void InvertCharacter(uint8_t *cursor) {
|
||||
const uint8_t *end = cursor + ST7565_FONT_WIDTH;
|
||||
while (cursor < end) {
|
||||
*cursor = ~(*cursor);
|
||||
cursor++;
|
||||
}
|
||||
}
|
||||
|
||||
bool st7565_init(display_rotation_t rotation) {
|
||||
setPinOutput(ST7565_A0_PIN);
|
||||
writePinHigh(ST7565_A0_PIN);
|
||||
setPinOutput(ST7565_RST_PIN);
|
||||
writePinHigh(ST7565_RST_PIN);
|
||||
|
||||
st7565_rotation = st7565_init_user(rotation);
|
||||
|
||||
spi_init();
|
||||
spi_start(ST7565_SS_PIN, false, 0, ST7565_SPI_CLK_DIVISOR);
|
||||
|
||||
st7565_reset();
|
||||
|
||||
st7565_send_cmd(LCD_BIAS_7);
|
||||
if (!HAS_FLAGS(st7565_rotation, DISPLAY_ROTATION_180)) {
|
||||
st7565_send_cmd(SEGMENT_REMAP);
|
||||
st7565_send_cmd(COM_SCAN_DEC);
|
||||
} else {
|
||||
st7565_send_cmd(SEGMENT_REMAP_INV);
|
||||
st7565_send_cmd(COM_SCAN_INC);
|
||||
}
|
||||
st7565_send_cmd(DISPLAY_START_LINE | 0x00);
|
||||
st7565_send_cmd(CONTRAST);
|
||||
st7565_send_cmd(ST7565_CONTRAST);
|
||||
st7565_send_cmd(RESISTOR_RATIO | 0x01);
|
||||
st7565_send_cmd(POWER_CONTROL | 0x04);
|
||||
wait_ms(50);
|
||||
st7565_send_cmd(POWER_CONTROL | 0x06);
|
||||
wait_ms(50);
|
||||
st7565_send_cmd(POWER_CONTROL | 0x07);
|
||||
wait_ms(10);
|
||||
st7565_send_cmd(DISPLAY_ON);
|
||||
st7565_send_cmd(DISPLAY_ALL_ON_RESUME);
|
||||
st7565_send_cmd(NORMAL_DISPLAY);
|
||||
|
||||
spi_stop();
|
||||
|
||||
#if ST7565_TIMEOUT > 0
|
||||
st7565_timeout = timer_read32() + ST7565_TIMEOUT;
|
||||
#endif
|
||||
|
||||
st7565_clear();
|
||||
st7565_initialized = true;
|
||||
st7565_active = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
__attribute__((weak)) display_rotation_t st7565_init_user(display_rotation_t rotation) { return rotation; }
|
||||
|
||||
void st7565_clear(void) {
|
||||
memset(st7565_buffer, 0, sizeof(st7565_buffer));
|
||||
st7565_cursor = &st7565_buffer[0];
|
||||
st7565_dirty = ST7565_ALL_BLOCKS_MASK;
|
||||
}
|
||||
|
||||
uint8_t crot(uint8_t a, int8_t n) {
|
||||
const uint8_t mask = 0x7;
|
||||
n &= mask;
|
||||
return a << n | a >> (-n & mask);
|
||||
}
|
||||
|
||||
void st7565_render(void) {
|
||||
if (!st7565_initialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Do we have work to do?
|
||||
st7565_dirty &= ST7565_ALL_BLOCKS_MASK;
|
||||
if (!st7565_dirty) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Find first dirty block
|
||||
uint8_t update_start = 0;
|
||||
while (!(st7565_dirty & ((ST7565_BLOCK_TYPE)1 << update_start))) {
|
||||
++update_start;
|
||||
}
|
||||
|
||||
// Calculate commands to set memory addressing bounds.
|
||||
uint8_t start_page = ST7565_BLOCK_SIZE * update_start / ST7565_DISPLAY_WIDTH;
|
||||
uint8_t start_column = ST7565_BLOCK_SIZE * update_start % ST7565_DISPLAY_WIDTH;
|
||||
// IC has 132 segment drivers, for panels with less width we need to offset the starting column
|
||||
if (HAS_FLAGS(st7565_rotation, DISPLAY_ROTATION_180)) {
|
||||
start_column += (132 - ST7565_DISPLAY_WIDTH);
|
||||
}
|
||||
|
||||
spi_start(ST7565_SS_PIN, false, 0, ST7565_SPI_CLK_DIVISOR);
|
||||
|
||||
st7565_send_cmd(PAM_PAGE_ADDR | start_page);
|
||||
st7565_send_cmd(PAM_SETCOLUMN_LSB | ((ST7565_COLUMN_OFFSET + start_column) & 0x0f));
|
||||
st7565_send_cmd(PAM_SETCOLUMN_MSB | ((ST7565_COLUMN_OFFSET + start_column) >> 4 & 0x0f));
|
||||
|
||||
st7565_send_data(&st7565_buffer[ST7565_BLOCK_SIZE * update_start], ST7565_BLOCK_SIZE);
|
||||
|
||||
// Turn on display if it is off
|
||||
st7565_on();
|
||||
|
||||
// Clear dirty flag
|
||||
st7565_dirty &= ~((ST7565_BLOCK_TYPE)1 << update_start);
|
||||
}
|
||||
|
||||
void st7565_set_cursor(uint8_t col, uint8_t line) {
|
||||
uint16_t index = line * ST7565_DISPLAY_WIDTH + col * ST7565_FONT_WIDTH;
|
||||
|
||||
// Out of bounds?
|
||||
if (index >= ST7565_MATRIX_SIZE) {
|
||||
index = 0;
|
||||
}
|
||||
|
||||
st7565_cursor = &st7565_buffer[index];
|
||||
}
|
||||
|
||||
void st7565_advance_page(bool clearPageRemainder) {
|
||||
uint16_t index = st7565_cursor - &st7565_buffer[0];
|
||||
uint8_t remaining = ST7565_DISPLAY_WIDTH - (index % ST7565_DISPLAY_WIDTH);
|
||||
|
||||
if (clearPageRemainder) {
|
||||
// Remaining Char count
|
||||
remaining = remaining / ST7565_FONT_WIDTH;
|
||||
|
||||
// Write empty character until next line
|
||||
while (remaining--) st7565_write_char(' ', false);
|
||||
} else {
|
||||
// Next page index out of bounds?
|
||||
if (index + remaining >= ST7565_MATRIX_SIZE) {
|
||||
index = 0;
|
||||
remaining = 0;
|
||||
}
|
||||
|
||||
st7565_cursor = &st7565_buffer[index + remaining];
|
||||
}
|
||||
}
|
||||
|
||||
void st7565_advance_char(void) {
|
||||
uint16_t nextIndex = st7565_cursor - &st7565_buffer[0] + ST7565_FONT_WIDTH;
|
||||
uint8_t remainingSpace = ST7565_DISPLAY_WIDTH - (nextIndex % ST7565_DISPLAY_WIDTH);
|
||||
|
||||
// Do we have enough space on the current line for the next character
|
||||
if (remainingSpace < ST7565_FONT_WIDTH) {
|
||||
nextIndex += remainingSpace;
|
||||
}
|
||||
|
||||
// Did we go out of bounds
|
||||
if (nextIndex >= ST7565_MATRIX_SIZE) {
|
||||
nextIndex = 0;
|
||||
}
|
||||
|
||||
// Update cursor position
|
||||
st7565_cursor = &st7565_buffer[nextIndex];
|
||||
}
|
||||
|
||||
// Main handler that writes character data to the display buffer
|
||||
void st7565_write_char(const char data, bool invert) {
|
||||
// Advance to the next line if newline
|
||||
if (data == '\n') {
|
||||
// Old source wrote ' ' until end of line...
|
||||
st7565_advance_page(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (data == '\r') {
|
||||
st7565_advance_page(false);
|
||||
return;
|
||||
}
|
||||
|
||||
// copy the current render buffer to check for dirty after
|
||||
static uint8_t st7565_temp_buffer[ST7565_FONT_WIDTH];
|
||||
memcpy(&st7565_temp_buffer, st7565_cursor, ST7565_FONT_WIDTH);
|
||||
|
||||
_Static_assert(sizeof(font) >= ((ST7565_FONT_END + 1 - ST7565_FONT_START) * ST7565_FONT_WIDTH), "ST7565_FONT_END references outside array");
|
||||
|
||||
// set the reder buffer data
|
||||
uint8_t cast_data = (uint8_t)data; // font based on unsigned type for index
|
||||
if (cast_data < ST7565_FONT_START || cast_data > ST7565_FONT_END) {
|
||||
memset(st7565_cursor, 0x00, ST7565_FONT_WIDTH);
|
||||
} else {
|
||||
const uint8_t *glyph = &font[(cast_data - ST7565_FONT_START) * ST7565_FONT_WIDTH];
|
||||
memcpy_P(st7565_cursor, glyph, ST7565_FONT_WIDTH);
|
||||
}
|
||||
|
||||
// Invert if needed
|
||||
if (invert) {
|
||||
InvertCharacter(st7565_cursor);
|
||||
}
|
||||
|
||||
// Dirty check
|
||||
if (memcmp(&st7565_temp_buffer, st7565_cursor, ST7565_FONT_WIDTH)) {
|
||||
uint16_t index = st7565_cursor - &st7565_buffer[0];
|
||||
st7565_dirty |= ((ST7565_BLOCK_TYPE)1 << (index / ST7565_BLOCK_SIZE));
|
||||
// Edgecase check if the written data spans the 2 chunks
|
||||
st7565_dirty |= ((ST7565_BLOCK_TYPE)1 << ((index + ST7565_FONT_WIDTH - 1) / ST7565_BLOCK_SIZE));
|
||||
}
|
||||
|
||||
// Finally move to the next char
|
||||
st7565_advance_char();
|
||||
}
|
||||
|
||||
void st7565_write(const char *data, bool invert) {
|
||||
const char *end = data + strlen(data);
|
||||
while (data < end) {
|
||||
st7565_write_char(*data, invert);
|
||||
data++;
|
||||
}
|
||||
}
|
||||
|
||||
void st7565_write_ln(const char *data, bool invert) {
|
||||
st7565_write(data, invert);
|
||||
st7565_advance_page(true);
|
||||
}
|
||||
|
||||
void st7565_pan(bool left) {
|
||||
uint16_t i = 0;
|
||||
for (uint16_t y = 0; y < ST7565_DISPLAY_HEIGHT / 8; y++) {
|
||||
if (left) {
|
||||
for (uint16_t x = 0; x < ST7565_DISPLAY_WIDTH - 1; x++) {
|
||||
i = y * ST7565_DISPLAY_WIDTH + x;
|
||||
st7565_buffer[i] = st7565_buffer[i + 1];
|
||||
}
|
||||
} else {
|
||||
for (uint16_t x = ST7565_DISPLAY_WIDTH - 1; x > 0; x--) {
|
||||
i = y * ST7565_DISPLAY_WIDTH + x;
|
||||
st7565_buffer[i] = st7565_buffer[i - 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
st7565_dirty = ST7565_ALL_BLOCKS_MASK;
|
||||
}
|
||||
|
||||
display_buffer_reader_t st7565_read_raw(uint16_t start_index) {
|
||||
if (start_index > ST7565_MATRIX_SIZE) start_index = ST7565_MATRIX_SIZE;
|
||||
display_buffer_reader_t ret_reader;
|
||||
ret_reader.current_element = &st7565_buffer[start_index];
|
||||
ret_reader.remaining_element_count = ST7565_MATRIX_SIZE - start_index;
|
||||
return ret_reader;
|
||||
}
|
||||
|
||||
void st7565_write_raw_byte(const char data, uint16_t index) {
|
||||
if (index > ST7565_MATRIX_SIZE) index = ST7565_MATRIX_SIZE;
|
||||
if (st7565_buffer[index] == data) return;
|
||||
st7565_buffer[index] = data;
|
||||
st7565_dirty |= ((ST7565_BLOCK_TYPE)1 << (index / ST7565_BLOCK_SIZE));
|
||||
}
|
||||
|
||||
void st7565_write_raw(const char *data, uint16_t size) {
|
||||
uint16_t cursor_start_index = st7565_cursor - &st7565_buffer[0];
|
||||
if ((size + cursor_start_index) > ST7565_MATRIX_SIZE) size = ST7565_MATRIX_SIZE - cursor_start_index;
|
||||
for (uint16_t i = cursor_start_index; i < cursor_start_index + size; i++) {
|
||||
uint8_t c = *data++;
|
||||
if (st7565_buffer[i] == c) continue;
|
||||
st7565_buffer[i] = c;
|
||||
st7565_dirty |= ((ST7565_BLOCK_TYPE)1 << (i / ST7565_BLOCK_SIZE));
|
||||
}
|
||||
}
|
||||
|
||||
void st7565_write_pixel(uint8_t x, uint8_t y, bool on) {
|
||||
if (x >= ST7565_DISPLAY_WIDTH) {
|
||||
return;
|
||||
}
|
||||
uint16_t index = x + (y / 8) * ST7565_DISPLAY_WIDTH;
|
||||
if (index >= ST7565_MATRIX_SIZE) {
|
||||
return;
|
||||
}
|
||||
uint8_t data = st7565_buffer[index];
|
||||
if (on) {
|
||||
data |= (1 << (y % 8));
|
||||
} else {
|
||||
data &= ~(1 << (y % 8));
|
||||
}
|
||||
if (st7565_buffer[index] != data) {
|
||||
st7565_buffer[index] = data;
|
||||
st7565_dirty |= ((ST7565_BLOCK_TYPE)1 << (index / ST7565_BLOCK_SIZE));
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__AVR__)
|
||||
void st7565_write_P(const char *data, bool invert) {
|
||||
uint8_t c = pgm_read_byte(data);
|
||||
while (c != 0) {
|
||||
st7565_write_char(c, invert);
|
||||
c = pgm_read_byte(++data);
|
||||
}
|
||||
}
|
||||
|
||||
void st7565_write_ln_P(const char *data, bool invert) {
|
||||
st7565_write_P(data, invert);
|
||||
st7565_advance_page(true);
|
||||
}
|
||||
|
||||
void st7565_write_raw_P(const char *data, uint16_t size) {
|
||||
uint16_t cursor_start_index = st7565_cursor - &st7565_buffer[0];
|
||||
if ((size + cursor_start_index) > ST7565_MATRIX_SIZE) size = ST7565_MATRIX_SIZE - cursor_start_index;
|
||||
for (uint16_t i = cursor_start_index; i < cursor_start_index + size; i++) {
|
||||
uint8_t c = pgm_read_byte(data++);
|
||||
if (st7565_buffer[i] == c) continue;
|
||||
st7565_buffer[i] = c;
|
||||
st7565_dirty |= ((ST7565_BLOCK_TYPE)1 << (i / ST7565_BLOCK_SIZE));
|
||||
}
|
||||
}
|
||||
#endif // defined(__AVR__)
|
||||
|
||||
bool st7565_on(void) {
|
||||
if (!st7565_initialized) {
|
||||
return st7565_active;
|
||||
}
|
||||
|
||||
#if ST7565_TIMEOUT > 0
|
||||
st7565_timeout = timer_read32() + ST7565_TIMEOUT;
|
||||
#endif
|
||||
|
||||
if (!st7565_active) {
|
||||
spi_start(ST7565_SS_PIN, false, 0, ST7565_SPI_CLK_DIVISOR);
|
||||
st7565_send_cmd(DISPLAY_ON);
|
||||
spi_stop();
|
||||
st7565_active = true;
|
||||
st7565_on_user();
|
||||
}
|
||||
return st7565_active;
|
||||
}
|
||||
|
||||
__attribute__((weak)) void st7565_on_user(void) {}
|
||||
|
||||
bool st7565_off(void) {
|
||||
if (!st7565_initialized) {
|
||||
return !st7565_active;
|
||||
}
|
||||
|
||||
if (st7565_active) {
|
||||
spi_start(ST7565_SS_PIN, false, 0, ST7565_SPI_CLK_DIVISOR);
|
||||
st7565_send_cmd(DISPLAY_OFF);
|
||||
spi_stop();
|
||||
st7565_active = false;
|
||||
st7565_off_user();
|
||||
}
|
||||
return !st7565_active;
|
||||
}
|
||||
|
||||
__attribute__((weak)) void st7565_off_user(void) {}
|
||||
|
||||
bool st7565_is_on(void) { return st7565_active; }
|
||||
|
||||
bool st7565_invert(bool invert) {
|
||||
if (!st7565_initialized) {
|
||||
return st7565_inverted;
|
||||
}
|
||||
|
||||
if (invert != st7565_inverted) {
|
||||
spi_start(ST7565_SS_PIN, false, 0, ST7565_SPI_CLK_DIVISOR);
|
||||
st7565_send_cmd(invert ? INVERT_DISPLAY : NORMAL_DISPLAY);
|
||||
spi_stop();
|
||||
st7565_inverted = invert;
|
||||
}
|
||||
return st7565_inverted;
|
||||
}
|
||||
|
||||
uint8_t st7565_max_chars(void) { return ST7565_DISPLAY_WIDTH / ST7565_FONT_WIDTH; }
|
||||
|
||||
uint8_t st7565_max_lines(void) { return ST7565_DISPLAY_HEIGHT / ST7565_FONT_HEIGHT; }
|
||||
|
||||
void st7565_task(void) {
|
||||
if (!st7565_initialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
#if ST7565_UPDATE_INTERVAL > 0
|
||||
if (timer_elapsed(st7565_update_timeout) >= ST7565_UPDATE_INTERVAL) {
|
||||
st7565_update_timeout = timer_read();
|
||||
st7565_set_cursor(0, 0);
|
||||
st7565_task_user();
|
||||
}
|
||||
#else
|
||||
st7565_set_cursor(0, 0);
|
||||
st7565_task_user();
|
||||
#endif
|
||||
|
||||
// Smart render system, no need to check for dirty
|
||||
st7565_render();
|
||||
|
||||
// Display timeout check
|
||||
#if ST7565_TIMEOUT > 0
|
||||
if (st7565_active && timer_expired32(timer_read32(), st7565_timeout)) {
|
||||
st7565_off();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
__attribute__((weak)) void st7565_task_user(void) {}
|
||||
|
||||
void st7565_reset(void) {
|
||||
writePinLow(ST7565_RST_PIN);
|
||||
wait_ms(20);
|
||||
writePinHigh(ST7565_RST_PIN);
|
||||
wait_ms(20);
|
||||
}
|
||||
|
||||
spi_status_t st7565_send_cmd(uint8_t cmd) {
|
||||
writePinLow(ST7565_A0_PIN);
|
||||
return spi_write(cmd);
|
||||
}
|
||||
|
||||
spi_status_t st7565_send_data(uint8_t *data, uint16_t length) {
|
||||
writePinHigh(ST7565_A0_PIN);
|
||||
return spi_transmit(data, length);
|
||||
}
|
@@ -1,219 +0,0 @@
|
||||
/*
|
||||
Copyright 2021
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "spi_master.h"
|
||||
|
||||
#ifndef ST7565_DISPLAY_WIDTH
|
||||
# define ST7565_DISPLAY_WIDTH 128
|
||||
#endif
|
||||
#ifndef ST7565_DISPLAY_HEIGHT
|
||||
# define ST7565_DISPLAY_HEIGHT 32
|
||||
#endif
|
||||
#ifndef ST7565_MATRIX_SIZE
|
||||
# define ST7565_MATRIX_SIZE (ST7565_DISPLAY_HEIGHT / 8 * ST7565_DISPLAY_WIDTH) // 1024 (compile time mathed)
|
||||
#endif
|
||||
#ifndef ST7565_BLOCK_TYPE
|
||||
# define ST7565_BLOCK_TYPE uint16_t
|
||||
#endif
|
||||
#ifndef ST7565_BLOCK_COUNT
|
||||
# define ST7565_BLOCK_COUNT (sizeof(ST7565_BLOCK_TYPE) * 8) // 32 (compile time mathed)
|
||||
#endif
|
||||
#ifndef ST7565_BLOCK_SIZE
|
||||
# define ST7565_BLOCK_SIZE (ST7565_MATRIX_SIZE / ST7565_BLOCK_COUNT) // 32 (compile time mathed)
|
||||
#endif
|
||||
|
||||
// the column address corresponding to the first column in the display hardware
|
||||
#if !defined(ST7565_COLUMN_OFFSET)
|
||||
# define ST7565_COLUMN_OFFSET 0
|
||||
#endif
|
||||
|
||||
// spi clock divisor
|
||||
#if !defined(ST7565_SPI_CLK_DIVISOR)
|
||||
# define ST7565_SPI_CLK_DIVISOR 4
|
||||
#endif
|
||||
|
||||
// Custom font file to use
|
||||
#if !defined(ST7565_FONT_H)
|
||||
# define ST7565_FONT_H "glcdfont.c"
|
||||
#endif
|
||||
// unsigned char value of the first character in the font file
|
||||
#if !defined(ST7565_FONT_START)
|
||||
# define ST7565_FONT_START 0
|
||||
#endif
|
||||
// unsigned char value of the last character in the font file
|
||||
#if !defined(ST7565_FONT_END)
|
||||
# define ST7565_FONT_END 223
|
||||
#endif
|
||||
// Font render width
|
||||
#if !defined(ST7565_FONT_WIDTH)
|
||||
# define ST7565_FONT_WIDTH 6
|
||||
#endif
|
||||
// Font render height
|
||||
#if !defined(ST7565_FONT_HEIGHT)
|
||||
# define ST7565_FONT_HEIGHT 8
|
||||
#endif
|
||||
// Default contrast level
|
||||
#if !defined(ST7565_CONTRAST)
|
||||
# define ST7565_CONTRAST 32
|
||||
#endif
|
||||
|
||||
#if !defined(ST7565_TIMEOUT)
|
||||
# if defined(ST7565_DISABLE_TIMEOUT)
|
||||
# define ST7565_TIMEOUT 0
|
||||
# else
|
||||
# define ST7565_TIMEOUT 60000
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(ST7565_UPDATE_INTERVAL) && defined(SPLIT_KEYBOARD)
|
||||
# define ST7565_UPDATE_INTERVAL 50
|
||||
#endif
|
||||
|
||||
typedef struct __attribute__((__packed__)) {
|
||||
uint8_t *current_element;
|
||||
uint16_t remaining_element_count;
|
||||
} display_buffer_reader_t;
|
||||
|
||||
// Rotation enum values are flags
|
||||
typedef enum { DISPLAY_ROTATION_0, DISPLAY_ROTATION_180 } display_rotation_t;
|
||||
|
||||
// Initialize the display, rotating the rendered output based on the define passed in.
|
||||
// Returns true if the display was initialized successfully
|
||||
bool st7565_init(display_rotation_t rotation);
|
||||
|
||||
// Called at the start of st7565_init, weak function overridable by the user
|
||||
// rotation - the value passed into st7565_init
|
||||
// Return new display_rotation_t if you want to override default rotation
|
||||
display_rotation_t st7565_init_user(display_rotation_t rotation);
|
||||
|
||||
// Clears the display buffer, resets cursor position to 0, and sets the buffer to dirty for rendering
|
||||
void st7565_clear(void);
|
||||
|
||||
// Renders the dirty chunks of the buffer to display
|
||||
void st7565_render(void);
|
||||
|
||||
// Moves cursor to character position indicated by column and line, wraps if out of bounds
|
||||
// Max column denoted by 'st7565_max_chars()' and max lines by 'st7565_max_lines()' functions
|
||||
void st7565_set_cursor(uint8_t col, uint8_t line);
|
||||
|
||||
// Advances the cursor to the next page, writing ' ' if true
|
||||
// Wraps to the begining when out of bounds
|
||||
void st7565_advance_page(bool clearPageRemainder);
|
||||
|
||||
// Moves the cursor forward 1 character length
|
||||
// Advance page if there is not enough room for the next character
|
||||
// Wraps to the begining when out of bounds
|
||||
void st7565_advance_char(void);
|
||||
|
||||
// Writes a single character to the buffer at current cursor position
|
||||
// Advances the cursor while writing, inverts the pixels if true
|
||||
// Main handler that writes character data to the display buffer
|
||||
void st7565_write_char(const char data, bool invert);
|
||||
|
||||
// Writes a string to the buffer at current cursor position
|
||||
// Advances the cursor while writing, inverts the pixels if true
|
||||
void st7565_write(const char *data, bool invert);
|
||||
|
||||
// Writes a string to the buffer at current cursor position
|
||||
// Advances the cursor while writing, inverts the pixels if true
|
||||
// Advances the cursor to the next page, wiring ' ' to the remainder of the current page
|
||||
void st7565_write_ln(const char *data, bool invert);
|
||||
|
||||
// Pans the buffer to the right (or left by passing true) by moving contents of the buffer
|
||||
// Useful for moving the screen in preparation for new drawing
|
||||
void st7565_pan(bool left);
|
||||
|
||||
// Returns a pointer to the requested start index in the buffer plus remaining
|
||||
// buffer length as struct
|
||||
display_buffer_reader_t st7565_read_raw(uint16_t start_index);
|
||||
|
||||
// Writes a string to the buffer at current cursor position
|
||||
void st7565_write_raw(const char *data, uint16_t size);
|
||||
|
||||
// Writes a single byte into the buffer at the specified index
|
||||
void st7565_write_raw_byte(const char data, uint16_t index);
|
||||
|
||||
// Sets a specific pixel on or off
|
||||
// Coordinates start at top-left and go right and down for positive x and y
|
||||
void st7565_write_pixel(uint8_t x, uint8_t y, bool on);
|
||||
|
||||
#if defined(__AVR__)
|
||||
// Writes a PROGMEM string to the buffer at current cursor position
|
||||
// Advances the cursor while writing, inverts the pixels if true
|
||||
// Remapped to call 'void st7565_write(const char *data, bool invert);' on ARM
|
||||
void st7565_write_P(const char *data, bool invert);
|
||||
|
||||
// Writes a PROGMEM string to the buffer at current cursor position
|
||||
// Advances the cursor while writing, inverts the pixels if true
|
||||
// Advances the cursor to the next page, wiring ' ' to the remainder of the current page
|
||||
// Remapped to call 'void st7565_write_ln(const char *data, bool invert);' on ARM
|
||||
void st7565_write_ln_P(const char *data, bool invert);
|
||||
|
||||
// Writes a PROGMEM string to the buffer at current cursor position
|
||||
void st7565_write_raw_P(const char *data, uint16_t size);
|
||||
#else
|
||||
# define st7565_write_P(data, invert) st7565_write(data, invert)
|
||||
# define st7565_write_ln_P(data, invert) st7565_write_ln(data, invert)
|
||||
# define st7565_write_raw_P(data, size) st7565_write_raw(data, size)
|
||||
#endif // defined(__AVR__)
|
||||
|
||||
// Can be used to manually turn on the screen if it is off
|
||||
// Returns true if the screen was on or turns on
|
||||
bool st7565_on(void);
|
||||
|
||||
// Called when st7565_on() turns on the screen, weak function overridable by the user
|
||||
// Not called if the screen is already on
|
||||
void st7565_on_user(void);
|
||||
|
||||
// Can be used to manually turn off the screen if it is on
|
||||
// Returns true if the screen was off or turns off
|
||||
bool st7565_off(void);
|
||||
|
||||
// Called when st7565_off() turns off the screen, weak function overridable by the user
|
||||
// Not called if the screen is already off
|
||||
void st7565_off_user(void);
|
||||
|
||||
// Returns true if the screen is currently on, false if it is
|
||||
// not
|
||||
bool st7565_is_on(void);
|
||||
|
||||
// Basically it's st7565_render, but with timeout management and st7565_task_user calling!
|
||||
void st7565_task(void);
|
||||
|
||||
// Called at the start of st7565_task, weak function overridable by the user
|
||||
void st7565_task_user(void);
|
||||
|
||||
// Inverts the display
|
||||
// Returns true if the screen was or is inverted
|
||||
bool st7565_invert(bool invert);
|
||||
|
||||
// Returns the maximum number of characters that will fit on a line
|
||||
uint8_t st7565_max_chars(void);
|
||||
|
||||
// Returns the maximum number of lines that will fit on the display
|
||||
uint8_t st7565_max_lines(void);
|
||||
|
||||
void st7565_reset(void);
|
||||
|
||||
spi_status_t st7565_send_cmd(uint8_t cmd);
|
||||
|
||||
spi_status_t st7565_send_data(uint8_t *data, uint16_t length);
|
@@ -34,7 +34,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define DISPLAY_ALL_ON 0xA5
|
||||
#define DISPLAY_ALL_ON_RESUME 0xA4
|
||||
#define NORMAL_DISPLAY 0xA6
|
||||
#define INVERT_DISPLAY 0xA7
|
||||
#define DISPLAY_ON 0xAF
|
||||
#define DISPLAY_OFF 0xAE
|
||||
#define NOP 0xE3
|
||||
@@ -115,7 +114,6 @@ OLED_BLOCK_TYPE oled_dirty = 0;
|
||||
bool oled_initialized = false;
|
||||
bool oled_active = false;
|
||||
bool oled_scrolling = false;
|
||||
bool oled_inverted = false;
|
||||
uint8_t oled_brightness = OLED_BRIGHTNESS;
|
||||
oled_rotation_t oled_rotation = 0;
|
||||
uint8_t oled_rotation_width = 0;
|
||||
@@ -692,30 +690,6 @@ bool oled_scroll_off(void) {
|
||||
return !oled_scrolling;
|
||||
}
|
||||
|
||||
bool oled_invert(bool invert) {
|
||||
if (!oled_initialized) {
|
||||
return oled_inverted;
|
||||
}
|
||||
|
||||
if (invert && !oled_inverted) {
|
||||
static const uint8_t PROGMEM display_inverted[] = {I2C_CMD, INVERT_DISPLAY};
|
||||
if (I2C_TRANSMIT_P(display_inverted) != I2C_STATUS_SUCCESS) {
|
||||
print("oled_invert cmd failed\n");
|
||||
return oled_inverted;
|
||||
}
|
||||
oled_inverted = true;
|
||||
} else if (!invert && oled_inverted) {
|
||||
static const uint8_t PROGMEM display_normal[] = {I2C_CMD, NORMAL_DISPLAY};
|
||||
if (I2C_TRANSMIT_P(display_normal) != I2C_STATUS_SUCCESS) {
|
||||
print("oled_invert cmd failed\n");
|
||||
return oled_inverted;
|
||||
}
|
||||
oled_inverted = false;
|
||||
}
|
||||
|
||||
return oled_inverted;
|
||||
}
|
||||
|
||||
uint8_t oled_max_chars(void) {
|
||||
if (!HAS_FLAGS(oled_rotation, OLED_ROTATION_90)) {
|
||||
return OLED_DISPLAY_WIDTH / OLED_FONT_WIDTH;
|
||||
|
@@ -313,10 +313,6 @@ bool oled_scroll_left(void);
|
||||
// Returns true if the screen was not scrolling or stops scrolling
|
||||
bool oled_scroll_off(void);
|
||||
|
||||
// Inverts the display
|
||||
// Returns true if the screen was or is inverted
|
||||
bool oled_invert(bool invert);
|
||||
|
||||
// Returns the maximum number of characters that will fit on a line
|
||||
uint8_t oled_max_chars(void);
|
||||
|
||||
|
@@ -70,25 +70,28 @@ static uint8_t micro_oled_screen_current[LCDWIDTH * LCDHEIGHT / 8] = {0};
|
||||
D6 D6.............D6 /
|
||||
D7 D7.............D7 ----
|
||||
*/
|
||||
|
||||
#if LCDWIDTH == 64
|
||||
# if LCDHEIGHT == 48
|
||||
#ifdef NO_LCD_SPLASH
|
||||
// do not initialize with a splash screen
|
||||
static uint8_t micro_oled_screen_buffer[LCDWIDTH * LCDHEIGHT / 8] = {0};
|
||||
#else
|
||||
# if LCDWIDTH == 64
|
||||
# if LCDHEIGHT == 48
|
||||
static uint8_t micro_oled_screen_buffer[] = {
|
||||
// QMK Logo - generated at http://www.majer.ch/lcd/adf_bitmap.php
|
||||
// 64x48 image
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0xF8, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0x1F, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x1F, 0xFF, 0xFF, 0xFF, 0xFE, 0xFE, 0xF8, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8C, 0x8C, 0x8C, 0x8C, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8C, 0x8C, 0x8C, 0x8C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x31, 0x31, 0x31, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xF8, 0xF1, 0xE3, 0xE7, 0xCF, 0xCF, 0xCF, 0xCF, 0x00, 0x00, 0xCF, 0xCF, 0xCF, 0xC7, 0xE7, 0xE3, 0xF1, 0xF8, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x31, 0x31, 0x31, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x1F, 0x7F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x7F, 0x1F, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
# endif
|
||||
#elif LCDWIDTH == 128
|
||||
# if LCDHEIGHT == 32
|
||||
# endif
|
||||
# elif LCDWIDTH == 128
|
||||
# if LCDHEIGHT == 32
|
||||
static uint8_t micro_oled_screen_buffer[LCDWIDTH * LCDHEIGHT / 8] = {
|
||||
// 128x32 qmk image
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xE0, 0xFC, 0xFC, 0xE0, 0xFC, 0xFC, 0xE0, 0xF0, 0xFC, 0xE0, 0xE0, 0xFC, 0xE0, 0xE0, 0xFC, 0xFC, 0xE0, 0xE0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x10, 0x10, 0x30, 0xE0, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0xB2, 0xB2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x03, 0xFF, 0xFF, 0xFF, 0x03, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xB7, 0xB2, 0xB2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x02, 0x02, 0x03, 0x01, 0x00, 0x06, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x06, 0x00, 0x03, 0x1E, 0x18, 0x0F, 0x01, 0x0F, 0x18, 0x1E, 0x01, 0x00, 0x0F, 0x1F, 0x12, 0x02, 0x12, 0x13, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x0E, 0x1F, 0x12, 0x02, 0x12, 0x13, 0x00, 0x00, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x4D, 0x4D, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xF8, 0xF9, 0xF3, 0xF3, 0xC0, 0x80, 0xF3, 0xF3, 0xF3, 0xF9, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xED, 0x4D, 0x4D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x20, 0x10, 0x10, 0xE0, 0xC0, 0x00, 0x70, 0xC0, 0x00, 0x80, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x0C, 0x04, 0x04, 0x04, 0x04, 0x1C, 0xF0, 0x00, 0x00, 0xFC, 0x0C, 0x38, 0xE0, 0x00, 0x00, 0xC0, 0x38, 0x0C, 0xFC, 0x00, 0x00, 0xFC, 0xFC, 0x60, 0x90, 0x0C, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x07, 0x3F, 0x3F, 0x07, 0x3F, 0x3F, 0x07, 0x0F, 0x3F, 0x07, 0x07, 0x3F, 0x07, 0x07, 0x3F, 0x3F, 0x07, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x06, 0x04, 0x04, 0x07, 0x01, 0x00, 0x00, 0x13, 0x1E, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x04, 0x04, 0x04, 0x04, 0x07, 0x0D, 0x08, 0x00, 0x07, 0x00, 0x00, 0x01, 0x07, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x07, 0x00, 0x01, 0x03, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
# elif LCDHEIGHT == 64
|
||||
# elif LCDHEIGHT == 64
|
||||
static uint8_t micro_oled_screen_buffer[LCDWIDTH * LCDHEIGHT / 8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xC0, 0xF8, 0xFC, 0xFC, 0xFE, 0xFE, 0xFF, 0x7F, 0x7E, 0xFE, 0xFF, 0xFF, 0xFE, 0xFE, 0x7F, 0x7F, 0xFE, 0xFE, 0xFF, 0xFF, 0xFE, 0x7E, 0x7F, 0xFF, 0xFE, 0xFE, 0xFC, 0xFC, 0xF8, 0xC0, 0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x88, 0x88, 0xDD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDD, 0x88, 0x88, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
@@ -99,10 +102,11 @@ static uint8_t micro_oled_screen_buffer[LCDWIDTH * LCDHEIGHT / 8] = {0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
// TODO: generate bitmap of QMK logo here
|
||||
# endif
|
||||
#else
|
||||
# endif
|
||||
# else
|
||||
// catchall for custom screen sizes
|
||||
static uint8_t micro_oled_screen_buffer[LCDWIDTH * LCDHEIGHT / 8] = {0};
|
||||
# endif
|
||||
#endif
|
||||
|
||||
void micro_oled_init(void) {
|
||||
@@ -145,7 +149,7 @@ void micro_oled_init(void) {
|
||||
#endif
|
||||
|
||||
send_command(MEMORYMODE);
|
||||
send_command(0x10);
|
||||
send_command(0x02); // 0x02 = 10b, Page addressing mode
|
||||
|
||||
send_command(SETCOMPINS); // 0xDA
|
||||
if (LCDHEIGHT > 32) {
|
||||
@@ -250,13 +254,14 @@ void send_buffer(void) {
|
||||
if (micro_oled_screen_buffer[i * LCDWIDTH + j] != micro_oled_screen_current[i * LCDWIDTH + j]) {
|
||||
if (page_addr != i) {
|
||||
set_page_address(i);
|
||||
page_addr = i;
|
||||
}
|
||||
if (col_addr != j) {
|
||||
set_column_address(j);
|
||||
col_addr = j + 1;
|
||||
}
|
||||
send_data(micro_oled_screen_buffer[i * LCDWIDTH + j]);
|
||||
micro_oled_screen_current[i * LCDWIDTH + j] = micro_oled_screen_buffer[i * LCDWIDTH + j];
|
||||
col_addr = j + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,46 +0,0 @@
|
||||
/* Copyright 2021 QMK
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <transactions.h>
|
||||
|
||||
// initiator is transaction start side
|
||||
void soft_serial_initiator_init(void);
|
||||
// target is interrupt accept side
|
||||
void soft_serial_target_init(void);
|
||||
|
||||
// initiator result
|
||||
#define TRANSACTION_END 0
|
||||
#define TRANSACTION_NO_RESPONSE 0x1
|
||||
#define TRANSACTION_DATA_ERROR 0x2
|
||||
#define TRANSACTION_TYPE_ERROR 0x4
|
||||
int soft_serial_transaction(int sstd_index);
|
||||
|
||||
// target status
|
||||
// *SSTD_t.status has
|
||||
// initiator:
|
||||
// TRANSACTION_END
|
||||
// or TRANSACTION_NO_RESPONSE
|
||||
// or TRANSACTION_DATA_ERROR
|
||||
// target:
|
||||
// TRANSACTION_DATA_ERROR
|
||||
// or TRANSACTION_ACCEPTED
|
||||
#define TRANSACTION_ACCEPTED 0x8
|
||||
int soft_serial_get_and_clean_status(int sstd_index);
|
@@ -20,13 +20,6 @@ void eeconfig_init_kb(void) {
|
||||
#ifdef BACKLIGHT_ENABLE
|
||||
backlight_enable();
|
||||
backlight_level(5);
|
||||
#endif
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
rgblight_enable();
|
||||
rgblight_sethsv(0, 255, 255);
|
||||
#ifdef RGBLIGHT_ANIMATIONS
|
||||
rgblight_mode(RGBLIGHT_MODE_RAINBOW_SWIRL + 2);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
eeconfig_update_kb(0);
|
||||
|
@@ -26,6 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* The second converts the arguments into a two-dimensional array which
|
||||
* represents the switch matrix.
|
||||
*/
|
||||
// clang-format off
|
||||
#define LAYOUT( \
|
||||
KA1, KA2, KA3, \
|
||||
KB1, KB2, KB3, \
|
||||
@@ -36,3 +37,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
{ KB1, KB2, KB3 }, \
|
||||
{ KC1, KC2, KC3 } \
|
||||
}
|
||||
// clang-format on
|
||||
|
@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#pragma once
|
||||
|
||||
#include "config_common.h"
|
||||
// clang-format off
|
||||
|
||||
/* USB Device descriptor parameter */
|
||||
#define VENDOR_ID 0xCB00
|
||||
@@ -47,19 +48,26 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#define RGB_DI_PIN D3
|
||||
#ifdef RGB_DI_PIN
|
||||
#define RGBLED_NUM 5
|
||||
#define RGBLED_NUM 4
|
||||
#define RGBLIGHT_HUE_STEP 8
|
||||
#define RGBLIGHT_SAT_STEP 8
|
||||
#define RGBLIGHT_VAL_STEP 8
|
||||
#define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */
|
||||
#define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
|
||||
// #define RGBLIGHT_ANIMATIONS
|
||||
#define RGBLIGHT_EFFECT_BREATHING
|
||||
#define RGBLIGHT_EFFECT_SNAKE
|
||||
#define RGBLIGHT_EFFECT_STATIC_GRADIENT
|
||||
#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
|
||||
#define RGBLIGHT_EFFECT_RAINBOW_MOOD
|
||||
#define RGBLIGHT_ANIMATIONS /* comment this and uncomment the lines below to save space */
|
||||
// #define RGBLIGHT_EFFECT_BREATHING
|
||||
// #define RGBLIGHT_EFFECT_SNAKE
|
||||
// #define RGBLIGHT_EFFECT_STATIC_GRADIENT
|
||||
// #define RGBLIGHT_EFFECT_RAINBOW_SWIRL
|
||||
// #define RGBLIGHT_EFFECT_RAINBOW_MOOD
|
||||
/* default setup after eeprom reset */
|
||||
#define RGBLIGHT_DEFAULT_MODE RGBLIGHT_EFFECT_BREATHING + 2
|
||||
#define RGBLIGHT_DEFAULT_HUE 152
|
||||
#define RGBLIGHT_DEFAULT_SAT 232
|
||||
#define RGBLIGHT_DEFAULT_VAR 255
|
||||
#define RGBLIGHT_DEFAULT_SPD 2
|
||||
#endif
|
||||
// clang-format on
|
||||
|
||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||
#define DEBOUNCE 5
|
||||
|
@@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "progmem.h"
|
||||
|
||||
// clang-format off
|
||||
static const unsigned char font[] PROGMEM = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00,
|
||||
@@ -274,3 +274,4 @@ static const unsigned char font[] PROGMEM = {
|
||||
0x07, 0x07, 0x0F, 0x0F, 0x1E, 0x3E,
|
||||
0x3C, 0x7C, 0x70, 0xC0, 0x80, 0x00,
|
||||
};
|
||||
// clang-format on
|
||||
|
185
keyboards/0xcb/1337/keymaps/conor/keymap.c
Normal file
185
keyboards/0xcb/1337/keymaps/conor/keymap.c
Normal file
@@ -0,0 +1,185 @@
|
||||
/*
|
||||
Copyright 2021 0xCB - Conor Burns
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include QMK_KEYBOARD_H
|
||||
// clang-format off
|
||||
enum layer_names {
|
||||
_HOME,
|
||||
_MISC,
|
||||
_RGB,
|
||||
_BLED
|
||||
};
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[_HOME] = LAYOUT(
|
||||
KC_MPRV, KC_MNXT, KC_MPLY,
|
||||
KC_PGUP, KC_PGDN, TO(3),
|
||||
KC_HOME, KC_END, TO(1)
|
||||
),
|
||||
[_MISC] = LAYOUT(
|
||||
_______, _______, _______,
|
||||
_______, _______, TO(0),
|
||||
_______, _______, TO(2)
|
||||
),
|
||||
[_RGB] = LAYOUT(
|
||||
RGB_HUI, RGB_HUD, RGB_MOD,
|
||||
RGB_SAI, RGB_SAD, TO(1),
|
||||
RGB_SPI, RGB_SPD, TO(3)
|
||||
),
|
||||
[_BLED] = LAYOUT(
|
||||
BL_STEP, BL_BRTG, BL_TOGG,
|
||||
BL_ON, BL_OFF, TO(2),
|
||||
BL_INC, BL_DEC, TO(0)
|
||||
)
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
/* rotary encoder (SW3) - add more else if blocks for more granular layer control */
|
||||
#ifdef ENCODER_ENABLE
|
||||
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||
if (IS_LAYER_ON(_RGB)) {
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
if (clockwise) {
|
||||
rgblight_increase_val();
|
||||
} else {
|
||||
rgblight_decrease_val();
|
||||
}
|
||||
#endif
|
||||
} else if (IS_LAYER_ON(_BLED)) {
|
||||
if (clockwise) {
|
||||
backlight_increase();
|
||||
} else {
|
||||
backlight_decrease();
|
||||
}
|
||||
} else {
|
||||
if (clockwise) {
|
||||
tap_code(KC_VOLU);
|
||||
} else {
|
||||
tap_code(KC_VOLD);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* oled stuff :) */
|
||||
#ifdef OLED_DRIVER_ENABLE
|
||||
uint16_t startup_timer;
|
||||
|
||||
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
|
||||
startup_timer = timer_read();
|
||||
return rotation;
|
||||
}
|
||||
|
||||
static void render_logo(void) {
|
||||
static const char PROGMEM raw_logo[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 64,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 64,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128, 0, 0, 0, 0, 0, 0, 1, 2, 4, 2, 1, 1, 1, 1, 1, 1,255, 0, 0, 0, 0, 0, 0, 0, 0, 0,255, 1, 1, 1, 1, 1, 1, 2, 4, 2, 1, 0, 0, 0, 0, 0, 0,128, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 5,248, 5, 2, 0, 0, 0, 0, 0, 0,128,192,192,224,224,112,120, 56, 63, 28, 14, 14, 14,254, 14, 14, 30, 28, 63, 56,120,112,224,224,192,128, 0, 0, 0, 0, 0, 0, 0, 2, 5,248, 5, 2, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64,160, 19,162, 66, 66, 66, 66, 66, 66, 66,255,255,255, 0, 0, 0,252,254,254,192,192,192,192,255, 0, 0, 0, 62, 62, 60, 60, 0, 0, 1,255,255,255, 66, 66, 66, 66, 66, 66, 66,162, 19,160, 64, 0,
|
||||
0, 0, 0,128, 64, 64, 64,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,192, 64, 64,192,128, 0, 0,192, 64, 64,192,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,192, 64,192, 0, 0, 0, 0, 0,128,192, 64, 64,192,128, 0, 0,128,192, 64, 64,192,128, 0, 0, 64, 64, 64, 64, 64,192, 0, 0, 0, 0, 0,249, 8, 8, 8, 8, 8, 8, 8, 8,127,255,255,192,128,128, 15, 31, 31, 1, 1, 1, 1,255, 0, 0, 0, 30, 30, 14, 14,128,192,192,255,255,127, 8, 8, 8, 8, 8, 8, 8, 8,249, 0, 0, 0,
|
||||
0, 0, 31, 49, 64, 78, 64, 49, 31, 0, 0, 97, 22, 8, 22, 97, 0, 0, 31, 49, 96, 64, 64, 96, 32, 0, 0,127, 68, 68,100, 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 64,127, 64, 64, 0, 0, 0, 32,100, 68, 68,110, 59, 0, 0, 32,100, 68, 68,110, 59, 0, 0, 0, 0, 0,126, 3, 1, 0, 0, 0, 8, 20, 35, 20, 8, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 3, 7, 7, 15,254, 30, 28, 28, 28,255, 28, 28, 28, 30,254, 15, 7, 3, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 4, 10, 17, 10, 4, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 40, 68, 40, 16, 16, 16, 16, 16, 16, 31, 0, 0, 16, 40, 71, 40, 16, 0, 0, 31, 16, 16, 16, 16, 16, 16, 40, 68, 40, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
};
|
||||
oled_write_raw_P(raw_logo, sizeof(raw_logo));
|
||||
}
|
||||
static void render_logo_font(void) {
|
||||
static const char PROGMEM qmk_logo[] = {
|
||||
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xCB, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0xCB, 0xCB, 0xCB, 0x9C, 0x9D, 0xCB, 0xCB,
|
||||
0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xCB, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xCB, 0xCB, 0xBB, 0xBC, 0xBD, 0xBE, 0xCB,
|
||||
0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xCB, 0x88, 0x89, 0x8A, 0x8B, 0x8A, 0x8B, 0x8C, 0x8D, 0xCB, 0xCB, 0xDB, 0xDC, 0xDD, 0xDE, 0xCB,
|
||||
0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xCB, 0xA8, 0xA9, 0xAA, 0xAB, 0xAA, 0xAB, 0xAC, 0xAD, 0xCB, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF, 0x00
|
||||
};
|
||||
|
||||
oled_write_P(qmk_logo, false);
|
||||
}
|
||||
/* Shows the name of the current layer and locks for the host (CAPS etc.) */
|
||||
static void render_info(void) {
|
||||
oled_write_P(PSTR("Layer: "), false);
|
||||
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
case _HOME:
|
||||
oled_write_ln_P(PSTR("HOME"), false);
|
||||
break;
|
||||
case _MISC:
|
||||
oled_write_ln_P(PSTR("MISC"), false);
|
||||
break;
|
||||
case _RGB:
|
||||
oled_write_ln_P(PSTR("RGB"), false);
|
||||
break;
|
||||
case _BLED:
|
||||
oled_write_ln_P(PSTR("Backlight"), false);
|
||||
break;
|
||||
default:
|
||||
oled_write_ln_P(PSTR("Undefined"), false);
|
||||
}
|
||||
led_t led_state = host_keyboard_led_state();
|
||||
oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false);
|
||||
oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false);
|
||||
oled_write_ln_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
|
||||
}
|
||||
static void render_rgbled_status(bool) {
|
||||
char string[4];
|
||||
if (RGBLIGHT_MODES > 1 && rgblight_is_enabled() && get_highest_layer(layer_state) == _RGB) {
|
||||
uint16_t m = rgblight_get_mode();
|
||||
string[3] = '\0';
|
||||
string[2] = '0' + m % 10;
|
||||
string[1] = ( m /= 10) % 10 ? '0' + (m) % 10 : (m / 10) % 10 ? '0' : ' ';
|
||||
string[0] = m / 10 ? '0' + m / 10 : ' ';
|
||||
oled_write_P(PSTR("Conf:"), false);
|
||||
oled_write(string, false);
|
||||
uint16_t h = rgblight_get_hue()/RGBLIGHT_HUE_STEP;
|
||||
string[3] = '\0';
|
||||
string[2] = '0' + h % 10;
|
||||
string[1] = ( h /= 10) % 10 ? '0' + (h) % 10 : (h / 10) % 10 ? '0' : ' ';
|
||||
string[0] = h / 10 ? '0' + h / 10 : ' ';
|
||||
oled_write_P(PSTR(","), false);
|
||||
oled_write(string, false);
|
||||
uint16_t s = rgblight_get_sat()/RGBLIGHT_SAT_STEP;
|
||||
string[3] = '\0';
|
||||
string[2] = '0' + s % 10;
|
||||
string[1] = ( s /= 10) % 10 ? '0' + (s) % 10 : (s / 10) % 10 ? '0' : ' ';
|
||||
string[0] = s / 10 ? '0' + s / 10 : ' ';
|
||||
oled_write_P(PSTR(","), false);
|
||||
oled_write(string, false);
|
||||
uint16_t v = rgblight_get_val()/RGBLIGHT_VAL_STEP;
|
||||
string[3] = '\0';
|
||||
string[2] = '0' + v % 10;
|
||||
string[1] = ( v /= 10) % 10 ? '0' + (v) % 10 : (v / 10) % 10 ? '0' : ' ';
|
||||
string[0] = v / 10 ? '0' + v / 10 : ' ';
|
||||
oled_write_P(PSTR(","), false);
|
||||
oled_write(string, false);
|
||||
oled_write_ln_P(PSTR("\n MOD HUE SAT VAR"), false);
|
||||
} else {
|
||||
oled_write_ln_P(PSTR("\n"), false);
|
||||
}
|
||||
}
|
||||
void oled_task_user(void) {
|
||||
static bool finished_timer = false;
|
||||
if (!finished_timer && (timer_elapsed(startup_timer) < 1000)) {
|
||||
render_logo();
|
||||
} else {
|
||||
if (!finished_timer) {
|
||||
oled_clear();
|
||||
finished_timer = true;
|
||||
}
|
||||
render_info();
|
||||
render_rgbled_status(true);
|
||||
render_logo_font();
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -15,8 +15,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include QMK_KEYBOARD_H
|
||||
#include <stdio.h>
|
||||
|
||||
// clang-format off
|
||||
enum layer_names {
|
||||
_HOME,
|
||||
_MISC,
|
||||
@@ -46,7 +45,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
BL_INC, BL_DEC, TO(0)
|
||||
)
|
||||
};
|
||||
|
||||
// clang-format on
|
||||
|
||||
/* rotary encoder (SW3) - add more else if blocks for more granular layer control */
|
||||
#ifdef ENCODER_ENABLE
|
||||
@@ -100,10 +99,10 @@ static void render_logo(void) {
|
||||
}
|
||||
static void render_logo_font(void) {
|
||||
static const char PROGMEM qmk_logo[] = {
|
||||
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xCB, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0xCB, 0xCB, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9,
|
||||
0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xCB, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xCB, 0xCB, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9,
|
||||
0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xCB, 0x88, 0x89, 0x8A, 0x8B, 0x8A, 0x8B, 0x8C, 0x8D, 0xCB, 0xCB, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5,
|
||||
0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xCB, 0xA8, 0xA9, 0xAA, 0xAB, 0xAA, 0xAB, 0xAC, 0xAD, 0xCB, 0xCB, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0x00
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xC0, 0xC1, 0xC2, 0xC3, 0xC4,
|
||||
0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4,
|
||||
0x88, 0x89, 0x8A, 0x8B, 0x8A, 0x8B, 0x8C, 0x8D, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0,
|
||||
0xA8, 0xA9, 0xAA, 0xAB, 0xAA, 0xAB, 0xAC, 0xAD, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0x00
|
||||
};
|
||||
|
||||
oled_write_P(qmk_logo, false);
|
||||
@@ -133,24 +132,41 @@ static void render_info(void) {
|
||||
oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false);
|
||||
oled_write_ln_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
|
||||
}
|
||||
static void render_rgbled_status(bool full) {
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
char buf[30];
|
||||
if (RGBLIGHT_MODES > 1 && rgblight_is_enabled() && get_highest_layer(layer_state) == _RGB) {
|
||||
if (full) {
|
||||
snprintf(buf, sizeof(buf), "RGB mode %2d: %d,%d,%d \n",
|
||||
rgblight_get_mode(),
|
||||
rgblight_get_hue()/RGBLIGHT_HUE_STEP,
|
||||
rgblight_get_sat()/RGBLIGHT_SAT_STEP,
|
||||
rgblight_get_val()/RGBLIGHT_VAL_STEP);
|
||||
} else {
|
||||
snprintf(buf, sizeof(buf), "[%2d] ", rgblight_get_mode());
|
||||
}
|
||||
oled_write(buf, false);
|
||||
} else {
|
||||
oled_write_ln_P(PSTR("\n"), false);
|
||||
}
|
||||
#endif
|
||||
static void render_rgbled_status(bool) {
|
||||
char string[4];
|
||||
if (RGBLIGHT_MODES > 1 && rgblight_is_enabled() && get_highest_layer(layer_state) == _RGB) {
|
||||
uint16_t m = rgblight_get_mode();
|
||||
string[3] = '\0';
|
||||
string[2] = '0' + m % 10;
|
||||
string[1] = ( m /= 10) % 10 ? '0' + (m) % 10 : (m / 10) % 10 ? '0' : ' ';
|
||||
string[0] = m / 10 ? '0' + m / 10 : ' ';
|
||||
oled_write_P(PSTR("Conf:"), false);
|
||||
oled_write(string, false);
|
||||
uint16_t h = rgblight_get_hue()/RGBLIGHT_HUE_STEP;
|
||||
string[3] = '\0';
|
||||
string[2] = '0' + h % 10;
|
||||
string[1] = ( h /= 10) % 10 ? '0' + (h) % 10 : (h / 10) % 10 ? '0' : ' ';
|
||||
string[0] = h / 10 ? '0' + h / 10 : ' ';
|
||||
oled_write_P(PSTR(","), false);
|
||||
oled_write(string, false);
|
||||
uint16_t s = rgblight_get_sat()/RGBLIGHT_SAT_STEP;
|
||||
string[3] = '\0';
|
||||
string[2] = '0' + s % 10;
|
||||
string[1] = ( s /= 10) % 10 ? '0' + (s) % 10 : (s / 10) % 10 ? '0' : ' ';
|
||||
string[0] = s / 10 ? '0' + s / 10 : ' ';
|
||||
oled_write_P(PSTR(","), false);
|
||||
oled_write(string, false);
|
||||
uint16_t v = rgblight_get_val()/RGBLIGHT_VAL_STEP;
|
||||
string[3] = '\0';
|
||||
string[2] = '0' + v % 10;
|
||||
string[1] = ( v /= 10) % 10 ? '0' + (v) % 10 : (v / 10) % 10 ? '0' : ' ';
|
||||
string[0] = v / 10 ? '0' + v / 10 : ' ';
|
||||
oled_write_P(PSTR(","), false);
|
||||
oled_write(string, false);
|
||||
oled_write_ln_P(PSTR("\n MOD HUE SAT VAR"), false);
|
||||
} else {
|
||||
oled_write_ln_P(PSTR("\n"), false);
|
||||
}
|
||||
}
|
||||
void oled_task_user(void) {
|
||||
static bool finished_timer = false;
|
||||
|
@@ -15,8 +15,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include QMK_KEYBOARD_H
|
||||
#include <stdio.h>
|
||||
|
||||
// clang-format off
|
||||
enum layer_names {
|
||||
_HOME,
|
||||
_MISC,
|
||||
@@ -46,7 +45,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
BL_INC, BL_DEC, TO(0)
|
||||
)
|
||||
};
|
||||
|
||||
// clang-format on
|
||||
|
||||
/* rotary encoder (SW3) - add more else if blocks for more granular layer control */
|
||||
#ifdef ENCODER_ENABLE
|
||||
@@ -100,10 +99,10 @@ static void render_logo(void) {
|
||||
}
|
||||
static void render_logo_font(void) {
|
||||
static const char PROGMEM qmk_logo[] = {
|
||||
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xCB, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0xCB, 0xCB, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9,
|
||||
0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xCB, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xCB, 0xCB, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9,
|
||||
0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xCB, 0x88, 0x89, 0x8A, 0x8B, 0x8A, 0x8B, 0x8C, 0x8D, 0xCB, 0xCB, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5,
|
||||
0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xCB, 0xA8, 0xA9, 0xAA, 0xAB, 0xAA, 0xAB, 0xAC, 0xAD, 0xCB, 0xCB, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0x00
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xC0, 0xC1, 0xC2, 0xC3, 0xC4,
|
||||
0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4,
|
||||
0x88, 0x89, 0x8A, 0x8B, 0x8A, 0x8B, 0x8C, 0x8D, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0,
|
||||
0xA8, 0xA9, 0xAA, 0xAB, 0xAA, 0xAB, 0xAC, 0xAD, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xCB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0x00
|
||||
};
|
||||
|
||||
oled_write_P(qmk_logo, false);
|
||||
@@ -133,24 +132,41 @@ static void render_info(void) {
|
||||
oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false);
|
||||
oled_write_ln_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
|
||||
}
|
||||
static void render_rgbled_status(bool full) {
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
char buf[30];
|
||||
if (RGBLIGHT_MODES > 1 && rgblight_is_enabled() && get_highest_layer(layer_state) == _RGB) {
|
||||
if (full) {
|
||||
snprintf(buf, sizeof(buf), "RGB mode %2d: %d,%d,%d \n",
|
||||
rgblight_get_mode(),
|
||||
rgblight_get_hue()/RGBLIGHT_HUE_STEP,
|
||||
rgblight_get_sat()/RGBLIGHT_SAT_STEP,
|
||||
rgblight_get_val()/RGBLIGHT_VAL_STEP);
|
||||
} else {
|
||||
snprintf(buf, sizeof(buf), "[%2d] ", rgblight_get_mode());
|
||||
}
|
||||
oled_write(buf, false);
|
||||
} else {
|
||||
oled_write_ln_P(PSTR("\n"), false);
|
||||
}
|
||||
#endif
|
||||
static void render_rgbled_status(bool) {
|
||||
char string[4];
|
||||
if (RGBLIGHT_MODES > 1 && rgblight_is_enabled() && get_highest_layer(layer_state) == _RGB) {
|
||||
uint16_t m = rgblight_get_mode();
|
||||
string[3] = '\0';
|
||||
string[2] = '0' + m % 10;
|
||||
string[1] = ( m /= 10) % 10 ? '0' + (m) % 10 : (m / 10) % 10 ? '0' : ' ';
|
||||
string[0] = m / 10 ? '0' + m / 10 : ' ';
|
||||
oled_write_P(PSTR("Conf:"), false);
|
||||
oled_write(string, false);
|
||||
uint16_t h = rgblight_get_hue()/RGBLIGHT_HUE_STEP;
|
||||
string[3] = '\0';
|
||||
string[2] = '0' + h % 10;
|
||||
string[1] = ( h /= 10) % 10 ? '0' + (h) % 10 : (h / 10) % 10 ? '0' : ' ';
|
||||
string[0] = h / 10 ? '0' + h / 10 : ' ';
|
||||
oled_write_P(PSTR(","), false);
|
||||
oled_write(string, false);
|
||||
uint16_t s = rgblight_get_sat()/RGBLIGHT_SAT_STEP;
|
||||
string[3] = '\0';
|
||||
string[2] = '0' + s % 10;
|
||||
string[1] = ( s /= 10) % 10 ? '0' + (s) % 10 : (s / 10) % 10 ? '0' : ' ';
|
||||
string[0] = s / 10 ? '0' + s / 10 : ' ';
|
||||
oled_write_P(PSTR(","), false);
|
||||
oled_write(string, false);
|
||||
uint16_t v = rgblight_get_val()/RGBLIGHT_VAL_STEP;
|
||||
string[3] = '\0';
|
||||
string[2] = '0' + v % 10;
|
||||
string[1] = ( v /= 10) % 10 ? '0' + (v) % 10 : (v / 10) % 10 ? '0' : ' ';
|
||||
string[0] = v / 10 ? '0' + v / 10 : ' ';
|
||||
oled_write_P(PSTR(","), false);
|
||||
oled_write(string, false);
|
||||
oled_write_ln_P(PSTR("\n MOD HUE SAT VAR"), false);
|
||||
} else {
|
||||
oled_write_ln_P(PSTR("\n"), false);
|
||||
}
|
||||
}
|
||||
void oled_task_user(void) {
|
||||
static bool finished_timer = false;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user