mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-08-05 14:08:39 +00:00
Compare commits
312 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ac447d8acb | ||
![]() |
a5e749d8cd | ||
![]() |
4ee623fdd5 | ||
![]() |
751316c344 | ||
![]() |
5d3bf8a050 | ||
![]() |
6501377070 | ||
![]() |
af2ca13604 | ||
![]() |
451c472d1d | ||
![]() |
bfe76053ba | ||
![]() |
9d41281a1d | ||
![]() |
ba5e1f1bae | ||
![]() |
e4823aadec | ||
![]() |
5c9906eb4f | ||
![]() |
f56d333db1 | ||
![]() |
d8f76f9e6d | ||
![]() |
6ca00c2152 | ||
![]() |
dc6fe85b87 | ||
![]() |
883dd2df80 | ||
![]() |
2ac3a51d71 | ||
![]() |
f66680d233 | ||
![]() |
503cf18aed | ||
![]() |
38d2c8cedf | ||
![]() |
53224e03d6 | ||
![]() |
7ef2ea3d49 | ||
![]() |
9e4037465a | ||
![]() |
fd4f102977 | ||
![]() |
6d84795bc1 | ||
![]() |
179e5c018f | ||
![]() |
5246acb2e4 | ||
![]() |
02a8c874f8 | ||
![]() |
dae6f6b39b | ||
![]() |
526c185e7e | ||
![]() |
c63fd051da | ||
![]() |
b95979560c | ||
![]() |
65150984bd | ||
![]() |
205321c377 | ||
![]() |
1816ad01d0 | ||
![]() |
9c8f61dfa0 | ||
![]() |
d1df576ece | ||
![]() |
83ebbf57b3 | ||
![]() |
8e1f706ac6 | ||
![]() |
b0c780ed32 | ||
![]() |
3ad2be52a7 | ||
![]() |
0fbcb41c85 | ||
![]() |
ddca422776 | ||
![]() |
82bb7d2852 | ||
![]() |
1044519f36 | ||
![]() |
209942366b | ||
![]() |
494b34b63f | ||
![]() |
58e3b01f37 | ||
![]() |
6c2008c688 | ||
![]() |
bcedc80ec7 | ||
![]() |
ef5fad137b | ||
![]() |
15dd05c402 | ||
![]() |
32d03db371 | ||
![]() |
c9d396dd47 | ||
![]() |
2afb29e095 | ||
![]() |
fcf150bd82 | ||
![]() |
ee2eb01653 | ||
![]() |
0bece1d442 | ||
![]() |
be69dd22e8 | ||
![]() |
b9675d2106 | ||
![]() |
f689f043b1 | ||
![]() |
54b04d9665 | ||
![]() |
4604c70c4c | ||
![]() |
010c5b12bd | ||
![]() |
4adf4d5a89 | ||
![]() |
d0e0202b27 | ||
![]() |
fb9425df82 | ||
![]() |
22ad35b225 | ||
![]() |
f6cec668c7 | ||
![]() |
2651edc243 | ||
![]() |
2a43989d30 | ||
![]() |
2f5521cd48 | ||
![]() |
ac3d2a3810 | ||
![]() |
1786490993 | ||
![]() |
e55d55edc0 | ||
![]() |
ad014c2539 | ||
![]() |
81698df056 | ||
![]() |
fca35a3540 | ||
![]() |
5d01cc45be | ||
![]() |
eaab0844e8 | ||
![]() |
ce842f912e | ||
![]() |
cceab93baa | ||
![]() |
4161573b28 | ||
![]() |
d0e684ef55 | ||
![]() |
f125406700 | ||
![]() |
afebb6576c | ||
![]() |
7f6ba2bf8a | ||
![]() |
142ebaea46 | ||
![]() |
bbd17def21 | ||
![]() |
d89e552419 | ||
![]() |
9cf69a1997 | ||
![]() |
c6cf1ae4e7 | ||
![]() |
2c9ab8a606 | ||
![]() |
0bf60acc4b | ||
![]() |
6b54f3ce1c | ||
![]() |
c3aaed8dfb | ||
![]() |
ebc274209e | ||
![]() |
1bdfac8afc | ||
![]() |
9b716b7ada | ||
![]() |
b591c0c24a | ||
![]() |
6ba014a572 | ||
![]() |
2dd47a3bf4 | ||
![]() |
887c1c4e0e | ||
![]() |
f66850bfd0 | ||
![]() |
632285c982 | ||
![]() |
805f5cb72b | ||
![]() |
a8a8bf0ff3 | ||
![]() |
fadd3cb461 | ||
![]() |
a41f973f75 | ||
![]() |
7abbc95cd6 | ||
![]() |
30a6f231bf | ||
![]() |
44ff14f290 | ||
![]() |
741c7d5eec | ||
![]() |
f3c30e80cc | ||
![]() |
d846660e00 | ||
![]() |
774384ce31 | ||
![]() |
361ac2f32a | ||
![]() |
d15a60d2d3 | ||
![]() |
73992c68d5 | ||
![]() |
8ca4ed9a98 | ||
![]() |
640d12d070 | ||
![]() |
3beda5c16e | ||
![]() |
fb7fc54923 | ||
![]() |
179c868059 | ||
![]() |
7b11dcce10 | ||
![]() |
e2fa05c6d2 | ||
![]() |
4c4009c0fd | ||
![]() |
e7860d673b | ||
![]() |
2fe7e221ec | ||
![]() |
e0f548085c | ||
![]() |
94fc32f431 | ||
![]() |
1f7bbf279c | ||
![]() |
803610a284 | ||
![]() |
cd0edbb1fb | ||
![]() |
6919772fb9 | ||
![]() |
fedd8e81d1 | ||
![]() |
adda5d7770 | ||
![]() |
d2581884d9 | ||
![]() |
58fd782ce0 | ||
![]() |
8e56d10e4e | ||
![]() |
43868a5e20 | ||
![]() |
db167ecf79 | ||
![]() |
2b8b1045a1 | ||
![]() |
7a6e52b5d8 | ||
![]() |
ae5f7365ea | ||
![]() |
606438692d | ||
![]() |
5d29a13e22 | ||
![]() |
81c648e947 | ||
![]() |
923bad46f9 | ||
![]() |
19513fac5f | ||
![]() |
7bb9c76c80 | ||
![]() |
57e67a4cc8 | ||
![]() |
cf3913cd79 | ||
![]() |
a30cc37c09 | ||
![]() |
b18c261040 | ||
![]() |
bac5d6bc6a | ||
![]() |
ab1650606c | ||
![]() |
dc00942be1 | ||
![]() |
e8f842e798 | ||
![]() |
3745ebc22b | ||
![]() |
d646cba72a | ||
![]() |
15e84f79f1 | ||
![]() |
6f30b402a2 | ||
![]() |
1ff526dac0 | ||
![]() |
e17b55e33a | ||
![]() |
f31bf1b202 | ||
![]() |
5f82b0782f | ||
![]() |
2e6959ed87 | ||
![]() |
c482a2944b | ||
![]() |
65c8ac9ac9 | ||
![]() |
e182a38e7c | ||
![]() |
fe4581c1a1 | ||
![]() |
ddd055b1e2 | ||
![]() |
f7324ec684 | ||
![]() |
3d760caa85 | ||
![]() |
750c7c2bdb | ||
![]() |
4846c8eba0 | ||
![]() |
3de4c3ea6a | ||
![]() |
830bd5460c | ||
![]() |
9f54a26dc0 | ||
![]() |
16a15c1cfc | ||
![]() |
37a4b53c4f | ||
![]() |
a84d239661 | ||
![]() |
41fd60d624 | ||
![]() |
231464c49c | ||
![]() |
d26a14c169 | ||
![]() |
195be50745 | ||
![]() |
8fdb229b66 | ||
![]() |
fd3456f362 | ||
![]() |
812d80efbd | ||
![]() |
86c4c4e91d | ||
![]() |
168ba88ada | ||
![]() |
5f5c2a219c | ||
![]() |
e415198235 | ||
![]() |
b17482c3fd | ||
![]() |
5b4870c046 | ||
![]() |
374525c995 | ||
![]() |
e02a3c559d | ||
![]() |
e1217dae5a | ||
![]() |
485a0b0bc3 | ||
![]() |
23cfc4b145 | ||
![]() |
bd639752db | ||
![]() |
aaeef7a833 | ||
![]() |
0d6614f71f | ||
![]() |
d322ec5452 | ||
![]() |
c7449b3840 | ||
![]() |
4c51049b2b | ||
![]() |
dd60fcda28 | ||
![]() |
fd6b674b49 | ||
![]() |
2c0deb8a13 | ||
![]() |
a904371b29 | ||
![]() |
cfdd105d9d | ||
![]() |
82ae6ee007 | ||
![]() |
f220e7d713 | ||
![]() |
3cb6fb2935 | ||
![]() |
5c666398d5 | ||
![]() |
a47915d2d2 | ||
![]() |
6ec3cc029e | ||
![]() |
4597f2bcc8 | ||
![]() |
52af38da37 | ||
![]() |
b2dbc3f515 | ||
![]() |
86b62eadc2 | ||
![]() |
3337eb10b2 | ||
![]() |
32bab55def | ||
![]() |
47fc2f8855 | ||
![]() |
ee29b515ec | ||
![]() |
c031e13982 | ||
![]() |
84bf82f2c9 | ||
![]() |
af26238385 | ||
![]() |
28e5969f78 | ||
![]() |
59246756e5 | ||
![]() |
423ce39f18 | ||
![]() |
217debff07 | ||
![]() |
52e9719d09 | ||
![]() |
9df367e227 | ||
![]() |
8650b9f10c | ||
![]() |
5c9c45619e | ||
![]() |
09caf19389 | ||
![]() |
4baf49191f | ||
![]() |
427da3c19c | ||
![]() |
1df8bb3cdb | ||
![]() |
99eacdc47a | ||
![]() |
5e235d30c7 | ||
![]() |
6586280bf3 | ||
![]() |
0722986d7a | ||
![]() |
22a10cc8a3 | ||
![]() |
b349fa0a57 | ||
![]() |
e98a9578a1 | ||
![]() |
d2b03bf150 | ||
![]() |
35ca1c2212 | ||
![]() |
ccc8338b0e | ||
![]() |
bafa35ff46 | ||
![]() |
182286680a | ||
![]() |
c1c579c554 | ||
![]() |
19bd8aa942 | ||
![]() |
d0d105b083 | ||
![]() |
c0a57c2a50 | ||
![]() |
738c6612ca | ||
![]() |
643fc1d806 | ||
![]() |
f78896589e | ||
![]() |
837ffd0006 | ||
![]() |
92a50a386a | ||
![]() |
357c6009be | ||
![]() |
e916ce5f3e | ||
![]() |
086a7cf800 | ||
![]() |
99f7fe6bd4 | ||
![]() |
d0c3a4c8d5 | ||
![]() |
2dca087b04 | ||
![]() |
b80340c207 | ||
![]() |
cb4a86475e | ||
![]() |
7e4cf9ace2 | ||
![]() |
0d658e0c95 | ||
![]() |
1522d97c2b | ||
![]() |
2d39a9dcdb | ||
![]() |
33bf4863f5 | ||
![]() |
ad547c1fdd | ||
![]() |
9b70e53508 | ||
![]() |
33a5dc4fcf | ||
![]() |
e0fffcde99 | ||
![]() |
06bffbd45b | ||
![]() |
c261076f8e | ||
![]() |
51ecd37d7b | ||
![]() |
ed5e69093c | ||
![]() |
43785126a7 | ||
![]() |
8c97b4a3a4 | ||
![]() |
0698b15aa5 | ||
![]() |
d600631ad1 | ||
![]() |
f3595f65b7 | ||
![]() |
23df763a31 | ||
![]() |
ed910c8e97 | ||
![]() |
7e1c0bd4c0 | ||
![]() |
d2b8398f75 | ||
![]() |
195324cc4c | ||
![]() |
cd5399942b | ||
![]() |
fd4bbd8d11 | ||
![]() |
f43cb31476 | ||
![]() |
89eb3a9e42 | ||
![]() |
a6bd8fe67b | ||
![]() |
db4b11f866 | ||
![]() |
7a9980fd85 | ||
![]() |
99d9250045 | ||
![]() |
7a0d145e27 | ||
![]() |
d06340f665 | ||
![]() |
4c0065dda7 | ||
![]() |
09a1917103 | ||
![]() |
0499f30f59 | ||
![]() |
e0909a31c7 | ||
![]() |
d6bffdf577 | ||
![]() |
bf38f39c3f | ||
![]() |
62d1d69ba9 |
2
.github/workflows/cli.yml
vendored
2
.github/workflows/cli.yml
vendored
@@ -19,7 +19,7 @@ jobs:
|
||||
container: qmkfm/base_container
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Install dependencies
|
||||
|
7
Makefile
7
Makefile
@@ -29,6 +29,9 @@ $(info QMK Firmware $(QMK_VERSION))
|
||||
endif
|
||||
endif
|
||||
|
||||
# avoid 'Entering|Leaving directory' messages
|
||||
MAKEFLAGS += --no-print-directory
|
||||
|
||||
ON_ERROR := error_occurred=1
|
||||
|
||||
BREAK_ON_ERRORS = no
|
||||
@@ -291,8 +294,8 @@ define PARSE_RULE
|
||||
$$(info | QMK's make format recently changed to use folder locations and colons:)
|
||||
$$(info | make project_folder:keymap[:target])
|
||||
$$(info | Examples:)
|
||||
$$(info | make planck/rev4:default:dfu)
|
||||
$$(info | make planck:default)
|
||||
$$(info | make dz60:default)
|
||||
$$(info | make planck/rev6:default:flash)
|
||||
$$(info |)
|
||||
endif
|
||||
endef
|
||||
|
2
Vagrantfile
vendored
2
Vagrantfile
vendored
@@ -89,7 +89,7 @@ Vagrant.configure(2) do |config|
|
||||
|
||||
Examples:
|
||||
make planck/rev4:default:dfu
|
||||
make planck:default
|
||||
make planck/rev4:default
|
||||
|
||||
EOT
|
||||
end
|
||||
|
@@ -70,7 +70,7 @@ ifeq ($(strip $(POINTING_DEVICE_ENABLE)), yes)
|
||||
SRC += $(QUANTUM_DIR)/pointing_device.c
|
||||
endif
|
||||
|
||||
VALID_EEPROM_DRIVER_TYPES := vendor custom transient i2c
|
||||
VALID_EEPROM_DRIVER_TYPES := vendor custom transient i2c spi
|
||||
EEPROM_DRIVER ?= vendor
|
||||
ifeq ($(filter $(EEPROM_DRIVER),$(VALID_EEPROM_DRIVER_TYPES)),)
|
||||
$(error EEPROM_DRIVER="$(EEPROM_DRIVER)" is not a valid EEPROM driver)
|
||||
@@ -85,6 +85,11 @@ else
|
||||
COMMON_VPATH += $(DRIVER_PATH)/eeprom
|
||||
QUANTUM_LIB_SRC += i2c_master.c
|
||||
SRC += eeprom_driver.c eeprom_i2c.c
|
||||
else ifeq ($(strip $(EEPROM_DRIVER)), spi)
|
||||
OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_SPI
|
||||
COMMON_VPATH += $(DRIVER_PATH)/eeprom
|
||||
QUANTUM_LIB_SRC += spi_master.c
|
||||
SRC += eeprom_driver.c eeprom_spi.c
|
||||
else ifeq ($(strip $(EEPROM_DRIVER)), transient)
|
||||
OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_TRANSIENT
|
||||
COMMON_VPATH += $(DRIVER_PATH)/eeprom
|
||||
|
@@ -6,6 +6,7 @@
|
||||
* [Testing and Debugging](newbs_testing_debugging.md)
|
||||
* [Getting Help/Support](support.md)
|
||||
* [Other Resources](newbs_learn_more_resources.md)
|
||||
* [Syllabus](syllabus.md)
|
||||
|
||||
* FAQs
|
||||
* [General FAQ](faq_general.md)
|
||||
@@ -33,7 +34,9 @@
|
||||
* [Customizing Functionality](custom_quantum_functions.md)
|
||||
* [Driver Installation with Zadig](driver_installation_zadig.md)
|
||||
* [Keymap Overview](keymap.md)
|
||||
* [Vagrant Guide](getting_started_vagrant.md)
|
||||
* Development Environments
|
||||
* [Docker Guide](getting_started_docker.md)
|
||||
* [Vagrant Guide](getting_started_vagrant.md)
|
||||
* Flashing
|
||||
* [Flashing](flashing.md)
|
||||
* [Flashing ATmega32A (ps2avrgb)](flashing_bootloadhid.md)
|
||||
@@ -74,6 +77,7 @@
|
||||
* [Layers](feature_layers.md)
|
||||
* [One Shot Keys](one_shot_keys.md)
|
||||
* [Pointing Device](feature_pointing_device.md)
|
||||
* [Raw HID](feature_rawhid.md)
|
||||
* [Swap Hands](feature_swap_hands.md)
|
||||
* [Tap Dance](feature_tap_dance.md)
|
||||
* [Tap-Hold Configuration](tap_hold.md)
|
||||
@@ -124,6 +128,7 @@
|
||||
* [SPI Driver](spi_driver.md)
|
||||
* [WS2812 Driver](ws2812_driver.md)
|
||||
* [EEPROM Driver](eeprom_driver.md)
|
||||
* ['serial' Driver](serial_driver.md)
|
||||
* [GPIO Controls](internals_gpio_control.md)
|
||||
* [Keyboard Guidelines](hardware_keyboard_guidelines.md)
|
||||
|
||||
|
@@ -102,7 +102,7 @@ This happens immediately after the previous `future` branch is merged.
|
||||
* [ ] Roll up the ChangeLog into one file.
|
||||
* [ ] `git commit -m 'Merge point for <DATE> Breaking Change'`
|
||||
* [ ] `git push origin future`
|
||||
* Github Actions
|
||||
* GitHub Actions
|
||||
* [ ] Create a PR for `future`
|
||||
* [ ] Make sure travis comes back clean
|
||||
* [ ] Merge `future` PR
|
||||
|
@@ -13,18 +13,17 @@ QMK requires Python 3.6 or greater. We try to keep the number of requirements sm
|
||||
If you have installed [Homebrew](https://brew.sh) you can tap and install QMK:
|
||||
|
||||
```
|
||||
brew tap qmk/qmk
|
||||
brew install qmk
|
||||
brew install qmk/qmk/qmk
|
||||
export QMK_HOME='~/qmk_firmware' # Optional, set the location for `qmk_firmware`
|
||||
qmk setup # This will clone `qmk/qmk_firmware` and optionally set up your build environment
|
||||
```
|
||||
|
||||
### Install Using easy_install or pip :id=install-using-easy_install-or-pip
|
||||
### Install Using pip :id=install-using-easy_install-or-pip
|
||||
|
||||
If your system is not listed above you can install QMK manually. First ensure that you have python 3.6 (or later) installed and have installed pip. Then install QMK with this command:
|
||||
If your system is not listed above you can install QMK manually. First ensure that you have Python 3.6 (or later) installed and have installed pip. Then install QMK with this command:
|
||||
|
||||
```
|
||||
pip3 install qmk
|
||||
python3 -m pip install qmk
|
||||
export QMK_HOME='~/qmk_firmware' # Optional, set the location for `qmk_firmware`
|
||||
qmk setup # This will clone `qmk/qmk_firmware` and optionally set up your build environment
|
||||
```
|
||||
|
@@ -6,6 +6,8 @@
|
||||
|
||||
This command allows you to compile firmware from any directory. You can compile JSON exports from <https://config.qmk.fm>, compile keymaps in the repo, or compile the keyboard in the current working directory.
|
||||
|
||||
This command is directory aware. It will automatically fill in KEYBOARD and/or KEYMAP if you are in a keyboard or keymap directory.
|
||||
|
||||
**Usage for Configurator Exports**:
|
||||
|
||||
```
|
||||
@@ -73,8 +75,9 @@ $ qmk compile -kb dz60
|
||||
|
||||
## `qmk flash`
|
||||
|
||||
This command is similar to `qmk compile`, but can also target a bootloader. The bootloader is optional, and is set to `:flash` by default.
|
||||
To specify a different bootloader, use `-bl <bootloader>`. Visit the [Flashing Firmware](flashing.md) guide for more details of the available bootloaders.
|
||||
This command is similar to `qmk compile`, but can also target a bootloader. The bootloader is optional, and is set to `:flash` by default. To specify a different bootloader, use `-bl <bootloader>`. Visit the [Flashing Firmware](flashing.md) guide for more details of the available bootloaders.
|
||||
|
||||
This command is directory aware. It will automatically fill in KEYBOARD and/or KEYMAP if you are in a keyboard or keymap directory.
|
||||
|
||||
**Usage for Configurator Exports**:
|
||||
|
||||
@@ -128,6 +131,32 @@ Check your environment and report problems only:
|
||||
|
||||
qmk doctor -n
|
||||
|
||||
## `qmk info`
|
||||
|
||||
Displays information about keyboards and keymaps in QMK. You can use this to get information about a keyboard, show the layouts, display the underlying key matrix, or to pretty-print JSON keymaps.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```
|
||||
qmk info [-f FORMAT] [-m] [-l] [-km KEYMAP] [-kb KEYBOARD]
|
||||
```
|
||||
|
||||
This command is directory aware. It will automatically fill in KEYBOARD and/or KEYMAP if you are in a keyboard or keymap directory.
|
||||
|
||||
**Examples**:
|
||||
|
||||
Show basic information for a keyboard:
|
||||
|
||||
qmk info -kb planck/rev5
|
||||
|
||||
Show the matrix for a keyboard:
|
||||
|
||||
qmk info -kb ergodox_ez -m
|
||||
|
||||
Show a JSON keymap for a keyboard:
|
||||
|
||||
qmk info -kb clueboard/california -km default
|
||||
|
||||
## `qmk json2c`
|
||||
|
||||
Creates a keymap.c from a QMK Configurator export.
|
||||
@@ -152,6 +181,8 @@ qmk list-keyboards
|
||||
|
||||
This command lists all the keymaps for a specified keyboard (and revision).
|
||||
|
||||
This command is directory aware. It will automatically fill in KEYBOARD if you are in a keyboard directory.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```
|
||||
@@ -162,6 +193,8 @@ qmk list-keymaps -kb planck/ez
|
||||
|
||||
This command creates a new keymap based on a keyboard's existing default keymap.
|
||||
|
||||
This command is directory aware. It will automatically fill in KEYBOARD and/or KEYMAP if you are in a keyboard or keymap directory.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```
|
||||
|
@@ -108,7 +108,7 @@ compile.keymap: skully -> None
|
||||
|-----|---------------|-------------|
|
||||
| user.keyboard | None | The keyboard path (Example: `clueboard/66/rev4`) |
|
||||
| user.keymap | None | The keymap name (Example: `default`) |
|
||||
| user.name | None | The user's github username. |
|
||||
| user.name | None | The user's GitHub username. |
|
||||
|
||||
# All Configuration Options
|
||||
|
||||
|
@@ -210,7 +210,7 @@ Our tests can be found in `lib/python/qmk/tests/`. You will find both unit and i
|
||||
|
||||
If your PR does not include a comprehensive set of tests please add comments like this to your code so that other people know where they can help:
|
||||
|
||||
# TODO(unassigned/<yourGithubUsername>): Write <unit|integration> tests
|
||||
# TODO(unassigned/<your_github_username>): Write <unit|integration> tests
|
||||
|
||||
We use [nose2](https://nose2.readthedocs.io/en/latest/getting_started.html) to run our tests. You can refer to the nose2 documentation for more details on what you can do in your test functions.
|
||||
|
||||
|
@@ -191,7 +191,12 @@ If you define these options you will enable the associated feature, which may in
|
||||
* `#define RGBLIGHT_ANIMATIONS`
|
||||
* run RGB animations
|
||||
* `#define RGBLIGHT_LAYERS`
|
||||
* Lets you define [lighting layers](feature_rgblight.md) that can be toggled on or off. Great for showing the current keyboard layer or caps lock state.
|
||||
* Lets you define [lighting layers](feature_rgblight.md?id=lighting-layers) that can be toggled on or off. Great for showing the current keyboard layer or caps lock state.
|
||||
* `#define RGBLIGHT_MAX_LAYERS`
|
||||
* Defaults to 8. Can be expanded up to 32 if more [lighting layers](feature_rgblight.md?id=lighting-layers) are needed.
|
||||
* Note: Increasing the maximum will increase the firmware size and slow sync on split keyboards.
|
||||
* `#define RGBLIGHT_LAYER_BLINK`
|
||||
* Adds ability to [blink](feature_rgblight.md?id=lighting-layer-blink) a lighting layer for a specified number of milliseconds (e.g. to acknowledge an action).
|
||||
* `#define RGBLED_NUM 12`
|
||||
* number of LEDs
|
||||
* `#define RGBLIGHT_SPLIT`
|
||||
|
@@ -12,7 +12,7 @@ I'll say that again because it's important:
|
||||
|
||||
!> **MAKE SURE YOU SELECT THE RIGHT VERSION!**
|
||||
|
||||
If your keyboard has been advertised to be powered by QMK but is not in the list, chances are a developer hasn't gotten to it yet or we haven't had a chance to merge it in yet. File an issue at [qmk_firmware](https://github.com/qmk/qmk_firmware/issues) requesting to support that particular keyboard, if there is no active [Pull Request](https://github.com/qmk/qmk_firmware/pulls?q=is%3Aopen+is%3Apr+label%3Akeyboard) for it. There are also QMK powered keyboards that are in their manufacturer's own github accounts. Double check for that as well. <!-- FIXME(skullydazed): This feels too wordy and I'm not sure we want to encourage these kinds of issues. Also, should we prompt them to bug the manufacutrer? -->
|
||||
If your keyboard has been advertised to be powered by QMK but is not in the list, chances are a developer hasn't gotten to it yet or we haven't had a chance to merge it in yet. File an issue at [qmk_firmware](https://github.com/qmk/qmk_firmware/issues) requesting to support that particular keyboard, if there is no active [Pull Request](https://github.com/qmk/qmk_firmware/pulls?q=is%3Aopen+is%3Apr+label%3Akeyboard) for it. There are also QMK powered keyboards that are in their manufacturer's own GitHub accounts. Double check for that as well. <!-- FIXME(skullydazed): This feels too wordy and I'm not sure we want to encourage these kinds of issues. Also, should we prompt them to bug the manufacutrer? -->
|
||||
|
||||
## Step 2: Select Your Keyboard Layout
|
||||
|
||||
|
@@ -13,7 +13,7 @@ QMK (*Quantum Mechanical Keyboard*) ist eine Open-Source-Community, welche die Q
|
||||
|
||||
## Bezugsquelle für QMK
|
||||
|
||||
Wenn Du vorhast, deine Tastatur, Tastaturbelegung oder Features zu QMK beizusteuern, geht das am einfachsten, indem Du das [Repository auf Github](https://github.com/qmk/qmk_firmware#fork-destination-box) forkst, die Änderungen in deinem lokalen Repo vornimmst und anschließend einen [Pull Request](https://github.com/qmk/qmk_firmware/pulls) einreichst.
|
||||
Wenn Du vorhast, deine Tastatur, Tastaturbelegung oder Features zu QMK beizusteuern, geht das am einfachsten, indem Du das [Repository auf GitHub](https://github.com/qmk/qmk_firmware#fork-destination-box) forkst, die Änderungen in deinem lokalen Repo vornimmst und anschließend einen [Pull Request](https://github.com/qmk/qmk_firmware/pulls) einreichst.
|
||||
|
||||
Ansonsten kannst Du es als [zip](https://github.com/qmk/qmk_firmware/zipball/master) oder [tar](https://github.com/qmk/qmk_firmware/tarball/master) herunterladen, oder es direkt via git klonen (`git clone git@github.com:qmk/qmk_firmware.git` bzw. `git clone https://github.com/qmk/qmk_firmware.git`).
|
||||
|
||||
|
@@ -11,7 +11,7 @@
|
||||
* [QMK CLI](de/cli.md)
|
||||
* [QMK CLI Konfiguration](de/cli_configuration.md)
|
||||
* [Zu QMK beitragen](de/contributing.md)
|
||||
* [Anleitung für Github](de/getting_started_github.md)
|
||||
* [Anleitung für GitHub](de/getting_started_github.md)
|
||||
* [Nach Hilfe fragen](de/getting_started_getting_help.md)
|
||||
|
||||
* [Breaking Changes](de/breaking_changes.md)
|
||||
|
@@ -6,7 +6,7 @@ Git Ressourcen:
|
||||
|
||||
* [Gutes allgemeines Tutorial](https://www.codecademy.com/learn/learn-git) (auf Englisch)
|
||||
* [Git spielerisch anhand von Beispielen lernen](https://learngitbranching.js.org/) (auf Englisch)
|
||||
* [Mehr über den allgemeinen Umgang mit Github](getting_started_github.md)
|
||||
* [Mehr über den allgemeinen Umgang mit GitHub](getting_started_github.md)
|
||||
* [Mehr über Git im Bezug zu QMK](contributing.md)
|
||||
|
||||
Mehr über die Arbeit mit der Befehlszeile:
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# EEPROM Driver Configuration
|
||||
# EEPROM Driver Configuration :id=eeprom-driver-configuration
|
||||
|
||||
The EEPROM driver can be swapped out depending on the needs of the keyboard, or whether extra hardware is present.
|
||||
|
||||
@@ -6,15 +6,20 @@ Driver | Description
|
||||
-----------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
`EEPROM_DRIVER = vendor` (default) | Uses the on-chip driver provided by the chip manufacturer. For AVR, this is provided by avr-libc. This is supported on ARM for a subset of chips -- STM32F3xx, STM32F1xx, and STM32F072xB will be emulated by writing to flash. STM32L0xx and STM32L1xx will use the onboard dedicated true EEPROM. Other chips will generally act as "transient" below.
|
||||
`EEPROM_DRIVER = i2c` | Supports writing to I2C-based 24xx EEPROM chips. See the driver section below.
|
||||
`EEPROM_DRIVER = spi` | Supports writing to SPI-based 25xx EEPROM chips. See the driver section below.
|
||||
`EEPROM_DRIVER = transient` | Fake EEPROM driver -- supports reading/writing to RAM, and will be discarded when power is lost.
|
||||
|
||||
## Vendor Driver Configuration
|
||||
## Vendor Driver Configuration :id=vendor-eeprom-driver-configuration
|
||||
|
||||
#### STM32 L0/L1 Configuration :id=stm32l0l1-eeprom-driver-configuration
|
||||
|
||||
!> Resetting EEPROM using an STM32L0/L1 device takes up to 1 second for every 1kB of internal EEPROM used.
|
||||
|
||||
No configurable options are available.
|
||||
`config.h` override | Description | Default Value
|
||||
------------------------------------|--------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------
|
||||
`#define STM32_ONBOARD_EEPROM_SIZE` | The size of the EEPROM to use, in bytes. Erase times can be high, so it's configurable here, if not using the default value. | Minimum required to cover base _eeconfig_ data, or `1024` if VIA is enabled.
|
||||
|
||||
## I2C Driver Configuration
|
||||
## I2C Driver Configuration :id=i2c-eeprom-driver-configuration
|
||||
|
||||
Currently QMK supports 24xx-series chips over I2C. As such, requires a working i2c_master driver configuration. You can override the driver configuration via your config.h:
|
||||
|
||||
@@ -41,7 +46,21 @@ MB85RC256V FRAM | `#define EEPROM_I2C_MB85RC256V` | <https://www.adafruit.com/p
|
||||
|
||||
?> If you find that the EEPROM is not cooperating, ensure you've correctly shifted up your EEPROM address by 1. For example, the datasheet might state the address as `0b01010000` -- the correct value of `EXTERNAL_EEPROM_I2C_BASE_ADDRESS` needs to be `0b10100000`.
|
||||
|
||||
## Transient Driver configuration
|
||||
## SPI Driver Configuration :id=spi-eeprom-driver-configuration
|
||||
|
||||
Currently QMK supports 25xx-series chips over SPI. As such, requires a working spi_master driver configuration. You can override the driver configuration via your config.h:
|
||||
|
||||
`config.h` override | Description | Default Value
|
||||
-----------------------------------------------|--------------------------------------------------------------------------------------|--------------
|
||||
`#define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN` | SPI Slave select pin in order to inform that the EEPROM is currently being addressed | _none_
|
||||
`#define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR` | Clock divisor used to divide the peripheral clock to derive the SPI frequency | `64`
|
||||
`#define EXTERNAL_EEPROM_BYTE_COUNT` | Total size of the EEPROM in bytes | 8192
|
||||
`#define EXTERNAL_EEPROM_PAGE_SIZE` | Page size of the EEPROM in bytes, as specified in the datasheet | 32
|
||||
`#define EXTERNAL_EEPROM_ADDRESS_SIZE` | The number of bytes to transmit for the memory location within the EEPROM | 2
|
||||
|
||||
!> There's no way to determine if there is an SPI EEPROM actually responding. Generally, this will result in reads of nothing but zero.
|
||||
|
||||
## Transient Driver configuration :id=transient-eeprom-driver-configuration
|
||||
|
||||
The only configurable item for the transient EEPROM driver is its size:
|
||||
|
||||
|
@@ -13,7 +13,7 @@ QMK (*Quantum Mechanical Keyboard*) es una comunidad open source que mantiene el
|
||||
|
||||
## Cómo conseguirlo
|
||||
|
||||
Si estás pensando en contribuir con un keymap, teclado, or característica a QMK, la manera más sencilla es hacer un [fork del repositorio en Github](https://github.com/qmk/qmk_firmware#fork-destination-box), y clonar tu repositorio localmente para hacer los cambios, subirlos, y abir un [Pull Request](https://github.com/qmk/qmk_firmware/pulls) desde tu fork.
|
||||
Si estás pensando en contribuir con un keymap, teclado, or característica a QMK, la manera más sencilla es hacer un [fork del repositorio en GitHub](https://github.com/qmk/qmk_firmware#fork-destination-box), y clonar tu repositorio localmente para hacer los cambios, subirlos, y abir un [Pull Request](https://github.com/qmk/qmk_firmware/pulls) desde tu fork.
|
||||
|
||||
De cualquier manera, también puedes descargarlo directamente en formatos ([zip](https://github.com/qmk/qmk_firmware/zipball/master), [tar](https://github.com/qmk/qmk_firmware/tarball/master)), o clonarlo via git (`git@github.com:qmk/qmk_firmware.git`), o https (`https://github.com/qmk/qmk_firmware.git`).
|
||||
|
||||
|
@@ -11,7 +11,7 @@
|
||||
* [QMK CLI](es/cli.md)
|
||||
* [Configuración de QMK CLI](es/cli_configuration.md)
|
||||
* [Contribuyendo a QMK](es/contributing.md)
|
||||
* [Cómo usar Github](es/getting_started_github.md)
|
||||
* [Cómo usar GitHub](es/getting_started_github.md)
|
||||
* [Obtener ayuda](es/getting_started_getting_help.md)
|
||||
|
||||
* [Cambios incompatibles](es/breaking_changes.md)
|
||||
|
@@ -6,7 +6,7 @@ Este documento procura instruir a los novatos en las mejores prácticas para ten
|
||||
|
||||
En este documento suponemos un par de cosas:
|
||||
|
||||
1. Tienes una cuenta de Github, y has hecho un [fork del repo qmk_firmware](getting_started_github.md) en tu cuenta.
|
||||
1. Tienes una cuenta de GitHub, y has hecho un [fork del repo qmk_firmware](getting_started_github.md) en tu cuenta.
|
||||
2. Has [configurado tu entorno de desarrollo](newbs_getting_started.md?id=environment-setup).
|
||||
|
||||
|
||||
|
@@ -21,7 +21,7 @@ Lo diré otra vez porque es importante
|
||||
|
||||
!> **ASEGÚRATE DE QUE SELECCIONAS LA VERSIÓN CORRECTA!**
|
||||
|
||||
Si se ha anunciado que tu teclado funciona con QMK pero no está en la lista, es probable que un desarrollador no se haya encargado de él aún o que todavía no hemos tenido la oportunidad de incluirlo. Abre un issue en [qmk_firmware](https://github.com/qmk/qmk_firmware/issues) solicitando soportar ese teclado un particular, si no hay un [Pull Request](https://github.com/qmk/qmk_firmware/pulls?q=is%3Aopen+is%3Apr+label%3Akeyboard) activo para ello. Hay también teclados que funcionan con QMK que están en las cuentas de github de sus manufacturantes. Acuérdate de comprobar esto también.
|
||||
Si se ha anunciado que tu teclado funciona con QMK pero no está en la lista, es probable que un desarrollador no se haya encargado de él aún o que todavía no hemos tenido la oportunidad de incluirlo. Abre un issue en [qmk_firmware](https://github.com/qmk/qmk_firmware/issues) solicitando soportar ese teclado un particular, si no hay un [Pull Request](https://github.com/qmk/qmk_firmware/pulls?q=is%3Aopen+is%3Apr+label%3Akeyboard) activo para ello. Hay también teclados que funcionan con QMK que están en las cuentas de GitHub de sus manufacturantes. Acuérdate de comprobar esto también.
|
||||
|
||||
## Eligiendo el layout de tu teclado
|
||||
|
||||
|
@@ -6,7 +6,7 @@ Recursos de Git:
|
||||
|
||||
* [Excelente tutorial general](https://www.codecademy.com/learn/learn-git)
|
||||
* [Juego de Git para aprender usando ejemplos](https://learngitbranching.js.org/)
|
||||
* [Recursos de Git para aprender más sobre Github](getting_started_github.md)
|
||||
* [Recursos de Git para aprender más sobre GitHub](getting_started_github.md)
|
||||
* [Recursos de Git dirigidos específicamente a QMK](contributing.md)
|
||||
|
||||
|
||||
|
@@ -113,26 +113,16 @@ OPT_DEFS += -DBOOTLOADER_SIZE=2048
|
||||
```
|
||||
|
||||
## `avr-gcc: internal compiler error: Abort trap: 6 (program cc1)` on MacOS
|
||||
|
||||
This is an issue with updating on brew, causing symlinks that avr-gcc depend on getting mangled.
|
||||
|
||||
The solution is to remove and reinstall all affected modules.
|
||||
|
||||
```
|
||||
brew rm avr-gcc
|
||||
brew rm avr-gcc@8
|
||||
brew rm dfu-programmer
|
||||
brew rm dfu-util
|
||||
brew rm gcc-arm-none-eabi
|
||||
brew rm arm-gcc-bin@8
|
||||
brew rm avrdude
|
||||
brew install avr-gcc@8
|
||||
brew install dfu-programmer
|
||||
brew install dfu-util
|
||||
brew install arm-gcc-bin@8
|
||||
brew install avrdude
|
||||
brew rm avr-gcc avr-gcc@8 dfu-programmer dfu-util gcc-arm-none-eabi arm-gcc-bin@8 avrdude qmk
|
||||
brew install qmk/qmk/qmk
|
||||
brew link --force avr-gcc@8
|
||||
brew link --force arm-gcc-bin@8
|
||||
|
||||
```
|
||||
|
||||
### `avr-gcc` and LUFA
|
||||
|
@@ -61,7 +61,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
||||
} else {
|
||||
tap_code(KC_PGUP);
|
||||
}
|
||||
} else if (index == 1) { /* Second encoder */
|
||||
} else if (index == 1) { /* Second encoder */
|
||||
if (clockwise) {
|
||||
tap_code(KC_DOWN);
|
||||
} else {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# HD44780 LCD Displays
|
||||
|
||||
This is an integration of Peter Fleury's LCD library. This page will explain the basics. [For in depth documentation visit his page.](http://homepage.hispeed.ch/peterfleury/doxygen/avr-gcc-libraries/group__pfleury__lcd.html)
|
||||
This is an integration of Peter Fleury's LCD library. This page will explain the basics. [For in depth documentation visit his page.](http://www.peterfleury.epizy.com/doxygen/avr-gcc-libraries/group__pfleury__lcd.html)
|
||||
|
||||
You can enable support for HD44780 Displays by setting the `HD44780_ENABLE` flag in your keyboards `rules.mk` to yes.
|
||||
|
||||
@@ -50,8 +50,8 @@ LCD_DISP_ON_CURSOR_BLINK : display on, cursor on flashing
|
||||
````
|
||||
This is best done in your keyboards `matrix_init_kb` or your keymaps `matrix_init_user`.
|
||||
It is advised to clear the display before use.
|
||||
To do so call `lcd_clrsrc()`.
|
||||
To do so call `lcd_clrscr()`.
|
||||
|
||||
To now print something to your Display you first call `lcd_gotoxy(column, line)`. To go to the start of the first line you would call `lcd_gotoxy(0, 0)` and then print a string with `lcd_puts("example string")`.
|
||||
|
||||
There are more methods available to control the display. [For in depth documentation please visit the linked page.](http://homepage.hispeed.ch/peterfleury/doxygen/avr-gcc-libraries/group__pfleury__lcd.html)
|
||||
There are more methods available to control the display. [For in depth documentation please visit the linked page.](http://www.peterfleury.epizy.com/doxygen/avr-gcc-libraries/group__pfleury__lcd.html)
|
||||
|
@@ -27,20 +27,17 @@ In the following example, a custom key is used to click the mouse and scroll 127
|
||||
|
||||
```c
|
||||
case MS_SPECIAL:
|
||||
report_mouse_t currentReport = pointing_device_get_report();
|
||||
if (record->event.pressed)
|
||||
{
|
||||
report_mouse_t currentReport = pointing_device_get_report();
|
||||
if (record->event.pressed) {
|
||||
currentReport.v = 127;
|
||||
currentReport.h = 127;
|
||||
currentReport.buttons |= MOUSE_BTN1; //this is defined in report.h
|
||||
}
|
||||
else
|
||||
{
|
||||
currentReport.h = 127;
|
||||
currentReport.buttons |= MOUSE_BTN1; // this is defined in report.h
|
||||
} else {
|
||||
currentReport.v = -127;
|
||||
currentReport.h = -127;
|
||||
currentReport.buttons &= ~MOUSE_BTN1;
|
||||
}
|
||||
pointing_device_set_report(currentReport);
|
||||
pointing_device_set_report(currentReport);
|
||||
break;
|
||||
```
|
||||
|
||||
|
69
docs/feature_rawhid.md
Normal file
69
docs/feature_rawhid.md
Normal file
@@ -0,0 +1,69 @@
|
||||
# Raw HID
|
||||
|
||||
Raw HID allows for bidirectional communication between QMK and the host computer over an HID interface. This has many potential use cases, such as switching keymaps on the fly or changing RGB LED colors and modes.
|
||||
|
||||
There are two main components to getting raw HID working with your keyboard.
|
||||
|
||||
## Keyboard firmware
|
||||
|
||||
The implementation is fairly straightforward for the firmware.
|
||||
In your `rules.mk` add:
|
||||
|
||||
```make
|
||||
RAW_ENABLE = yes
|
||||
```
|
||||
|
||||
In your `keymap.c` include `"raw_hid.h"` and implement the following:
|
||||
|
||||
```C
|
||||
void raw_hid_receive(uint8_t *data, uint8_t length) {
|
||||
// Your code goes here. data is the packet received from host.
|
||||
}
|
||||
```
|
||||
|
||||
The `"raw_hid.h"` header also declares `void raw_hid_send(uint8_t *data, uint8_t length);` which allows sending packets from keyboard to host. As an example, it can also be used for debugging when building your host application by returning all data back to the host.
|
||||
|
||||
```C
|
||||
void raw_hid_receive(uint8_t *data, uint8_t length) {
|
||||
raw_hid_send(data, length);
|
||||
}
|
||||
```
|
||||
|
||||
`raw_hid_receive` can receive variable size packets from host with maximum length `RAW_EPSIZE`. `raw_hid_send` on the other hand can send packets to host of exactly `RAW_EPSIZE` length, therefore it should be used with data of length `RAW_EPSIZE`.
|
||||
|
||||
Make sure to flash raw enabled firmware before proceeding with working on the host side.
|
||||
|
||||
## Host (Windows/macOS/Linux)
|
||||
|
||||
This is the more complicated part as it will require some digging.
|
||||
|
||||
To connect your host computer to your keyboard with raw HID you need four pieces of information about your keyboard:
|
||||
|
||||
1. Vendor ID
|
||||
2. Product ID
|
||||
3. Usage Page
|
||||
4. Usage
|
||||
|
||||
The first two can easily be found in your keyboard's `config.h` in the keyboard's main directory under `VENDOR_ID` and `PRODUCT_ID`.
|
||||
|
||||
The final two can be overridden in your keyboard's `config.h` in the keyboard's main directory by redefining the values: `#define RAW_USAGE_PAGE 0xFF60` and `#define RAW_USAGE_ID 0x61`.
|
||||
|
||||
By default, **Usage Page** is `0xFF60` and **Usage** is `0x61`.
|
||||
|
||||
### Building your host
|
||||
|
||||
You can build your host using any language that has an available HID implementation library if you don't wish to make your own. The ones we know of for popular languages are:
|
||||
|
||||
* Node: [node-hid](https://github.com/node-hid/node-hid).
|
||||
* C: [hidapi](https://github.com/libusb/hidapi).
|
||||
* Java: [purejavahidapi](https://github.com/nyholku/purejavahidapi) and [hid4java](https://github.com/gary-rowe/hid4java).
|
||||
* Python: [pyhidapi](https://pypi.org/project/hid/).
|
||||
|
||||
This is not an exhaustive cross-platform list but should get you started. There are no special requirements for using raw HID so any HID library should work.
|
||||
|
||||
Now that you have all four pieces of information required to open HID interface to your keyboard. All you need to do is use your library's available functions to open the device with its ID parameters.
|
||||
|
||||
Note that Vendor ID and Product ID are not actually required to open the device. They are used only to filter to a specific device out of the many HID devices you have plugged in. Many libraries will give you the option to open the device using Product Name or Manufacturer Name instead, `node-hid` being a prime example. This will create issues for devices with builtin USB Hub or any extra HID interfaces where you will have multiple interfaces with the same name or from the same manufacturer. The Vendor ID together with Product ID create a unique designation to a single interface and will not exhibit this problem. Therefore, even if your library doesn't require you to, it is best to use them to avoid issues.
|
||||
Unlike Vendor ID and Product ID though, Usage Page and Usage are necessary for successful communication.
|
||||
|
||||
It should go without saying that regardless of the library you're using, you should always make sure to close the interface when finished. Depending on the operating system and your particular environment there may be issues connecting to it again afterwards with another client or another instance of the same client if it's not explicitly closed.
|
@@ -437,12 +437,16 @@ Where `28` is an unused index from `eeconfig.h`.
|
||||
|`rgb_matrix_sethsv_noeeprom(h, s, v)` |Set LEDs to the given HSV value where `h`/`s`/`v` are between 0 and 255 (not written to EEPROM) |
|
||||
|
||||
### Query Current Status :id=query-current-status
|
||||
|Function |Description |
|
||||
|-----------------------|-----------------|
|
||||
|`rgb_matrix_get_mode()` |Get current mode |
|
||||
|`rgb_matrix_get_hue()` |Get current hue |
|
||||
|`rgb_matrix_get_sat()` |Get current sat |
|
||||
|`rgb_matrix_get_val()` |Get current val |
|
||||
|Function |Description |
|
||||
|---------------------------------|---------------------------|
|
||||
|`rgb_matrix_is_enabled()` |Gets current on/off status |
|
||||
|`rgb_matrix_get_mode()` |Gets current mode |
|
||||
|`rgb_matrix_get_hue()` |Gets current hue |
|
||||
|`rgb_matrix_get_sat()` |Gets current sat |
|
||||
|`rgb_matrix_get_val()` |Gets current val |
|
||||
|`rgb_matrix_get_hsv()` |Gets hue, sat, and val and returns a [`HSV` structure](https://github.com/qmk/qmk_firmware/blob/7ba6456c0b2e041bb9f97dbed265c5b8b4b12192/quantum/color.h#L56-L61)|
|
||||
|`rgb_matrix_get_speed()` |Gets current speed |
|
||||
|`rgb_matrix_get_suspend_state()` |Gets current suspend state |
|
||||
|
||||
## Callbacks :id=callbacks
|
||||
|
||||
|
@@ -94,6 +94,7 @@ if `RGBLIGHT_EFFECT_xxxx` or `RGBLIGHT_ANIMATIONS` is defined, you also have a n
|
||||
|`RGBLIGHT_MODE_STATIC_GRADIENT`| 0,1,..,9 |Static gradient |
|
||||
|`RGBLIGHT_MODE_RGB_TEST` | *None* |RGB Test |
|
||||
|`RGBLIGHT_MODE_ALTERNATING` | *None* |Alternating |
|
||||
|`RGBLIGHT_MODE_TWINKLE` | 0,1,2,3,4,5 |Twinkle |
|
||||
|
||||
Check out [this video](https://youtube.com/watch?v=VKrpPAHlisY) for a demonstration.
|
||||
|
||||
@@ -103,8 +104,8 @@ Note: For versions older than 0.6.117, The mode numbers were written directly. I
|
||||
|
||||
Use these defines to add or remove animations from the firmware. When you are running low on flash space, it can be helpful to disable animations you are not using.
|
||||
|
||||
|Define |Default |Description |
|
||||
|------------------------------------|-------------|-------------------------------------------------------------------------------------|
|
||||
|Define |Default |Description |
|
||||
|------------------------------------|-------------|-------------------------------------------------------------------------|
|
||||
|`RGBLIGHT_ANIMATIONS` |*Not defined*|Enable all additional animation modes. |
|
||||
|`RGBLIGHT_EFFECT_ALTERNATING` |*Not defined*|Enable alternating animation mode. |
|
||||
|`RGBLIGHT_EFFECT_BREATHING` |*Not defined*|Enable breathing animation mode. |
|
||||
@@ -115,6 +116,7 @@ Use these defines to add or remove animations from the firmware. When you are ru
|
||||
|`RGBLIGHT_EFFECT_RGB_TEST` |*Not defined*|Enable RGB test animation mode. |
|
||||
|`RGBLIGHT_EFFECT_SNAKE` |*Not defined*|Enable snake animation mode. |
|
||||
|`RGBLIGHT_EFFECT_STATIC_GRADIENT` |*Not defined*|Enable static gradient mode. |
|
||||
|`RGBLIGHT_EFFECT_TWINKLE` |*Not defined*|Enable twinkle animation mode. |
|
||||
|
||||
### Effect and Animation Settings
|
||||
|
||||
@@ -131,6 +133,8 @@ The following options are used to tweak the various animations:
|
||||
|`RGBLIGHT_EFFECT_KNIGHT_OFFSET` |`0` |The number of LEDs to start the "Knight" animation from the start of the strip by |
|
||||
|`RGBLIGHT_RAINBOW_SWIRL_RANGE` |`255` |Range adjustment for the rainbow swirl effect to get different swirls |
|
||||
|`RGBLIGHT_EFFECT_SNAKE_LENGTH` |`4` |The number of LEDs to light up for the "Snake" animation |
|
||||
|`RGBLIGHT_EFFECT_TWINKLE_LIFE` |`75` |Adjusts how quickly each LED brightens and dims when twinkling (in animation steps) |
|
||||
|`RGBLIGHT_EFFECT_TWINKLE_PROBABILITY`|`1/127` |Adjusts how likely each LED is to twinkle (on each animation step) |
|
||||
|
||||
### Example Usage to Reduce Memory Footprint
|
||||
1. Remove `RGBLIGHT_ANIMATIONS` from `config.h`.
|
||||
@@ -168,6 +172,9 @@ const uint8_t RGBLED_SNAKE_INTERVALS[] PROGMEM = {100, 50, 20};
|
||||
// How long (in milliseconds) to wait between animation steps for each of the "Knight" animations
|
||||
const uint8_t RGBLED_KNIGHT_INTERVALS[] PROGMEM = {127, 63, 31};
|
||||
|
||||
// How long (in milliseconds) to wait between animation steps for each of the "Twinkle" animations
|
||||
const uint8_t RGBLED_TWINKLE_INTERVALS[] PROGMEM = {50, 25, 10};
|
||||
|
||||
// These control which hues are selected for each of the "Static gradient" modes
|
||||
const uint8_t RGBLED_GRADIENT_RANGES[] PROGMEM = {255, 170, 127, 85, 64};
|
||||
```
|
||||
@@ -177,6 +184,10 @@ const uint8_t RGBLED_GRADIENT_RANGES[] PROGMEM = {255, 170, 127, 85, 64};
|
||||
By including `#define RGBLIGHT_LAYERS` in your `config.h` file you can enable lighting layers. These make
|
||||
it easy to use your underglow LEDs as status indicators to show which keyboard layer is currently active, or the state of caps lock, all without disrupting any animations. [Here's a video](https://youtu.be/uLGE1epbmdY) showing an example of what you can do.
|
||||
|
||||
### Defining Lighting Layers :id=defining-lighting-layers
|
||||
|
||||
By default, 8 layers are possible. This can be expanded to as many as 32 by overriding the definition of `RGBLIGHT_MAX_LAYERS` in `config.h` (e.g. `#define RGBLIGHT_MAX_LAYERS 32`). Please note, if you use a split keyboard, you will need to flash both sides of the split after changing this. Also, increasing the maximum will increase the firmware size, and will slow sync on split keyboards.
|
||||
|
||||
To define a layer, we modify `keymap.c` to list out LED ranges and the colors we want to overlay on them using an array of `rgblight_segment_t` using the `RGBLIGHT_LAYER_SEGMENTS` macro. We can define multiple layers and enable/disable them independently:
|
||||
|
||||
```c
|
||||
@@ -211,8 +222,12 @@ void keyboard_post_init_user(void) {
|
||||
rgblight_layers = my_rgb_layers;
|
||||
}
|
||||
```
|
||||
Note: For split keyboards with two controllers, both sides need to be flashed when updating the contents of rgblight_layers.
|
||||
|
||||
Finally, we enable and disable the lighting layers whenever the state of the keyboard changes:
|
||||
### Enabling and disabling lighting layers :id=enabling-lighting-layers
|
||||
|
||||
Everything above just configured the definition of each lighting layer.
|
||||
We can now enable and disable the lighting layers whenever the state of the keyboard changes:
|
||||
|
||||
```c
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
@@ -228,7 +243,40 @@ bool led_update_user(led_t led_state) {
|
||||
}
|
||||
```
|
||||
|
||||
Note: For split keyboards with two controllers, both sides need to be flashed when updating the contents of rgblight_layers.
|
||||
### Lighting layer blink :id=lighting-layer-blink
|
||||
|
||||
By including `#define RGBLIGHT_LAYER_BLINK` in your `config.h` file you can turn a lighting
|
||||
layer on for a specified duration. Once the specified number of milliseconds has elapsed
|
||||
the layer will be turned off. This is useful, e.g., if you want to acknowledge some
|
||||
action (e.g. toggling some setting):
|
||||
|
||||
```c
|
||||
const rgblight_segment_t PROGMEM _yes_layer[] = RGBLIGHT_LAYER_SEGMENTS( {9, 6, HSV_GREEN} );
|
||||
const rgblight_segment_t PROGMEM _no_layer[] = RGBLIGHT_LAYER_SEGMENTS( {9, 6, HSV_RED} );
|
||||
|
||||
const rgblight_segment_t* const PROGMEM _rgb_layers[] =
|
||||
RGBLIGHT_LAYERS_LIST( _yes_layer, _no_layer );
|
||||
|
||||
void keyboard_post_init_user(void) {
|
||||
rgblight_layers = _rgb_layers;
|
||||
}
|
||||
|
||||
// Note we user post_process_record_user because we want the state
|
||||
// after the flag has been flipped...
|
||||
void post_process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case DEBUG:
|
||||
rgblight_blink_layer(debug_enable ? 0 : 1, 500);
|
||||
break;
|
||||
|
||||
case NK_TOGG:
|
||||
case NK_ON:
|
||||
case NK_OFF:
|
||||
rgblight_blink_layer(keymap_config.nkro ? 0 : 1, 500);
|
||||
break;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Functions
|
||||
|
||||
@@ -328,12 +376,14 @@ rgblight_sethsv(HSV_GREEN, 2); // led 2
|
||||
|`rgblight_set_layer_state(i, is_on)` |Enable or disable lighting layer `i` based on value of `bool is_on` |
|
||||
|
||||
#### query
|
||||
|Function |Description |
|
||||
|-----------------------|-----------------|
|
||||
|`rgblight_get_mode()` |Get current mode |
|
||||
|`rgblight_get_hue()` |Get current hue |
|
||||
|`rgblight_get_sat()` |Get current sat |
|
||||
|`rgblight_get_val()` |Get current val |
|
||||
|Function |Description |
|
||||
|-----------------------|---------------------------|
|
||||
|`rgblight_is_enabled()`|Gets current on/off status |
|
||||
|`rgblight_get_mode()` |Gets current mode |
|
||||
|`rgblight_get_hue()` |Gets current hue |
|
||||
|`rgblight_get_sat()` |Gets current sat |
|
||||
|`rgblight_get_val()` |Gets current val |
|
||||
|`rgblight_get_speed()` |Gets current speed |
|
||||
|
||||
## Colors
|
||||
|
||||
|
@@ -8,9 +8,20 @@ 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 is not yet supported for Split Keyboards. Progress is being made, but we are not quite there, yet.
|
||||
!> 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
|
||||
|
||||
| Transport | AVR | ARM |
|
||||
|------------------------------|--------------------|--------------------|
|
||||
| ['serial'](serial_driver.md) | :heavy_check_mark: | :white_check_mark: <sup>1</sup> |
|
||||
| I2C | :heavy_check_mark: | |
|
||||
|
||||
Notes:
|
||||
|
||||
1. Both hardware and software limitations are detailed within the [driver documentation](serial_driver.md).
|
||||
|
||||
## Hardware Configuration
|
||||
|
||||
This assumes that you're using two Pro Micro-compatible controllers, and are using TRRS jacks to connect to two halves.
|
||||
|
@@ -28,3 +28,4 @@ Note that the array indices are reversed same as the matrix and the values are o
|
||||
|`SH_MOFF` |Momentarily turns off swap. |
|
||||
|`SH_TG` |Toggles swap on and off with every key press. |
|
||||
|`SH_TT` |Toggles with a tap; momentary when held. |
|
||||
|`SH_OS` |One shot swap hands: toggles while pressed or until next key press. |
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# Userspace: Sharing Code Between Keymaps
|
||||
|
||||
If you use more than one keyboard with a similar keymap, you might see the benefit in being able to share code between them. Create your own folder in `users/` named the same as your keymap (ideally your github username, `<name>`) with the following structure:
|
||||
If you use more than one keyboard with a similar keymap, you might see the benefit in being able to share code between them. Create your own folder in `users/` named the same as your keymap (ideally your GitHub username, `<name>`) with the following structure:
|
||||
|
||||
* `/users/<name>/` (added to the path automatically)
|
||||
* `readme.md` (optional, recommended)
|
||||
@@ -73,7 +73,7 @@ The reason for this, is that `<name>.h` won't be added in time to add settings (
|
||||
|
||||
## Readme (`readme.md`)
|
||||
|
||||
Please include authorship (your name, github username, email), and optionally [a license that's GPL compatible](https://www.gnu.org/licenses/license-list.html#GPLCompatibleLicenses).
|
||||
Please include authorship (your name, GitHub username, email), and optionally [a license that's GPL compatible](https://www.gnu.org/licenses/license-list.html#GPLCompatibleLicenses).
|
||||
|
||||
You can use this as a template:
|
||||
```
|
||||
@@ -93,7 +93,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/>.
|
||||
```
|
||||
|
||||
You'd want to replace the year, name, email and github username with your info.
|
||||
You'd want to replace the year, name, email and GitHub username with your info.
|
||||
|
||||
Additionally, this is a good place to document your code, if you wish to share it with others.
|
||||
|
||||
|
@@ -4,8 +4,8 @@
|
||||
[](https://travis-ci.org/qmk/qmk_firmware)
|
||||
[](https://discord.gg/Uq7gcHh)
|
||||
[](https://docs.qmk.fm)
|
||||
[](https://github.com/qmk/qmk_firmware/pulse/monthly)
|
||||
[](https://github.com/qmk/qmk_firmware/)
|
||||
[](https://github.com/qmk/qmk_firmware/pulse/monthly)
|
||||
[](https://github.com/qmk/qmk_firmware/)
|
||||
|
||||
## Qu'est-ce que QMK Firmware ?
|
||||
|
||||
@@ -13,7 +13,7 @@ QMK (*Quantum Mechanical Keyboard*) est une communauté open source qui maintien
|
||||
|
||||
## Comment l'obtenir
|
||||
|
||||
Si vous souhaitez contribuer à une disposition de clavier (keymap), ou à des fonctionnalités de QMK alors le plus simple est de [forker le dépôt avec Github](https://github.com/qmk/qmk_firmware#fork-destination-box) puis cloner le dépôt localement pour y faire des changements. Vous pourrez pousser vos changements sur github puis ouvrir un [Pull Request](https://github.com/qmk/qmk_firmware/pulls) depuis votre fork Github.
|
||||
Si vous souhaitez contribuer à une disposition de clavier (keymap), ou à des fonctionnalités de QMK alors le plus simple est de [forker le dépôt avec GitHub](https://github.com/qmk/qmk_firmware#fork-destination-box) puis cloner le dépôt localement pour y faire des changements. Vous pourrez pousser vos changements sur GitHub puis ouvrir un [Pull Request](https://github.com/qmk/qmk_firmware/pulls) depuis votre fork GitHub.
|
||||
|
||||
Sinon, vous pouvez aussi le télécharger directement en ([zip](https://github.com/qmk/qmk_firmware/zipball/master), [tar](https://github.com/qmk/qmk_firmware/tarball/master)), ou le cloner avec git en ssh (`git@github.com:qmk/qmk_firmware.git`), ou https (`https://github.com/qmk/qmk_firmware.git`).
|
||||
|
||||
|
@@ -101,7 +101,7 @@ Ceci est fait immédiatement après la fusion de la branche `future` précédent
|
||||
* [ ] Regroupe ChangeLog dans un fichier.
|
||||
* [ ] `git commit -m 'Merge point for <DATE> Breaking Change'`
|
||||
* [ ] `git push origin future`
|
||||
* Actions sur Github
|
||||
* Actions sur GitHub
|
||||
* [ ] Crée un PR pour `future`
|
||||
* [ ] S'assurer que Travis ne relève aucun problème
|
||||
* [ ] Fusion le PR `future`
|
||||
|
@@ -6,11 +6,11 @@ GitHub peut être un peu compliqué pour ceux qui n'y sont pas familier. Ce guid
|
||||
|
||||
Commencez par la [page GitHub de QMK](https://github.com/qmk/qmk_firmware), et vous verrez un bouton dans le coin en haut à droite qui indique "Fork":
|
||||
|
||||

|
||||

|
||||
|
||||
Si vous faites partie d'une organisation, vous aurez besoin de savoir quel compte utiliser pour le fork. Dans la plupart des cas, vous voudrez créer le fork dans votre compte personnel. Une fois le fork complet (cela peut quelques fois prendre un peu de temps), appuyez sur le bouton "Clone or download":
|
||||
|
||||

|
||||

|
||||
|
||||
Faites attention à sélectionner "HTTPS", et sélectionnez le lien et copiez-le:
|
||||
|
||||
|
@@ -44,7 +44,7 @@ git pull upstream master
|
||||
git push origin master
|
||||
```
|
||||
|
||||
Cela vous change la branche courante en master, synchronise les données de références du dépôt QMK vers votre ordinateur. La commande pull tire les données de références vers votre branche courante puis les y téleverse. La commande push permet de pousser la branche courante (master) vers votre fork github.
|
||||
Cela vous change la branche courante en master, synchronise les données de références du dépôt QMK vers votre ordinateur. La commande pull tire les données de références vers votre branche courante puis les y téleverse. La commande push permet de pousser la branche courante (master) vers votre fork GitHub.
|
||||
|
||||
### Faire des changements
|
||||
|
||||
|
47
docs/getting_started_docker.md
Normal file
47
docs/getting_started_docker.md
Normal file
@@ -0,0 +1,47 @@
|
||||
# Docker Quick Start
|
||||
|
||||
This project includes a Docker workflow that will allow you to build a new firmware for your keyboard very easily without major changes to your primary operating system. This also ensures that when you clone the project and perform a build, you have the exact same environment as anyone else and the QMK build infrastructure. This makes it much easier for people to help you troubleshoot any issues you encounter.
|
||||
|
||||
## Requirements
|
||||
|
||||
The main prerequisite is a working `docker` install.
|
||||
* [Docker CE](https://docs.docker.com/install/#supported-platforms)
|
||||
|
||||
## Usage
|
||||
|
||||
Acquire a local copy of the QMK's repository (including submodules):
|
||||
|
||||
```bash
|
||||
git clone --recurse-submodules https://github.com/qmk/qmk_firmware.git
|
||||
cd qmk_firmware
|
||||
```
|
||||
|
||||
Run the following command to build a keymap:
|
||||
```bash
|
||||
util/docker_build.sh <keyboard>:<keymap>
|
||||
# For example: util/docker_build.sh planck/rev6:default
|
||||
```
|
||||
|
||||
This will compile the desired keyboard/keymap and leave the resulting `.hex` or `.bin` file in the QMK directory for you to flash. If `:keymap` is omitted, all keymaps are used. Note that the parameter format is the same as when building with `make`.
|
||||
|
||||
There is also support for building _and_ flashing the keyboard straight from Docker by specifying the `target` as well:
|
||||
|
||||
```bash
|
||||
util/docker_build.sh keyboard:keymap:target
|
||||
# For example: util/docker_build.sh planck/rev6:default:flash
|
||||
```
|
||||
|
||||
You can also start the script without any parameters, in which case it will ask you to input the build parameters one by one, which you may find easier to use:
|
||||
|
||||
```bash
|
||||
util/docker_build.sh
|
||||
# Reads parameters as input (leave blank for all keyboards/keymaps)
|
||||
```
|
||||
|
||||
## FAQ
|
||||
|
||||
### Why can't I flash on Windows/macOS
|
||||
|
||||
On Windows and macOS, it requires [Docker Machine](http://gw.tnode.com/docker/docker-machine-with-usb-support-on-windows-macos/) to be running. This is tedious to set up, so it's not recommended; use [QMK Toolbox](https://github.com/qmk/qmk_toolbox) instead.
|
||||
|
||||
!> Docker for Windows requires [Hyper-V](https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v) to be enabled. This means that it cannot work on versions of Windows which don't have Hyper-V, such as Windows 7, Windows 8 and **Windows 10 Home**.
|
@@ -1,16 +1,16 @@
|
||||
# How to Use Github with QMK
|
||||
# How to Use GitHub with QMK
|
||||
|
||||
Github can be a little tricky to those that aren't familiar with it - this guide will walk through each step of forking, cloning, and submitting a pull request with QMK.
|
||||
GitHub can be a little tricky to those that aren't familiar with it - this guide will walk through each step of forking, cloning, and submitting a pull request with QMK.
|
||||
|
||||
?> This guide assumes you're somewhat comfortable with running things at the command line, and have git installed on your system.
|
||||
|
||||
Start on the [QMK Github page](https://github.com/qmk/qmk_firmware), and you'll see a button in the upper right that says "Fork":
|
||||
Start on the [QMK GitHub page](https://github.com/qmk/qmk_firmware), and you'll see a button in the upper right that says "Fork":
|
||||
|
||||

|
||||

|
||||
|
||||
If you're a part of an organization, you'll need to choose which account to fork it to. In most circumstances, you'll want to fork it to your personal account. Once your fork is completed (sometimes this takes a little while), click the "Clone or Download" button:
|
||||
|
||||

|
||||

|
||||
|
||||
And be sure to select "HTTPS", and select the link and copy it:
|
||||
|
||||
@@ -54,7 +54,7 @@ To https://github.com/whoeveryouare/qmk_firmware.git
|
||||
+ 20043e64...7da94ac5 master -> master
|
||||
```
|
||||
|
||||
Your changes now exist on your fork on Github - if you go back there (`https://github.com/<whoeveryouare>/qmk_firmware`), you can create a "New Pull Request" by clicking this button:
|
||||
Your changes now exist on your fork on GitHub - if you go back there (`https://github.com/<whoeveryouare>/qmk_firmware`), you can create a "New Pull Request" by clicking this button:
|
||||
|
||||

|
||||
|
||||
|
@@ -14,7 +14,7 @@ QMK (*Quantum Mechanical Keyboard*) היא קהילת קוד פתוח (open sour
|
||||
|
||||
## איך להשיג אותה
|
||||
|
||||
אם אתם מתכננים לתרום מיפוי מקשים, מקלדת או יכולת ל QMK, הדבר הקל ביותר הוא [לעשות פורק לריפו בGithub](https://github.com/qmk/qmk_firmware#fork-destination-box), ולעשות קלון לריפו בסביבה המקומית ושם לבצע את השינויים שלכם, לדחוף אותם ולפתוח [Pull Request](https://github.com/qmk/qmk_firmware/pulls) מהפורק שלך.
|
||||
אם אתם מתכננים לתרום מיפוי מקשים, מקלדת או יכולת ל QMK, הדבר הקל ביותר הוא [לעשות פורק לריפו בGitHub](https://github.com/qmk/qmk_firmware#fork-destination-box), ולעשות קלון לריפו בסביבה המקומית ושם לבצע את השינויים שלכם, לדחוף אותם ולפתוח [Pull Request](https://github.com/qmk/qmk_firmware/pulls) מהפורק שלך.
|
||||
|
||||
אחרת, אפשר להוריד את הקושחה באופן ישיר ([zip](https://github.com/qmk/qmk_firmware/zipball/master), [tar](https://github.com/qmk/qmk_firmware/tarball/master)), או לשכפל אותה באמצעות git (`git@github.com:qmk/qmk_firmware.git`), או https (`https://github.com/qmk/qmk_firmware.git`).
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* [מקורות ללמידה](he-il/newbs_learn_more_resources.md)
|
||||
* [בסיס QMK](he-il/README.md)
|
||||
* [מבוא לQMK](he-il/getting_started_introduction.md)
|
||||
* [איך להשתמש בGithub](he-il/getting_started_github.md)
|
||||
* [איך להשתמש בGitHub](he-il/getting_started_github.md)
|
||||
* [קבלת עזרה](he-il/getting_started_getting_help.md)
|
||||
* [שאלות נפוצות](he-il/faq.md)
|
||||
* [שאלות נפוצות כלליות](he-il/faq_general.md)
|
||||
@@ -27,7 +27,7 @@
|
||||
* [QMK CLI](he-il/cli.md)
|
||||
* [QMK CLI Config](he-il/cli_configuration.md)
|
||||
* [תרומה ל QMK](he-il/contributing.md)
|
||||
* [איך להשתמש בGithub](he-il/getting_started_github.md)
|
||||
* [איך להשתמש בGitHub](he-il/getting_started_github.md)
|
||||
* [קבלת עזרה](he-il/getting_started_getting_help.md)
|
||||
|
||||
* [שינויים משמעותיים](he-il/breaking_changes.md)
|
||||
|
@@ -11,7 +11,7 @@
|
||||
|
||||
הפורום הרשמי של QMK נמצא ב - [/r/olkb](https://reddit.com/r/olkb) באתר [reddit.com](https://reddit.com).
|
||||
|
||||
## סוגיות Github
|
||||
## סוגיות GitHub
|
||||
|
||||
ניתן לפתוח [סוגייה ב-GitHub](https://github.com/qmk/qmk_firmware/issues). הדבר שימושי במיוחד כאשר הסוגיה דורשת דיון עמוק וארוך או דיבאגינג.
|
||||
</div>
|
@@ -1,17 +1,17 @@
|
||||
<div dir="rtl" markdown="1">
|
||||
# איך להשתמש ב-Github עם QMK
|
||||
# איך להשתמש ב-GitHub עם QMK
|
||||
|
||||
Github עלול להיות קצת טריקי למי שלא מכיר את העבודה איתו - מדריך זה ילווה אתכם שלב אחר שלב דרך ביצוע פעולות fork, clone ו-pull request עם QMK.
|
||||
GitHub עלול להיות קצת טריקי למי שלא מכיר את העבודה איתו - מדריך זה ילווה אתכם שלב אחר שלב דרך ביצוע פעולות fork, clone ו-pull request עם QMK.
|
||||
|
||||
?> מדריך זה מניח שאתם מרגישים בנוח עם הרצה של פקודות בסביבת command line (שורת הפקודה) ו-git מותקן במערכת שלכם.
|
||||
|
||||
התחילו ב- [עמוד של QMK ב-Github](https://github.com/qmk/qmk_firmware), ותצמאו כפתור בחלק העליון מימין עם התיכוב "Fork":
|
||||
התחילו ב- [עמוד של QMK ב-GitHub](https://github.com/qmk/qmk_firmware), ותצמאו כפתור בחלק העליון מימין עם התיכוב "Fork":
|
||||
|
||||

|
||||

|
||||
|
||||
אם אתם חלק מארגון, תצטרכו לבחור לאיזה חשבון לבצע פעולת fork. ברוב המבקרים, תרצו לבצע fork לתוך החשבון הפרטי שלכם. ברגע שה-fork הסתיים (לפעמים זה יכול לקחת קצת זמן) הקליקו על כפתור ה-"Clone or Download":
|
||||
|
||||

|
||||

|
||||
|
||||
תוודאו שאתם בוחרים באופצייה של "HTTPS", בחרו את הקישור והעתיקו אותו:
|
||||
|
||||
|
@@ -32,7 +32,7 @@
|
||||
|
||||
// Moved pages
|
||||
'/adding_a_keyboard_to_qmk': '/hardware_keyboard_guidelines',
|
||||
'/build_environment_setup': '/getting_started_build_tools',
|
||||
'/build_environment_setup': '/newbs_getting_started',
|
||||
'/cli_dev_configuration': '/cli_configuration',
|
||||
'/dynamic_macros': '/feature_dynamic_macros',
|
||||
'/feature_common_shortcuts': '/feature_advanced_keycodes',
|
||||
@@ -45,6 +45,7 @@
|
||||
'/tap_dance': '/feature_tap_dance',
|
||||
'/unicode': '/feature_unicode',
|
||||
'/python_development': '/cli_development',
|
||||
'/getting_started_build_tools':'/newbs_getting_started',
|
||||
},
|
||||
basePath: '/',
|
||||
name: 'QMK Firmware',
|
||||
|
@@ -16,6 +16,7 @@ The following functions can provide basic control of GPIOs and are found in `qua
|
||||
| `writePinLow(pin)` | Set pin level as low, assuming it is an output | `PORTB &= ~(1<<2)` | `palClearLine(pin)` |
|
||||
| `writePin(pin, level)` | Set pin level, assuming it is an output | `(level) ? PORTB \|= (1<<2) : PORTB &= ~(1<<2)` | `(level) ? palSetLine(pin) : palClearLine(pin)` |
|
||||
| `readPin(pin)` | Returns the level of the pin | `_SFR_IO8(pin >> 4) & _BV(pin & 0xF)` | `palReadLine(pin)` |
|
||||
| `togglePin(pin)` | Invert pin level, assuming it is an output | `PORTB ^= (1<<2)` | `palToggleLine(pin)` |
|
||||
|
||||
## Advanced Settings :id=advanced-settings
|
||||
|
||||
|
@@ -115,12 +115,18 @@ The simplest and quickest way to get things back to normal is to flash only a bo
|
||||
|
||||
You can find the stock bootloaders in the [`util/` folder](https://github.com/qmk/qmk_firmware/tree/master/util). Be sure to flash the correct bootloader for your chip:
|
||||
|
||||
* [`atmega32u4`](https://github.com/qmk/qmk_firmware/blob/master/util/bootloader_atmega32u4_1_0_0.hex) - Most keyboards, Planck Rev 1-5, Preonic Rev 1-2
|
||||
* [`Pro Micro`](https://github.com/sparkfun/Arduino_Boards/blob/master/sparkfun/avr/bootloaders/caterina/Caterina-promicro16.hex) - The default bootloader for Pro Micro controllers
|
||||
* [`at90usb1286`](https://github.com/qmk/qmk_firmware/blob/master/util/bootloader_at90usb128x_1_0_1.hex) - Planck Light Rev 1
|
||||
* [`atmega32a`](https://github.com/qmk/qmk_firmware/blob/master/util/bootloader_atmega32a_1_0_0.hex) - jj40, and other V-USB/ps2avrGB keyboards
|
||||
* **Atmel DFU**
|
||||
* [ATmega16U4](https://github.com/qmk/qmk_firmware/blob/master/util/bootloader_atmega16u4_1.0.1.hex)
|
||||
* [ATmega32U4](https://github.com/qmk/qmk_firmware/blob/master/util/bootloader_atmega32u4_1.0.0.hex)
|
||||
* [AT90USB64](https://github.com/qmk/qmk_firmware/blob/master/util/bootloader_at90usb64_1.0.0.hex)
|
||||
* [AT90USB128](https://github.com/qmk/qmk_firmware/blob/master/util/bootloader_at90usb128_1.0.1.hex)
|
||||
* **Caterina**
|
||||
* [Pro Micro (5V/16MHz)](https://github.com/sparkfun/Arduino_Boards/blob/master/sparkfun/avr/bootloaders/caterina/Caterina-promicro16.hex)
|
||||
* [Pro Micro (3.3V/8MHz)](https://github.com/sparkfun/Arduino_Boards/blob/master/sparkfun/avr/bootloaders/caterina/Caterina-promicro8.hex)
|
||||
* **BootloadHID (PS2AVRGB)**
|
||||
* [ATmega32A](https://github.com/qmk/qmk_firmware/blob/master/util/bootloader_ps2avrgb_bootloadhid_1.0.1.hex)
|
||||
|
||||
If you're not sure what your board uses, look in the `rules.mk` file for the keyboard in QMK. The `MCU =` line will have the value you need. It may differ between different versions of the board.
|
||||
If you're not sure what your board uses, look in the `rules.mk` file for the keyboard in QMK. The `MCU` and `BOOTLOADER` lines will have the value you need. It may differ between different versions of the board.
|
||||
|
||||
### Production Techniques
|
||||
|
||||
|
@@ -113,7 +113,7 @@ compile.keymap: skully -> None
|
||||
|-----|---------------|-------------|
|
||||
| user.keyboard | None | キーボードのパス (例: `clueboard/66/rev4`) |
|
||||
| user.keymap | None | キーマップ名 (例: `default`) |
|
||||
| user.name | None | ユーザの github のユーザ名。 |
|
||||
| user.name | None | ユーザの GitHub のユーザ名。 |
|
||||
|
||||
# 全ての設定オプション
|
||||
|
||||
|
56
docs/ja/feature_command.md
Normal file
56
docs/ja/feature_command.md
Normal file
@@ -0,0 +1,56 @@
|
||||
# コマンド
|
||||
|
||||
<!---
|
||||
original document: 0.8.94:docs/feature_command.md
|
||||
git diff 0.8.94 HEAD -- docs/feature_command.md | cat
|
||||
-->
|
||||
|
||||
コマンド(旧称:マジック)は、ファームウェアを書き込んだり、[ブートマジック](ja/feature_bootmagic.md)を使うためにプラグを抜いたりすることなくキーボードの挙動を変更する方法です。この機能と[ブートマジックキーコード](feature_bootmagic.md#keycodes)には多くの重複があります。可能な限り、コマンドでは無くブートマジックキーコードの機能を使うことをお勧めします。
|
||||
|
||||
一部のキーボードではコマンドがデフォルトで無効になっています。その場合、`rules.mk` 内で明示的に有効にする必要があります:
|
||||
|
||||
```make
|
||||
COMMAND_ENABLE = yes
|
||||
```
|
||||
|
||||
## 使用法
|
||||
|
||||
コマンドを使うには、`IS_COMMAND()` マクロで定義されたキーの組み合わせを押し続けます。デフォルトでは、これは「左Shift + 右Shift」です。次に、目的のコマンドに対応するキーを押します。例えば、現在の QMK バージョンを QMK Toolbox コンソールに出力するには、「左Shift + 右Shift + `V`」を押します。
|
||||
|
||||
## 設定
|
||||
|
||||
コマンドのためのキーの割り当てを変更したい場合は、キーボードあるいはキーマップレベルのどちらかで、`config.h` にこれらを `#define` します。ここで割り当てる全てのキーコードは `KC_` 接頭辞を省略する必要があります。
|
||||
|
||||
| 定義 | デフォルト | 説明 |
|
||||
|------------------------------------|--------------------------------|------------------------------------------------|
|
||||
| `IS_COMMAND()` | `(get_mods() == MOD_MASK_SHIFT)` | コマンドをアクティブにするキーの組み合わせ |
|
||||
| `MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS` | `true` | ファンクション行を使ってデフォルトレイヤーを設定 |
|
||||
| `MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS` | `true` | 数字キーでデフォルトレイヤーを設定 |
|
||||
| `MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM` | `false` | `MAGIC_KEY_LAYER0..9` を使ってデフォルトレイヤーを設定 |
|
||||
| `MAGIC_KEY_DEBUG` | `D` | シリアルを介するデバッグの切り替え |
|
||||
| `MAGIC_KEY_DEBUG_MATRIX` | `X` | キーマトリックスのデバッグの切り替え |
|
||||
| `MAGIC_KEY_DEBUG_KBD` | `K` | キーボードのデバッグの切り替え |
|
||||
| `MAGIC_KEY_DEBUG_MOUSE` | `M` | マウスのデバッグの切り替え |
|
||||
| `MAGIC_KEY_CONSOLE` | `C` | コマンドコンソールを有効にする |
|
||||
| `MAGIC_KEY_VERSION` | `V` | コンソールに実行中の QMK バージョンを出力 |
|
||||
| `MAGIC_KEY_STATUS` | `S` | コンソールに現在のキーボードの状態を出力 |
|
||||
| `MAGIC_KEY_HELP` | `H` | コンソールにコマンドのヘルプを出力 |
|
||||
| `MAGIC_KEY_HELP_ALT` | `SLASH` | コンソールにコマンドのヘルプを出力 (代替) |
|
||||
| `MAGIC_KEY_LAYER0` | `0` | レイヤー 0 をデフォルトレイヤーにする |
|
||||
| `MAGIC_KEY_LAYER0_ALT` | `GRAVE` | レイヤー 0 をデフォルトレイヤーにする (代替) |
|
||||
| `MAGIC_KEY_LAYER1` | `1` | レイヤー 1 をデフォルトレイヤーにする |
|
||||
| `MAGIC_KEY_LAYER2` | `2` | レイヤー 2 をデフォルトレイヤーにする |
|
||||
| `MAGIC_KEY_LAYER3` | `3` | レイヤー 3 をデフォルトレイヤーにする |
|
||||
| `MAGIC_KEY_LAYER4` | `4` | レイヤー 4 をデフォルトレイヤーにする |
|
||||
| `MAGIC_KEY_LAYER5` | `5` | レイヤー 5 をデフォルトレイヤーにする |
|
||||
| `MAGIC_KEY_LAYER6` | `6` | レイヤー 6 をデフォルトレイヤーにする |
|
||||
| `MAGIC_KEY_LAYER7` | `7` | レイヤー 7 をデフォルトレイヤーにする |
|
||||
| `MAGIC_KEY_LAYER8` | `8` | レイヤー 8 をデフォルトレイヤーにする |
|
||||
| `MAGIC_KEY_LAYER9` | `9` | レイヤー 9 をデフォルトレイヤーにする |
|
||||
| `MAGIC_KEY_BOOTLOADER` | `B` | ブートローダにジャンプする |
|
||||
| `MAGIC_KEY_BOOTLOADER_ALT` | `ESC` | ブートローダにジャンプする (代替) |
|
||||
| `MAGIC_KEY_LOCK` | `CAPS` | 何も入力できないようにキーボードをロック |
|
||||
| `MAGIC_KEY_EEPROM` | `E` | 保存された EEPROM 設定をコンソールに出力 |
|
||||
| `MAGIC_KEY_EEPROM_CLEAR` | `BSPACE` | EEPROM をクリア |
|
||||
| `MAGIC_KEY_NKRO` | `N` | N キーロールオーバー (NKRO) の有効・無効を切り替え |
|
||||
| `MAGIC_KEY_SLEEP_LED` | `Z` | コンピュータがスリープの時に LED を切り替え |
|
71
docs/ja/feature_dynamic_macros.md
Normal file
71
docs/ja/feature_dynamic_macros.md
Normal file
@@ -0,0 +1,71 @@
|
||||
# 動的マクロ: ランタイムでのマクロの記録および再生
|
||||
|
||||
<!---
|
||||
original document: 0.8.123:docs/feature_dynamic_macros.md
|
||||
git diff 0.8.123 HEAD -- docs/feature_dynamic_macros.md | cat
|
||||
-->
|
||||
|
||||
QMK はその場で作られた一時的なマクロをサポートします。これらを動的マクロと呼びます。それらはユーザがキーボードから定義し、キーボードのプラグを抜くか再起動すると失われます。
|
||||
|
||||
1つまたは2つのマクロに合計128のキー押下を保存できます。RAM をより多く使用してサイズを増やすことができます。
|
||||
|
||||
有効にするには、最初に `rules.mk` に `DYNAMIC_MACRO_ENABLE = yes` を記述します。そして、以下のキーをキーマップに追加します:
|
||||
|
||||
| キー | Alias | 説明 |
|
||||
|------------------|----------|---------------------------------------------------|
|
||||
| `DYN_REC_START1` | `DM_REC1` | マクロ 1 の記録を開始します |
|
||||
| `DYN_REC_START2` | `DM_REC2` | マクロ 2 の記録を開始します |
|
||||
| `DYN_MACRO_PLAY1` | `DM_PLY1` | マクロ 1 を再生します |
|
||||
| `DYN_MACRO_PLAY2` | `DM_PLY2` | マクロ 2 を再生します |
|
||||
| `DYN_REC_STOP` | `DM_RSTP` | 現在記録中のマクロの記録を終了します。 |
|
||||
|
||||
これが必要な全てです。
|
||||
|
||||
マクロの記録を開始するには、`DYN_REC_START1` または `DYN_REC_START2` のどちらかを押します。
|
||||
|
||||
記録を終了するには、`DYN_REC_STOP` レイヤーボタンを押します。
|
||||
|
||||
マクロを再生するには、`DYN_MACRO_PLAY1` あるいは `DYN_MACRO_PLAY2` のどちらかを押します。
|
||||
|
||||
マクロの一部としてマクロを再生することができます。マクロ 1 を記録中にマクロ 2 を再生、またはその逆も問題ありません。ただし、再帰的なマクロ、つまりマクロ 1 を再生するマクロ 1 は作成しないでください。もしそうしてキーボードが反応しなくなった場合は、キーボードを取り外し再び接続します。これを完全に無効にするには、`config.h` ファイルで `DYNAMIC_MACRO_NO_NESTING` を定義します。
|
||||
|
||||
?> 動的マクロの内部の詳細については、`process_dynamic_macro.h` および `process_dynamic_macro.c` ファイルのコメントを読んでください。
|
||||
|
||||
## カスタマイズ
|
||||
|
||||
ある程度のカスタマイズを可能にするオプションがいくつか追加されています。
|
||||
|
||||
| 定義 | デフォルト | 説明 |
|
||||
|----------------------------|----------------|-----------------------------------------------------------------------------------------------------------------|
|
||||
| `DYNAMIC_MACRO_SIZE` | 128 | 動的マクロが使用できるメモリ量を設定します。これは限られたリソースであり、コントローラに依存します。 |
|
||||
| `DYNAMIC_MACRO_USER_CALL` | *定義なし* | これを定義すると、ユーザの `keymap.c` ファイルを使ってマクロが起動されます。 |
|
||||
| `DYNAMIC_MACRO_NO_NESTING` | *定義なし* | これを定義すると、別のマクロからマクロを呼び出す(入れ子になったマクロ)機能を無効にします。 |
|
||||
|
||||
|
||||
記録中にキーを押すたびに LED が点滅し始めた場合は、マクロバッファにマクロを入れるスペースがもう無いことを意味します。マクロを入れるには、他のマクロ(それらは同じバッファを共有します)を短くするか、`config.h` に `DYNAMIC_MACRO_SIZE` 定義を追加することでバッファを増やします(デフォルト値: 128; ヘッダ内のコメントを読んでください)。
|
||||
|
||||
|
||||
### DYNAMIC_MACRO_USER_CALL
|
||||
|
||||
以前のバージョンの動的マクロをお使いの方へ: 専用の `DYN_REC_STOP` キーを使わずに動的マクロキーへのアクセスに使われるレイヤーモディファイアのみを使って、マクロの記録を終了することもまだ可能です。この動作に戻したい場合は、`#define DYNAMIC_MACRO_USER_CALL` を `config.h` に追加し、以下のスニペットを `process_record_user()` 関数の先頭に記述します:
|
||||
|
||||
```c
|
||||
uint16_t macro_kc = (keycode == MO(_DYN) ? DYN_REC_STOP : keycode);
|
||||
|
||||
if (!process_record_dynamic_macro(macro_kc, record)) {
|
||||
return false;
|
||||
}
|
||||
```
|
||||
|
||||
### ユーザフック
|
||||
|
||||
カスタム機能とフィードバックオプションを動的マクロ機能に追加するために使うことができるフックが幾つかあります。これによりある程度のカスタマイズが可能になります。
|
||||
|
||||
direction がどのマクロであるかを示すことに注意してください。`1` がマクロ 1、`-1` がマクロ 2、0 がマクロ無しです。
|
||||
|
||||
* `dynamic_macro_record_start_user(void)` - マクロの記録を開始する時に起動されます。
|
||||
* `dynamic_macro_play_user(int8_t direction)` - マクロを再生する時に起動されます。
|
||||
* `dynamic_macro_record_key_user(int8_t direction, keyrecord_t *record)` - マクロの記録中に各キー押下で起動されます。
|
||||
* `dynamic_macro_record_end_user(int8_t direction)` - マクロの記録を停止した時に起動されます。
|
||||
|
||||
さらに、動的マクロ機能が有効な場合にバックライトを点滅させるために `dynamic_macro_led_blink()` を呼び出すことができます。
|
81
docs/ja/feature_encoders.md
Normal file
81
docs/ja/feature_encoders.md
Normal file
@@ -0,0 +1,81 @@
|
||||
# エンコーダ
|
||||
|
||||
<!---
|
||||
original document: 0.8.123:docs/feature_encoders.md
|
||||
git diff 0.8.123 HEAD -- docs/feature_encoders.md | cat
|
||||
-->
|
||||
|
||||
以下を `rules.mk` に追加することで基本的なエンコーダがサポートされます:
|
||||
|
||||
```make
|
||||
ENCODER_ENABLE = yes
|
||||
```
|
||||
|
||||
さらに、以下を `config.h` に追加します:
|
||||
|
||||
```c
|
||||
#define ENCODERS_PAD_A { B12 }
|
||||
#define ENCODERS_PAD_B { B13 }
|
||||
```
|
||||
|
||||
各 PAD_A/B 変数は配列を定義するため、複数のエンコーダを定義することができます。例えば:
|
||||
|
||||
```c
|
||||
#define ENCODERS_PAD_A { encoder1a, encoder2a }
|
||||
#define ENCODERS_PAD_B { encoder1b, encoder2b }
|
||||
```
|
||||
|
||||
エンコーダの時計回りの方向が間違っている場合は、A と B のパッド定義を交換することができます。define を使って逆にすることもできます:
|
||||
|
||||
```c
|
||||
#define ENCODER_DIRECTION_FLIP
|
||||
```
|
||||
|
||||
さらに、解像度を同じファイルで指定することができます (デフォルトかつお勧めは4):
|
||||
|
||||
```c
|
||||
#define ENCODER_RESOLUTION 4
|
||||
```
|
||||
|
||||
## 分割キーボード
|
||||
|
||||
分割キーボードのそれぞれの側のエンコーダに異なるピン配列を使っている場合、右側のピン配列を以下のように定義することができます:
|
||||
|
||||
```c
|
||||
#define ENCODERS_PAD_A_RIGHT { encoder1a, encoder2a }
|
||||
#define ENCODERS_PAD_B_RIGHT { encoder1b, encoder2b }
|
||||
```
|
||||
|
||||
## コールバック
|
||||
|
||||
コールバック関数を `<keyboard>.c` に記述することができます:
|
||||
|
||||
```c
|
||||
void encoder_update_kb(uint8_t index, bool clockwise) {
|
||||
encoder_update_user(index, clockwise);
|
||||
}
|
||||
```
|
||||
|
||||
あるいは `keymap.c` に記述することもできます:
|
||||
|
||||
```c
|
||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
||||
if (index == 0) { /* First encoder */
|
||||
if (clockwise) {
|
||||
tap_code(KC_PGDN);
|
||||
} else {
|
||||
tap_code(KC_PGUP);
|
||||
}
|
||||
} else if (index == 1) { /* Second encoder */
|
||||
if (clockwise) {
|
||||
tap_code(KC_DOWN);
|
||||
} else {
|
||||
tap_code(KC_UP);
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## ハードウェア
|
||||
|
||||
エンコーダの A と B の線は MCU に直接配線し、C/common 線はグランドに配線する必要があります。
|
37
docs/ja/feature_grave_esc.md
Normal file
37
docs/ja/feature_grave_esc.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# グレイブエスケープ
|
||||
|
||||
<!---
|
||||
original document: 0.8.123:docs/feature_grave_esc.md
|
||||
git diff 0.8.123 HEAD -- docs/feature_grave_esc.md | cat
|
||||
-->
|
||||
|
||||
60% キーボード、またはファンクションキー行の無い他のレイアウトを使っている場合、専用の Escape キーが無いことに気付くでしょう。グレイブエスケープは grave キー (<code>`</code> および `~`) を Escape と共有することができる機能です。
|
||||
|
||||
## 使用法
|
||||
|
||||
キーマップ内の `KC_GRAVE` キー (通常は`1` キーの左)を `KC_GESC` に置き換えます。ほとんどの場合、このキーは押された時に `KC_ESC` を出力します。ただし、Shift あるいは GUI を押したままにすると、代わりに `KC_GRV` を出力します。
|
||||
|
||||
## OS に見えるもの
|
||||
|
||||
メアリーがキーボードで GESC を押すと、OS には KC_ESC 文字が見えます。メアリーが Shift を押しながら GESC を押すと、`~` または Shift された時はバッククォートを出力します。彼女が GUI/CMD/WIN を押したままにすると、1つの <code>`</code> 文字を出力します。
|
||||
|
||||
## キーコード
|
||||
|
||||
| キー | エイリアス | 説明 |
|
||||
|---------|-----------|------------------------------------------------------------------|
|
||||
| `KC_GESC` | `GRAVE_ESC` | 押された場合に Escape。Shift あるいは GUI が押されたままの場合は <code>`</code> |
|
||||
|
||||
### 注意事項
|
||||
|
||||
macOS では、Command+<code>`</code> はデフォルトで "次のウィンドウを操作対象にする" にマップされます。つまりバッククォートを出力しません。さらに、ショートカットがキーボード環境設定で変更された場合でも、ターミナルは常にこのショートカットを認識してウィンドウを切り替えます。
|
||||
|
||||
## 設定
|
||||
|
||||
グレイブエスケープが壊す可能性のあるキーの組み合わせが幾つかあります。その中には、Windows では Control+Shift+Escape、macOSでは Command+Option+Escape があります。これを回避するには、`config.h` で以下のオプションを `#define` することができます:
|
||||
|
||||
| 定義 | 説明 |
|
||||
|--------------------------|-----------------------------------------|
|
||||
| `GRAVE_ESC_ALT_OVERRIDE` | Alt が押された場合、常に Escape を送信する |
|
||||
| `GRAVE_ESC_CTRL_OVERRIDE` | Control が押された場合、常に Escape を送信する |
|
||||
| `GRAVE_ESC_GUI_OVERRIDE` | GUI が押された場合、常に Escape を送信する |
|
||||
| `GRAVE_ESC_SHIFT_OVERRIDE` | Shift が押された場合、常に Escape を送信する |
|
163
docs/ja/feature_haptic_feedback.md
Normal file
163
docs/ja/feature_haptic_feedback.md
Normal file
@@ -0,0 +1,163 @@
|
||||
# 触覚フィードバック
|
||||
|
||||
<!---
|
||||
original document: 0.8.123:docs/feature_haptic_feedback.md
|
||||
git diff 0.8.123 HEAD -- docs/feature_haptic_feedback.md | cat
|
||||
-->
|
||||
|
||||
## 触覚フィードバック の rules.mk オプション
|
||||
|
||||
現在のところ、`rules.mk` で触覚フィードバック用に以下のオプションを利用可能です:
|
||||
|
||||
`HAPTIC_ENABLE += DRV2605L`
|
||||
|
||||
`HAPTIC_ENABLE += SOLENOID`
|
||||
|
||||
## サポートされる既知のハードウェア
|
||||
|
||||
| 名前 | 説明 |
|
||||
|--------------------|-------------------------------------------------|
|
||||
| [LV061228B-L65-A](https://www.digikey.com/product-detail/en/jinlong-machinery-electronics-inc/LV061228B-L65-A/1670-1050-ND/7732325) | z-axis 2v LRA |
|
||||
| [Mini Motor Disc](https://www.adafruit.com/product/1201) | small 2-5v ERM |
|
||||
|
||||
## 触覚キーコード
|
||||
|
||||
以下のキーコードは、選択した触覚メカニズムに依存して動作するかどうか決まります。
|
||||
|
||||
| 名前 | 説明 |
|
||||
|-----------|-------------------------------------------------------|
|
||||
| `HPT_ON` | 触覚フィードバックをオン |
|
||||
| `HPT_OFF` | 触覚フィードバックをオフ |
|
||||
| `HPT_TOG` | 触覚フィードバックのオン/オフを切り替え |
|
||||
| `HPT_RST` | 触覚フィードバック設定をデフォルトに戻す |
|
||||
| `HPT_FBK` | キー押下またはリリースまたはその両方でフィードバックを切り替え |
|
||||
| `HPT_BUZ` | ソレノイドの振動のオン/オフを切り替え |
|
||||
| `HPT_MODI` | 次の DRV2605L 波形に移動 |
|
||||
| `HPT_MODD` | 前の DRV2605L 波形に移動 |
|
||||
| `HPT_CONT` | 連続触覚モードのオン/オフを切り替え |
|
||||
| `HPT_CONI` | DRV2605L の連続触覚強度を増加 |
|
||||
| `HPT_COND` | DRV2605L の連続触覚強度を減少 |
|
||||
| `HPT_DWLI` | ソレノイドの滞留時間を増加 |
|
||||
| `HPT_DWLD` | ソレノイドの滞留時間を減少 |
|
||||
|
||||
### ソレノイド
|
||||
|
||||
ほとんどの MCU はソレノイドのコイルを駆動するために必要な電流を供給できないため、最初に MOSFET を介してソレノイドを駆動する回路を構築する必要があります。
|
||||
|
||||
[Adafruit が提供する配線図](https://playground.arduino.cc/uploads/Learning/solenoid_driver.pdf)
|
||||
|
||||
|
||||
| 設定 | デフォルト | 説明 |
|
||||
|--------------------------|---------------|-------------------------------------------------------|
|
||||
| `SOLENOID_PIN` | *定義なし* | ソレノイドが接続されているピンを設定する。 |
|
||||
| `SOLENOID_DEFAULT_DWELL` | `12` ms | ソレノイドのデフォルトの滞留時間を設定する。 |
|
||||
| `SOLENOID_MIN_DWELL` | `4` ms | 滞留時間の下限を設定する。 |
|
||||
| `SOLENOID_MAX_DWELL` | `100` ms | 滞留時間の上限を設定する。 |
|
||||
|
||||
?> 滞留時間とは、「プランジャー」が作動したままになる時間です。滞留時間により、ソレノイドの音が変わります。
|
||||
|
||||
ブートローダ実行中に一部のピンが給電されているかもしれず (例えば、STM32F303 チップ上の A13)、そうすると書き込みプロセスの間ずっとソレノイドがオン状態になることに注意してください。これはソレノイドを加熱し損傷を与えるかもしれません。ソレノイドが接続されているピンがブートローダ/DFU 実行中にソレノイドをオンにしていることが分かった場合は、他のピンを選択してください。
|
||||
|
||||
### DRV2605L
|
||||
|
||||
DRV2605Lは i2c プロトコルで制御され、SDA および SCL ピンに接続する必要があります。これらは使用する MCU によって異なります。
|
||||
|
||||
#### フィードバックモータのセットアップ
|
||||
|
||||
このドライバは2つの異なるフィードバックモータをサポートします。選択したモータに基づいて、`config.h` で以下を設定します。
|
||||
|
||||
##### ERM
|
||||
|
||||
偏心回転質量振動モータ (ERM) は偏りのある重りが取り付けられたモータで、駆動信号が取り付けられると偏りのある重りが回転し、正弦波が振動に変換されます。
|
||||
|
||||
```
|
||||
#define FB_ERM_LRA 0
|
||||
#define FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */
|
||||
#define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
|
||||
|
||||
/* 特定のモータに最適な設定については、データシートを参照してください。*/
|
||||
#define RATED_VOLTAGE 3
|
||||
#define V_PEAK 5
|
||||
```
|
||||
##### LRA
|
||||
|
||||
線形共振アクチュエータ (LRA、線形バイブレータとしても知られています)は、ERM と異なります。LRA は重りと磁石をバネで吊るしたものとボイスコイルで構成されています。駆動信号が印加されるとされると、重りは単一の軸で振動します (左右または上下)。重りはバネに取り付けられているため、特定の周波数で共振効果があります。この周波数は LRA が最も効率的に動作する箇所です。この周波数の推奨範囲については、モータのデータシートを参照してください。
|
||||
|
||||
```
|
||||
#define FB_ERM_LRA 1
|
||||
#define FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */
|
||||
#define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
|
||||
|
||||
/* 特定のモータに最適な設定については、データシートを参照してください。*/
|
||||
#define RATED_VOLTAGE 2
|
||||
#define V_PEAK 2.8
|
||||
#define V_RMS 2.0
|
||||
#define V_PEAK 2.1
|
||||
#define F_LRA 205 /* 共振周波数 */
|
||||
```
|
||||
|
||||
#### DRV2605L 波形ライブラリ
|
||||
|
||||
DRV2605L には呼び出して再生できる様々な波形シーケンスのプリロードライブラリが同梱されています。マクロを書く場合、これらの波形は `DRV_pulse(*sequence name or number*)` を使って再生することができます
|
||||
|
||||
データシートの波形シーケンスのリスト
|
||||
|
||||
| seq# | シーケンス名 | seq# | シーケンス名 | seq# | シーケンス名 |
|
||||
|-----|---------------------|-----|-----------------------------------|-----|--------------------------------------|
|
||||
| 1 | strong_click | 43 | lg_dblclick_med_60 | 85 | transition_rampup_med_smooth2 |
|
||||
| 2 | strong_click_60 | 44 | lg_dblsharp_tick | 86 | transition_rampup_short_smooth1 |
|
||||
| 3 | strong_click_30 | 45 | lg_dblsharp_tick_80 | 87 | transition_rampup_short_smooth2 |
|
||||
| 4 | sharp_click | 46 | lg_dblsharp_tick_60 | 88 | transition_rampup_long_sharp1 |
|
||||
| 5 | sharp_click_60 | 47 | buzz | 89 | transition_rampup_long_sharp2 |
|
||||
| 6 | sharp_click_30 | 48 | buzz_80 | 90 | transition_rampup_med_sharp1 |
|
||||
| 7 | soft_bump | 49 | buzz_60 | 91 | transition_rampup_med_sharp2 |
|
||||
| 8 | soft_bump_60 | 50 | buzz_40 | 92 | transition_rampup_short_sharp1 |
|
||||
| 9 | soft_bump_30 | 51 | buzz_20 | 93 | transition_rampup_short_sharp2 |
|
||||
| 10 | dbl_click | 52 | pulsing_strong | 94 | transition_rampdown_long_smooth1_50 |
|
||||
| 11 | dbl_click_60 | 53 | pulsing_strong_80 | 95 | transition_rampdown_long_smooth2_50 |
|
||||
| 12 | trp_click | 54 | pulsing_medium | 96 | transition_rampdown_med_smooth1_50 |
|
||||
| 13 | soft_fuzz | 55 | pulsing_medium_80 | 97 | transition_rampdown_med_smooth2_50 |
|
||||
| 14 | strong_buzz | 56 | pulsing_sharp | 98 | transition_rampdown_short_smooth1_50 |
|
||||
| 15 | alert_750ms | 57 | pulsing_sharp_80 | 99 | transition_rampdown_short_smooth2_50 |
|
||||
| 16 | alert_1000ms | 58 | transition_click | 100 | transition_rampdown_long_sharp1_50 |
|
||||
| 17 | strong_click1 | 59 | transition_click_80 | 101 | transition_rampdown_long_sharp2_50 |
|
||||
| 18 | strong_click2_80 | 60 | transition_click_60 | 102 | transition_rampdown_med_sharp1_50 |
|
||||
| 19 | strong_click3_60 | 61 | transition_click_40 | 103 | transition_rampdown_med_sharp2_50 |
|
||||
| 20 | strong_click4_30 | 62 | transition_click_20 | 104 | transition_rampdown_short_sharp1_50 |
|
||||
| 21 | medium_click1 | 63 | transition_click_10 | 105 | transition_rampdown_short_sharp2_50 |
|
||||
| 22 | medium_click2_80 | 64 | transition_hum | 106 | transition_rampup_long_smooth1_50 |
|
||||
| 23 | medium_click3_60 | 65 | transition_hum_80 | 107 | transition_rampup_long_smooth2_50 |
|
||||
| 24 | sharp_tick1 | 66 | transition_hum_60 | 108 | transition_rampup_med_smooth1_50 |
|
||||
| 25 | sharp_tick2_80 | 67 | transition_hum_40 | 109 | transition_rampup_med_smooth2_50 |
|
||||
| 26 | sharp_tick3_60 | 68 | transition_hum_20 | 110 | transition_rampup_short_smooth1_50 |
|
||||
| 27 | sh_dblclick_str | 69 | transition_hum_10 | 111 | transition_rampup_short_smooth2_50 |
|
||||
| 28 | sh_dblclick_str_80 | 70 | transition_rampdown_long_smooth1 | 112 | transition_rampup_long_sharp1_50 |
|
||||
| 29 | sh_dblclick_str_60 | 71 | transition_rampdown_long_smooth2 | 113 | transition_rampup_long_sharp2_50 |
|
||||
| 30 | sh_dblclick_str_30 | 72 | transition_rampdown_med_smooth1 | 114 | transition_rampup_med_sharp1_50 |
|
||||
| 31 | sh_dblclick_med | 73 | transition_rampdown_med_smooth2 | 115 | transition_rampup_med_sharp2_50 |
|
||||
| 32 | sh_dblclick_med_80 | 74 | transition_rampdown_short_smooth1 | 116 | transition_rampup_short_sharp1_50 |
|
||||
| 33 | sh_dblclick_med_60 | 75 | transition_rampdown_short_smooth2 | 117 | transition_rampup_short_sharp2_50 |
|
||||
| 34 | sh_dblsharp_tick | 76 | transition_rampdown_long_sharp1 | 118 | long_buzz_for_programmatic_stopping |
|
||||
| 35 | sh_dblsharp_tick_80 | 77 | transition_rampdown_long_sharp2 | 119 | smooth_hum1_50 |
|
||||
| 36 | sh_dblsharp_tick_60 | 78 | transition_rampdown_med_sharp1 | 120 | smooth_hum2_40 |
|
||||
| 37 | lg_dblclick_str | 79 | transition_rampdown_med_sharp2 | 121 | smooth_hum3_30 |
|
||||
| 38 | lg_dblclick_str_80 | 80 | transition_rampdown_short_sharp1 | 122 | smooth_hum4_20 |
|
||||
| 39 | lg_dblclick_str_60 | 81 | transition_rampdown_short_sharp2 | 123 | smooth_hum5_10 |
|
||||
| 40 | lg_dblclick_str_30 | 82 | transition_rampup_long_smooth1 | | |
|
||||
| 41 | lg_dblclick_med | 83 | transition_rampup_long_smooth2 | | |
|
||||
| 42 | lg_dblclick_med_80 | 84 | transition_rampup_med_smooth1 | | |
|
||||
### オプションの DRV2605L の定義
|
||||
|
||||
```
|
||||
#define DRV_GREETING *sequence name or number*
|
||||
```
|
||||
触覚フィードバッグが有効な場合、キーボード起動時に特定のシーケンスに合わせて振動します。以下の定義を使って選択することができます:
|
||||
|
||||
```
|
||||
#define DRV_MODE_DEFAULT *sequence name or number*
|
||||
```
|
||||
これにより HPT_RST がアクティブモードとして設定するシーケンスを設定します。未定義の場合、HPT_RST が押された時にモードが 1 に設定されます。
|
||||
|
||||
### DRV2605L 連続触覚モード
|
||||
|
||||
このモードは強さを増減するオプションを使って連続触覚フィードバッグを設定します。
|
62
docs/ja/feature_hd44780.md
Normal file
62
docs/ja/feature_hd44780.md
Normal file
@@ -0,0 +1,62 @@
|
||||
# HD44780 LCD ディスプレイ
|
||||
|
||||
<!---
|
||||
original document: 0.8.123:docs/feature_hd44780.md
|
||||
git diff 0.8.123 HEAD -- docs/feature_hd44780.md | cat
|
||||
-->
|
||||
|
||||
これは Peter Fleury の LCD ライブラリの統合です。このページは基本について説明します。[詳細なドキュメントについてはこのページをご覧ください](http://homepage.hispeed.ch/peterfleury/doxygen/avr-gcc-libraries/group__pfleury__lcd.html) (訳注)原文のリンク先のページは、サービスの終了に伴って削除されています。移行先は (http://www.peterfleury.epizy.com/doxygen/avr-gcc-libraries/group__pfleury__lcd.html) と思われます。
|
||||
|
||||
HD44780 ディスプレイのサポートを有効にするには、キーボードの `rules.mk` の `HD44780_ENABLE` フラグを yes に設定します。
|
||||
|
||||
## 設定
|
||||
|
||||
ディスプレイで使用されるピンとディスプレイの行と列の数を、キーボードの `config.h` に設定する必要があります。
|
||||
|
||||
|
||||
HD44780 のラベルが付いたセクションのコメントを外し、必要に応じてパラメータを変更します。
|
||||
````
|
||||
/*
|
||||
* HD44780 LCD ディスプレイ設定
|
||||
*/
|
||||
|
||||
#define LCD_LINES 2 //< ディスプレイの表示行数
|
||||
#define LCD_DISP_LENGTH 16 //< ディスプレイの行ごとの表示文字数
|
||||
#define LCD_IO_MODE 1 //< 0: メモリマップモード 1: IO ポートモード
|
||||
#if LCD_IO_MODE
|
||||
#define LCD_PORT PORTB //< LCD 行のためのポート
|
||||
#define LCD_DATA0_PORT LCD_PORT //< 4ビットデータビット 0 のポート
|
||||
#define LCD_DATA1_PORT LCD_PORT //< 4ビットデータビット 1 のポート
|
||||
#define LCD_DATA2_PORT LCD_PORT //< 4ビットデータビット 2 のポート
|
||||
#define LCD_DATA3_PORT LCD_PORT //< 4ビットデータビット 3 のポート
|
||||
#define LCD_DATA0_PIN 4 //< 4ビットデータビット 0 のピン
|
||||
#define LCD_DATA1_PIN 5 //< 4ビットデータビット 1 のピン
|
||||
#define LCD_DATA2_PIN 6 //< 4ビットデータビット 2 のピン
|
||||
#define LCD_DATA3_PIN 7 //< 4ビットデータビット 3 のピン
|
||||
#define LCD_RS_PORT LCD_PORT //< RS 線のためのポート
|
||||
#define LCD_RS_PIN 3 //< RS 線のためのピン
|
||||
#define LCD_RW_PORT LCD_PORT //< RW 線のためのポート
|
||||
#define LCD_RW_PIN 2 //< RW 線のためのピン
|
||||
#define LCD_E_PORT LCD_PORT //< Enable 線のためのポート
|
||||
#define LCD_E_PIN 1 //< Enable 線のためのピン
|
||||
#endif
|
||||
````
|
||||
|
||||
他のプロパティを設定する必要がある場合は、それらを `quantum/hd44780.h` からコピーし、`config.h` に設定することができます。(訳注)`quantum/hd44780.h` は `drivers/avr/hd44780.h` の間違いではないかと思われます。
|
||||
|
||||
## 使用法
|
||||
|
||||
ディスプレイを初期化するには、以下のパラメータのうちの1つを使って `lcd_init()` を呼び出します:
|
||||
````
|
||||
LCD_DISP_OFF : ディスプレイオフ
|
||||
LCD_DISP_ON : ディスプレイオン、カーソルオフ
|
||||
LCD_DISP_ON_CURSOR : ディスプレイオン、カーソルオン
|
||||
LCD_DISP_ON_CURSOR_BLINK : ディスプレイオン、点滅カーソル
|
||||
````
|
||||
これはキーボードの `matrix_init_kb` またはキーマップの `matrix_init_user` で行うのが最適です。
|
||||
使用前にディスプレイをクリアすることをお勧めします。
|
||||
そのためには、`lcd_clrscr()` を呼びます。
|
||||
|
||||
ディスプレイに何かを表示するには、最初に `lcd_gotoxy(column, line)` を呼びます。最初の行の先頭に移動するには、`lcd_gotoxy(0, 0)` を呼び出し、その後 `lcd_puts("example string")` を使って文字列を出力します。
|
||||
|
||||
ディスプレイを制御することができる、より多くのメソッドがあります。[詳細なドキュメントについてはリンクされたページをご覧ください](http://homepage.hispeed.ch/peterfleury/doxygen/avr-gcc-libraries/group__pfleury__lcd.html) (訳注)原文のリンク先のページは、サービスの終了に伴って削除されています。移行先は (http://www.peterfleury.epizy.com/doxygen/avr-gcc-libraries/group__pfleury__lcd.html) と思われます。
|
27
docs/ja/feature_key_lock.md
Normal file
27
docs/ja/feature_key_lock.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# キーロック
|
||||
|
||||
<!---
|
||||
original document: 0.8.134:docs/feature_key_lock.md
|
||||
git diff 0.8.134 HEAD -- docs/feature_key_lock.md | cat
|
||||
-->
|
||||
|
||||
特定のキーを長時間押すことが必要になる場合があります。キーロックは次に押すキーを押したままにします。もう一度押すと、リリースされます。
|
||||
|
||||
いくつかの文を全て大文字で入力する必要があるとしましょう。`KC_LOCK` を押し、次にシフトを押します。これで、シフトは次にタップするまで押していると見なされます。キーロックを Caps Lock と考えることができますが、さらに強力です。
|
||||
|
||||
## 使用法
|
||||
|
||||
最初に `rules.mk` で `KEY_LOCK_ENABLE = yes` を設定することでキーロックを有効にします。次に、キーマップでキーを選択し、それをキーコード `KC_LOCK` に割り当てます。
|
||||
|
||||
## キーコード
|
||||
|
||||
| キーコード | 説明 |
|
||||
|---------|--------------------------------------------------------------|
|
||||
| `KC_LOCK` | キーが再び押されるまで次のキーを押したままにします。 |
|
||||
|
||||
## 注意事項
|
||||
|
||||
キーロックは、標準アクションキーと[ワンショットモディファイア](ja/one_shot_keys.md)キー (例えば、Shift を `OSM(KC_LSFT)` と定義した場合)のみを押し続けることができます。
|
||||
これは、QMK の特殊機能(ワンショットモディファイアを除く)、または `KC_LPRN` のような shift を押されたキーのバージョンは含みません。[基本的なキーコード](ja/keycodes_basic.md)リストにある場合、押したままにすることができます。
|
||||
|
||||
レイヤーの切り替えは、キーロックを解除しません。
|
114
docs/ja/feature_layouts.md
Normal file
114
docs/ja/feature_layouts.md
Normal file
@@ -0,0 +1,114 @@
|
||||
# レイアウト: 複数のキーボードで1つのキーマップを使用
|
||||
|
||||
<!---
|
||||
original document: 0.8.134:docs/feature_layouts.md
|
||||
git diff 0.8.134 HEAD -- docs/feature_layouts.md | cat
|
||||
-->
|
||||
|
||||
`layouts/` フォルダは、様々なキーボードに適用できる色々な物理キーレイアウトを含みます。
|
||||
|
||||
```
|
||||
layouts/
|
||||
+ default/
|
||||
| + 60_ansi/
|
||||
| | + readme.md
|
||||
| | + layout.json
|
||||
| | + a_good_keymap/
|
||||
| | | + keymap.c
|
||||
| | | + readme.md
|
||||
| | | + config.h
|
||||
| | | + rules.mk
|
||||
| | + <keymap folder>/
|
||||
| | + ...
|
||||
| + <layout folder>/
|
||||
+ community/
|
||||
| + <layout folder>/
|
||||
| + ...
|
||||
```
|
||||
|
||||
`layouts/default/` と `layouts/community/` は、レイアウト「repositories」の2つの例です。現在のところ、`default` にはユーザの参考用に、レイアウトに関する全ての情報および、`default_<layout>` という名前の1つのデフォルトのキーマップが含まれています。`community` には全ての共有キーマップが含まれており、それらはユーザが `layouts/` にクローンするための別のリポジトリに分割することを最終的な目的としていますQMK は `layouts/` 内のすべてのフォルダを検索するため、ここに複数のリポジトリを持つことができます。
|
||||
|
||||
各レイアウトフォルダは、レイアウトの物理的な側面に基づいて、可能な限り一般的な名称で(`[a-z0-9_]`)という名前が付けられ、キーボードで定義されるレイアウトと一緒に `readme.md` を含みます。
|
||||
|
||||
```md
|
||||
# 60_ansi
|
||||
|
||||
LAYOUT_60_ansi
|
||||
```
|
||||
|
||||
新しい名前は既存のレイアウトで設定された標準に準拠しようと努力する必要があり、必要に応じて PR/Issue で議論することができます。
|
||||
|
||||
## レイアウトのサポート
|
||||
|
||||
キーボードがレイアウトをサポートするために、変数は `<keyboard>.h` で定義し、引数/キー (できれば物理レイアウト)の数に一致している必要があります。
|
||||
|
||||
#define LAYOUT_60_ansi KEYMAP_ANSI
|
||||
|
||||
レイアウトの名前は次の正規表現に一致しなければなりません: `[a-z0-9_]+`
|
||||
|
||||
フォルダ名はキーボードの `rules.mk` に追加する必要があります:
|
||||
|
||||
LAYOUTS = 60_ansi
|
||||
|
||||
`LAYOUTS` は任意のキーボードフォルダレべルの `rules.mk` に設定することができます:
|
||||
|
||||
LAYOUTS = 60_iso
|
||||
|
||||
ただし、`LAYOUT_<layout>` 変数は `<folder>.h` でも定義する必要があります。
|
||||
|
||||
## キーマップのビルド
|
||||
|
||||
以下の形式でコマンドを使ってキーボードキーマップを作成できるはずです:
|
||||
|
||||
make <keyboard>:<layout>
|
||||
|
||||
### レイアウトの競合
|
||||
キーボードが複数のレイアウトオプションをサポートし、
|
||||
|
||||
LAYOUTS = ortho_4x4 ortho_4x12
|
||||
|
||||
なおかつ両方のオプションについてレイアウトが存在する場合、
|
||||
```
|
||||
layouts/
|
||||
+ community/
|
||||
| + ortho_4x4/
|
||||
| | + <layout>/
|
||||
| | | + ...
|
||||
| + ortho_4x12/
|
||||
| | + <layout>/
|
||||
| | | + ...
|
||||
| + ...
|
||||
```
|
||||
|
||||
FORCE_LAYOUT 引数はどのレイアウトをビルドするかを指定するために使うことができます
|
||||
|
||||
make <keyboard>:<layout> FORCE_LAYOUT=ortho_4x4
|
||||
make <keyboard>:<layout> FORCE_LAYOUT=ortho_4x12
|
||||
|
||||
## キーボードに依存しないレイアウトを作成するためのヒント
|
||||
|
||||
### インクルード
|
||||
|
||||
`#include "planck.h"` を使う代わりに、以下の行を使ってコンパイルされる `<keyboard>.h` (`<folder>.h` はここでインクルードすべきではありません)ファイルをインクルードすることができます:
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
キーボード固有のコードを保持したい場合は、これらの変数を使って `#ifdef` 文でエスケープすることができます:
|
||||
|
||||
* `KEYBOARD_<folder1>_<folder2>`
|
||||
|
||||
例えば:
|
||||
|
||||
```c
|
||||
#ifdef KEYBOARD_planck
|
||||
#ifdef KEYBOARD_planck_rev4
|
||||
planck_rev4_function();
|
||||
#endif
|
||||
#endif
|
||||
```
|
||||
|
||||
名前は小文字でキーボード/リビジョンのフォルダ/ファイル名と正確に一致することに注意してください。
|
||||
|
||||
### キーマップ
|
||||
|
||||
同じレイアウトで分割および非分割キーボードをサポートするためには、キーマップでキーボード非依存の `LAYOUT_<layout name>` マクロを使う必要があります。例えば、Let's Split および Planck が同じレイアウトを共有するには、`LAYOUT_planck_grid` や C 配列の場合の単なる `{}` の代わりに、`LAYOUT_ortho_4x12` を使う必要があります。
|
151
docs/ja/feature_leader_key.md
Normal file
151
docs/ja/feature_leader_key.md
Normal file
@@ -0,0 +1,151 @@
|
||||
# リーダーキー: 新しい種類のモディファイア
|
||||
|
||||
<!---
|
||||
original document: 0.8.134:docs/feature_leader_key.md
|
||||
git diff 0.8.134 HEAD -- docs/feature_leader_key.md | cat
|
||||
-->
|
||||
|
||||
もしあなたが Vim を使ったことがある場合、リーダーキーは何であるかを知っています。そうでなければ、素晴らしい概念を発見しようとしています。:) 例えば、Alt+Shift+W を押す(3つのキーを同時に押す)代わりに、キーの_シーケンス_を押すことができたらどうでしょう?つまり、特別なモディファイア (リーダーキー)を押して、続けて W と C を押すと (単純にキーを高速に繋げます)、何かが起こります。
|
||||
|
||||
それが `KC_LEAD` の機能です。以下は例です:
|
||||
|
||||
1. リーダーキーとして使いたいキーボードのキーを選択します。それにキーコード `KC_LEAD` を割り当てます。このキーはこのためだけの専用です -- 単一アクションのキーで、他の用途には使うことができません。
|
||||
2. `config.h` に `#define LEADER_TIMEOUT 300` という行を追加します。これによって `KC_LEAD` キーのタイムアウトを設定します。具体的には、`KC_LEAD` キーを押してからリーダーキーのシーケンスを完了するまで一定の時間しかありません。ここでの `300` はそれを300msに設定します。この値を増やして、シーケンスを入力する時間を増やすことができます。ただし、この時間中に押されたキーは全て途中で遮られ、送信されません。そのためこの値は小さくしておいたほうが良いかもしれません。
|
||||
* デフォルトでは、このタイムアウトは、`KC_LEAD` を押してからシーケンス全体が完了するまでに掛かる時間です。これは一部の人にとっては非常に短いかもしれません。そのため、このタイムアウトを増やしたほうが良い場合もあります。必要に応じて、`LEADER_PER_KEY_TIMING` オプションを有効にしたほうが良い場合もあります。これは各キーがタップされる度にタイムアウトまでの時間をリセットする機能です。これにより、タイムアウト時間を短くしつつも、比較的長いシーケンスを使うことができます。このオプションを有効にするには、`config.h` に `#define LEADER_PER_KEY_TIMING` を追加します。
|
||||
3. `matrix_scan_user` 関数の中で、以下のようなものを追加します:
|
||||
|
||||
```c
|
||||
LEADER_EXTERNS();
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
LEADER_DICTIONARY() {
|
||||
leading = false;
|
||||
leader_end();
|
||||
|
||||
SEQ_ONE_KEY(KC_F) {
|
||||
// マクロ内でできること
|
||||
SEND_STRING("QMK is awesome.");
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_D, KC_D) {
|
||||
SEND_STRING(SS_LCTL("a") SS_LCTL("c"));
|
||||
}
|
||||
SEQ_THREE_KEYS(KC_D, KC_D, KC_S) {
|
||||
SEND_STRING("https://start.duckduckgo.com\n");
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_A, KC_S) {
|
||||
register_code(KC_LGUI);
|
||||
register_code(KC_S);
|
||||
unregister_code(KC_S);
|
||||
unregister_code(KC_LGUI);
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
ご覧のとおり、幾つかの関数があります。`SEQ_ONE_KEY` を単一キーシーケンス (リーダーの後に1つのキーのみ)に使い、より長いシーケンスについては `SEQ_TWO_KEYS`、`SEQ_THREE_KEYS` から `SEQ_FIVE_KEYS` を使うことができます。
|
||||
|
||||
これらはそれぞれ1つ以上のキーコードを引数として受け付けます。これは重要な点です: **キーボードの任意のレイヤー**のキーコードを使うことができます。当たり前ですが、リーダーマクロが発動するにはそのレイヤーがアクティブである必要があります
|
||||
|
||||
## `rules.mk` にリーダーキーサポートを追加
|
||||
|
||||
リーダーキーのサポートを追加するには、単純にキーマップの `rules.mk` に1行を追加します:
|
||||
|
||||
```make
|
||||
LEADER_ENABLE = yes
|
||||
```
|
||||
|
||||
## リーダーキーのキーごとのタイミング
|
||||
|
||||
長いリーダーキー文字列のためや 200wpm のタイピングスキルが無い場合に、非常に長いタイムアウト時間に頼るのではなく、キーを押すごとに入力を完了するまでの時間を増やす機能を使用することができます。これは、リーダーキーを使ってタップダンスを再現する場合に非常に役立ちます (C, C, C のような同じキーを複数回タップする場合)。
|
||||
|
||||
これを有効にするには、以下を `config.h` に配置します:
|
||||
```c
|
||||
#define LEADER_PER_KEY_TIMING
|
||||
```
|
||||
|
||||
この後、`LEADER_TIMEOUT` を 300ms 未満に下げることをお勧めします。
|
||||
|
||||
```c
|
||||
#define LEADER_TIMEOUT 250
|
||||
```
|
||||
|
||||
これで、リーダーキーのタイムアウト時間を 1000ms に設定することなく以下のようなことが可能になると思われます。
|
||||
|
||||
```c
|
||||
SEQ_THREE_KEYS(KC_C, KC_C, KC_C) {
|
||||
SEND_STRING("Per key timing is great!!!");
|
||||
}
|
||||
```
|
||||
|
||||
## 厳密なキー処理
|
||||
|
||||
デフォルトでは、リーダーキー機能は、リーダーシーケンスの確認時に [`モッドタップ`](ja/mod_tap.md) および [`レイヤータップ`](ja/feature_layers.md#switching-and-toggling-layers) 機能からのキーコードをフィルターします。つまり、`LT(3, KC_A)` を使っている場合、`LT(3, KC_A)` ではなくシーケンスの `KC_A` として取り出され、新しいユーザにとってより期待される動作を提供します。
|
||||
|
||||
ほとんどの場合これで問題ありませんが、シーケンスでキーコード全体(例えば、上の例での `LT(3, KC_A)`) を指定したい場合は、`config.h` ファイルに `#define LEADER_KEY_STRICT_KEY_PROCESSING` を追加することこのような機能を有効にすることができます。これでフィルタリングが無効になり、キーコード全体を指定する必要があります。
|
||||
|
||||
## カスタマイズ
|
||||
|
||||
リーダーキー機能には、リーダーキー機能の動作にいくらかのカスタマイズを追加する方法があります。リーダーキー機能のプロセスの特定の部分で呼び出すことができる2つの関数、`leader_start()` と `leader_end()` です。
|
||||
|
||||
`KC_LEAD` キーがタップされた時に `leader_start()` 関数が呼ばれ、リーダーシーケンスが完了するか、リーダータイムアウトの時間に達した時に `leader_end()` 関数が呼ばれます。
|
||||
|
||||
リーダーシーケンスにフィードバック(ビープまたは音楽を再生するなど)を追加するために、これらの関数をコード (通常 は`keymap.c`)に追加することができます。
|
||||
|
||||
```c
|
||||
void leader_start(void) {
|
||||
// シーケンスの開始
|
||||
}
|
||||
|
||||
void leader_end(void) {
|
||||
// シーケンスの終了 (成功しない/失敗を検知)
|
||||
}
|
||||
```
|
||||
|
||||
### 例
|
||||
|
||||
この例では、リーダーシーケンスを開始するために `KC_LEAD` を押すとマリオの "One Up" 音が再生され、正常に完了した場合は "All Star" が再生され、失敗した場合は "Rick Roll" を再生されます。
|
||||
|
||||
```c
|
||||
bool did_leader_succeed;
|
||||
#ifdef AUDIO_ENABLE
|
||||
float leader_start[][2] = SONG(ONE_UP_SOUND );
|
||||
float leader_succeed[][2] = SONG(ALL_STAR);
|
||||
float leader_fail[][2] = SONG(RICK_ROLL);
|
||||
#endif
|
||||
LEADER_EXTERNS();
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
LEADER_DICTIONARY() {
|
||||
did_leader_succeed = leading = false;
|
||||
|
||||
SEQ_ONE_KEY(KC_E) {
|
||||
// マクロ内でできること
|
||||
SEND_STRING(SS_LCTL(SS_LSFT("t")));
|
||||
did_leader_succeed = true;
|
||||
} else
|
||||
SEQ_TWO_KEYS(KC_E, KC_D) {
|
||||
SEND_STRING(SS_LGUI("r") "cmd\n" SS_LCTL("c"));
|
||||
did_leader_succeed = true;
|
||||
}
|
||||
leader_end();
|
||||
}
|
||||
}
|
||||
|
||||
void leader_start(void) {
|
||||
#ifdef AUDIO_ENABLE
|
||||
PLAY_SONG(leader_start);
|
||||
#endif
|
||||
}
|
||||
|
||||
void leader_end(void) {
|
||||
if (did_leader_succeed) {
|
||||
#ifdef AUDIO_ENABLE
|
||||
PLAY_SONG(leader_succeed);
|
||||
#endif
|
||||
} else {
|
||||
#ifdef AUDIO_ENABLE
|
||||
PLAY_SONG(leader_fail);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
```
|
95
docs/ja/feature_led_matrix.md
Normal file
95
docs/ja/feature_led_matrix.md
Normal file
@@ -0,0 +1,95 @@
|
||||
# LED マトリックスライト
|
||||
|
||||
<!---
|
||||
original document: 0.8.141:docs/feature_led_matrix.md
|
||||
git diff 0.8.141 HEAD -- docs/feature_led_matrix.md | cat
|
||||
-->
|
||||
|
||||
この機能により、外部ドライバによって駆動される LED マトリックスを使うことができます。この機能は、バックライト制御と同じキーコードを使えるようにするため、バックライトシステムに接続します。
|
||||
|
||||
RGB LED を使いたい場合は、代わりに [RGB マトリックスサブシステム](ja/feature_rgb_matrix.md) を使うべきです。
|
||||
|
||||
## ドライバ設定
|
||||
|
||||
### IS31FL3731
|
||||
|
||||
I2C IS31FL3731 RGB コントローラを使ったアドレス指定可能な LED マトリックスライトのための基本的なサポートがあります:有効にするには、`rules.mk` に以下を追加します:
|
||||
|
||||
LED_MATRIX_ENABLE = IS31FL3731
|
||||
|
||||
1から4個の IS31FL3731 IC を使うことができます。キーボード上に存在しない IC の `LED_DRIVER_ADDR_<N>` 定義を指定しないでください。`config.h` に以下の項目を定義することができます:
|
||||
|
||||
| 変数 | 説明 | デフォルト |
|
||||
|----------|-------------|---------|
|
||||
| `ISSI_TIMEOUT` | (オプション) i2c メッセージを待つ時間 | 100 |
|
||||
| `ISSI_PERSISTENCE` | (オプション) 失敗したメッセージをこの回数再試行する | 0 |
|
||||
| `LED_DRIVER_COUNT` | (必須) LED ドライバ IC の数 | |
|
||||
| `LED_DRIVER_LED_COUNT` | (必須) 全てのドライバの LED ライトの数 | |
|
||||
| `LED_DRIVER_ADDR_1` | (必須) 最初の LED ドライバのアドレス | |
|
||||
| `LED_DRIVER_ADDR_2` | (オプション) 2番目の LED ドライバのアドレス | |
|
||||
| `LED_DRIVER_ADDR_3` | (オプション) 3番目の LED ドライバのアドレス | |
|
||||
| `LED_DRIVER_ADDR_4` | (オプション) 4番目の LED ドライバのアドレス | |
|
||||
|
||||
2つのドライバを使う例です。
|
||||
|
||||
// これは7ビットのアドレスで、左シフトされます
|
||||
// ビット0に0を設定すると書き込み、1を設定すると読み込みです (I2C プロトコルに従う)
|
||||
// アドレスは配線によって変わります:
|
||||
// 0b1110100 AD <-> GND
|
||||
// 0b1110111 AD <-> VCC
|
||||
// 0b1110101 AD <-> SCL
|
||||
// 0b1110110 AD <-> SDA
|
||||
#define LED_DRIVER_ADDR_1 0b1110100
|
||||
#define LED_DRIVER_ADDR_2 0b1110110
|
||||
|
||||
#define LED_DRIVER_COUNT 2
|
||||
#define LED_DRIVER_1_LED_COUNT 25
|
||||
#define LED_DRIVER_2_LED_COUNT 24
|
||||
#define LED_DRIVER_LED_COUNT LED_DRIVER_1_LED_TOTAL + LED_DRIVER_2_LED_TOTAL
|
||||
|
||||
現在、2つのドライバのみがサポートされますが、4つの組み合わせ全てをサポートすることは簡単です。
|
||||
|
||||
`<keyboard>.c` に全ての LED を列挙する配列を定義します:
|
||||
|
||||
const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
|
||||
/* これらの位置については IS31 マニュアルを参照してください
|
||||
* driver
|
||||
* | LED address
|
||||
* | | */
|
||||
{0, C3_3},
|
||||
....
|
||||
}
|
||||
|
||||
ここで、`Cx_y` は[データシート](http://www.issi.com/WW/pdf/31FL3731.pdf)およびヘッダファイル `drivers/issi/is31fl3731-simple.h` で定義されるマトリックス内の LED の位置です。`driver` は `config.h` で定義したドライバのインデックス(`0`、`1`、`2`、`3`のいずれか)です。
|
||||
|
||||
## キーコード
|
||||
|
||||
現在のところ、全ての LED マトリックスのキーコードは[バックライトシステム](ja/feature_backlight.md)と共有されます。
|
||||
|
||||
## LED マトリックス効果
|
||||
|
||||
現在のところ、LED マトリックス効果は作成されていません。
|
||||
|
||||
## カスタムレイヤー効果
|
||||
|
||||
カスタムレイヤー効果は `<keyboard>.c` 内で以下を定義することで行うことができます:
|
||||
|
||||
void led_matrix_indicators_kb(void) {
|
||||
led_matrix_set_index_value(index, value);
|
||||
}
|
||||
|
||||
同様の関数がキーマップ内で `led_matrix_indicators_user` として動作します。
|
||||
|
||||
## サスペンド状態
|
||||
|
||||
サスペンド機能を使うには、以下を `<keyboard>.c` に追加します:
|
||||
|
||||
void suspend_power_down_kb(void)
|
||||
{
|
||||
led_matrix_set_suspend_state(true);
|
||||
}
|
||||
|
||||
void suspend_wakeup_init_kb(void)
|
||||
{
|
||||
led_matrix_set_suspend_state(false);
|
||||
}
|
49
docs/ja/feature_pointing_device.md
Normal file
49
docs/ja/feature_pointing_device.md
Normal file
@@ -0,0 +1,49 @@
|
||||
# ポインティングデバイス :id=pointing-device
|
||||
|
||||
<!---
|
||||
original document: 0.8.182:docs/feature_pointing_device.md
|
||||
git diff 0.8.182 HEAD -- docs/feature_pointing_device.md | cat
|
||||
-->
|
||||
|
||||
ポインティングデバイスは汎用的な機能の総称です: システムポインタを移動します。マウスキーのような他のオプションも確かにありますが、これは簡単に変更可能で軽量であることを目指しています。機能を制御するためにカスタムキーを実装したり、他の周辺機器から情報を収集してここに直接挿入したりできます - QMK に処理を任せてください。
|
||||
|
||||
ポインティングデバイスを有効にするには、rules.mk の以下の行のコメントを解除します:
|
||||
|
||||
```makefile
|
||||
POINTING_DEVICE_ENABLE = yes
|
||||
```
|
||||
|
||||
マウスレポートを操作するために、以下の関数を使うことができます:
|
||||
|
||||
* `pointing_device_get_report()` - ホストコンピュータに送信された情報を表す現在の report_mouse_t を返します。
|
||||
* `pointing_device_set_report(report_mouse_t newMouseReport)` - ホストコンピュータに送信される report_mouse_t を上書き保存します。
|
||||
|
||||
report_mouse_t (ここでは "mouseReport") が以下のプロパティを持つことを覚えておいてください:
|
||||
|
||||
* `mouseReport.x` - これは、x軸の動き(+ 右へ、- 左へ)を表す -127 から 127 (128ではなく、USB HID 仕様で定義されています)の符号付き整数です。
|
||||
* `mouseReport.y` - これは、y軸の動き(+ 上へ、- 下へ)を表す -127 から 127 (128ではなく、USB HID 仕様で定義されています)の符号付き整数です。
|
||||
* `mouseReport.v` - これは、垂直スクロール(+ 上へ、- 下へ)を表す -127 から 127 (128ではなく、USB HID 仕様で定義されています)の符号付き整数です。
|
||||
* `mouseReport.h` - これは、水平スクロール(+ 右へ、- 左へ)を表す -127 から 127 (128ではなく、USB HID 仕様で定義されています)の符号付き整数です。
|
||||
* `mouseReport.buttons` - これは uint8_t で、上位の5ビットを使っています。これらのビットはマウスボタンの状態を表します - ビット 3 はマウスボタン 5、ビット 7 はマウスボタン 1 です。
|
||||
|
||||
マウスレポートが送信されると、x、y、v、h のいずれの値も 0 に設定されます (これは "pointing_device_send()" で行われます。この挙動を回避するためにオーバーライドすることができます)。このように、ボタンの状態は持続しますが、動きは1度だけ起こります。さらにカスタマイズするために、`pointing_device_init` と `pointing_device_task` のどちらもオーバーライドすることができます。
|
||||
|
||||
以下の例では、カスタムキーを使ってマウスをクリックし垂直および水平方向に127単位スクロールし、リリースされた時にそれを全て元に戻します - なぜならこれは完全に便利な機能だからです。いいですか、以下はひとつの例です:
|
||||
|
||||
```c
|
||||
case MS_SPECIAL:
|
||||
report_mouse_t currentReport = pointing_device_get_report();
|
||||
if (record->event.pressed) {
|
||||
currentReport.v = 127;
|
||||
currentReport.h = 127;
|
||||
currentReport.buttons |= MOUSE_BTN1; // this is defined in report.h
|
||||
} else {
|
||||
currentReport.v = -127;
|
||||
currentReport.h = -127;
|
||||
currentReport.buttons &= ~MOUSE_BTN1;
|
||||
}
|
||||
pointing_device_set_report(currentReport);
|
||||
break;
|
||||
```
|
||||
|
||||
マウスレポートは送信されるたびに 0 (ボタンを除く)に設定されることを思い出してください。そのため、スクロールはそれぞれの場合に1度だけ発生します。
|
15
docs/ja/feature_thermal_printer.md
Normal file
15
docs/ja/feature_thermal_printer.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# 感熱式プリンタ
|
||||
|
||||
<!---
|
||||
original document: 0.8.147:docs/feature_thermal_printer.md
|
||||
git diff 0.8.147 HEAD -- docs/feature_thermal_printer.md | cat
|
||||
-->
|
||||
|
||||
<!-- FIXME: Describe thermal printers support here. -->
|
||||
|
||||
## 感熱式プリンタのキーコード
|
||||
|
||||
| キー | 説明 |
|
||||
|-----------|----------------------------------------|
|
||||
| `PRINT_ON` | ユーザが入力した全ての印刷を開始 |
|
||||
| `PRINT_OFF` | ユーザが入力した全ての印刷を停止 |
|
35
docs/ja/feature_velocikey.md
Normal file
35
docs/ja/feature_velocikey.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# Velocikey
|
||||
|
||||
<!---
|
||||
original document: 0.8.147:docs/feature_velocikey.md
|
||||
git diff 0.8.147 HEAD -- docs/feature_velocikey.md | cat
|
||||
-->
|
||||
|
||||
Velocikey は入力の速度を使って(レインボー渦巻効果のような)ライト効果の速度を制御できる機能です。速く入力すればするほどライトが速くなります!
|
||||
|
||||
## 使用法
|
||||
Velocikey を使うためには、2つのステップがあります。最初に、キーボードをコンパイルする時に、`rules.mk` に `VELOCIKEY_ENABLE=yes` を設定する必要があります。例えば:
|
||||
|
||||
```
|
||||
BOOTMAGIC_ENABLE = no
|
||||
MOUSEKEY_ENABLE = no
|
||||
STENO_ENABLE = no
|
||||
EXTRAKEY_ENABLE = yes
|
||||
VELOCIKEY_ENABLE = yes
|
||||
```
|
||||
|
||||
次に、キーボードの使用中に、VLK_TOG キーコードを使って Velocikey を有効にする必要もあります。これは機能をオンおよびオフにします。
|
||||
|
||||
以下の全てのライト効果が、Velocikey を有効にすることで制御されます:
|
||||
- RGB 明滅動作
|
||||
- RGB レインボームード
|
||||
- RGB レインボー渦巻
|
||||
- RGB スネーク
|
||||
- RGB ナイト
|
||||
|
||||
LED 明滅動作の効果のサポートは計画されていますがまだ利用できません。
|
||||
|
||||
Velocikey が有効になっている限り、現在オンになっている RGB ライトの他の全ての速度設定に関係なく、速度が制御されます。
|
||||
|
||||
## 設定
|
||||
Velocikey は現在のところキーボード設定を介したどのような設定もサポートしません。速度の増加あるいは減少率などを調整したい場合は、`velocikey.c` を編集し、そこで値を調整して、好みの速度を実現する必要があります。
|
@@ -1,15 +1,15 @@
|
||||
# QMK で Github を使う方法
|
||||
# QMK で GitHub を使う方法
|
||||
|
||||
<!---
|
||||
original document: 0.8.82:docs/getting_started_github.md
|
||||
git diff 0.8.82 HEAD -- docs/getting_started_github.md | cat
|
||||
-->
|
||||
|
||||
Github は慣れていない人には少し注意が必要です - このガイドは、QMK におけるフォーク、クローン、プルリクエストのサブミットの各ステップについて説明します。
|
||||
GitHub は慣れていない人には少し注意が必要です - このガイドは、QMK におけるフォーク、クローン、プルリクエストのサブミットの各ステップについて説明します。
|
||||
|
||||
?> このガイドでは、あなたがコマンドラインでの実行にある程度慣れており、システムに git がインストールされていることを前提にしています。
|
||||
|
||||
[QMK Github ページ](https://github.com/qmk/qmk_firmware)を開くと、右上に "Fork" というボタンが見えます:
|
||||
[QMK GitHub ページ](https://github.com/qmk/qmk_firmware)を開くと、右上に "Fork" というボタンが見えます:
|
||||
|
||||

|
||||
|
||||
@@ -59,7 +59,7 @@ To https://github.com/whoeveryouare/qmk_firmware.git
|
||||
+ 20043e64...7da94ac5 master -> master
|
||||
```
|
||||
|
||||
あなたの変更は今では Github 上のフォークにあります - フォーク (`https://github.com/<whoeveryouare>/qmk_firmware`)に戻ると、"New Pull Request" ボタンをクリックすることで新しいプルリクエストを作成することができます:
|
||||
あなたの変更は今では GitHub 上のフォークにあります - フォーク (`https://github.com/<whoeveryouare>/qmk_firmware`)に戻ると、"New Pull Request" ボタンをクリックすることで新しいプルリクエストを作成することができます:
|
||||
|
||||

|
||||
|
||||
|
@@ -28,7 +28,7 @@ QMK Configurator は Chrome/Firefox で最適に動作します。
|
||||
|
||||
キーボードが QMK を搭載していると宣伝されていてもリストにない場合は、開発者がまだ作業中か、私たちがまだマージするきっかけがなかった可能性があります。
|
||||
アクティブな [Pull Request](https://github.com/qmk/qmk_firmware/pulls?q=is%3Aopen+is%3Apr+label%3Akeyboard) がない場合、[qmk_firmware](https://github.com/qmk/qmk_firmware/issues)で報告して、その特定のキーボードのサポートをリクエストします。
|
||||
製作者自身の github アカウントにある QMK 搭載キーボードもあります。
|
||||
製作者自身の GitHub アカウントにある QMK 搭載キーボードもあります。
|
||||
それも再確認してください。
|
||||
|
||||
## キーボードのレイアウトを選択する
|
||||
|
@@ -14,7 +14,7 @@
|
||||
|
||||
* [Great General Tutorial](https://www.codecademy.com/learn/learn-git)
|
||||
* [Git Game To Learn From Examples](https://learngitbranching.js.org/)
|
||||
* [Git Resources to Learn More About Github](getting_started_github.md)
|
||||
* [Git Resources to Learn More About GitHub](getting_started_github.md)
|
||||
* [Git Resources Aimed Specifically toward QMK](contributing.md)
|
||||
|
||||
### 日本語
|
||||
@@ -22,7 +22,7 @@
|
||||
_日本語のリソース情報を募集中です。_
|
||||
|
||||
* [Git Game To Learn From Examples(日本語対応有り)](https://learngitbranching.js.org/)
|
||||
* [QMK で Github を使う方法](ja/getting_started_github.md)
|
||||
* [QMK で GitHub を使う方法](ja/getting_started_github.md)
|
||||
* [貢献方法](ja/contributing.md)
|
||||
|
||||
## コマンドラインに関するリソース:
|
||||
|
@@ -531,6 +531,7 @@ See also: [Swap Hands](feature_swap_hands.md)
|
||||
|`SH_MOFF` |Momentarily turns off swap. |
|
||||
|`SH_TG` |Toggles swap on and off with every key press. |
|
||||
|`SH_TT` |Toggles with a tap; momentary when held. |
|
||||
|`SH_OS` |One shot swap hands: toggle while pressed or until next key press. |
|
||||
|
||||
## Unicode Support :id=unicode-support
|
||||
|
||||
|
@@ -71,10 +71,22 @@ On the other hand, you can change `layer_state` to overlay the base layer with o
|
||||
|
||||
|
||||
### Layer Precedence and Transparency
|
||||
Note that ***higher layer has higher priority on stack of layers***, namely firmware falls down from top layer to bottom to look up keycode. Once it spots keycode other than **`KC_TRNS`**(transparent) on a layer it stops searching and lower layers aren't referred.
|
||||
Note that ***higher layers have higher priority within the stack of layers***. The firmware works its way down from the highest active layers to look up keycodes. Once the firmware locates a keycode other than `KC_TRNS` (transparent) on an active layer, it stops searching, and lower layers aren't referenced.
|
||||
|
||||
You can place `KC_TRANS` on overlay layer changes just part of layout to fall back on lower or base layer.
|
||||
Key with `KC_TRANS` (`KC_TRNS` and `_______` are the alias) doesn't has its own keycode and refers to lower valid layers for keycode, instead.
|
||||
____________
|
||||
/ / <--- Higher layer
|
||||
/ KC_TRNS //
|
||||
/___________// <--- Lower layer (KC_A)
|
||||
/___________/
|
||||
|
||||
In the above scenario, the non-transparent keys on the higher layer would be usable, but whenever `KC_TRNS` (or equivalent) is defined, the keycode (`KC_A`) on the lower level would be used.
|
||||
|
||||
**Note:** Valid ways to denote transparency on a given layer:
|
||||
* `KC_TRANSPARENT`
|
||||
* `KC_TRNS` (alias)
|
||||
* `_______` (alias)
|
||||
|
||||
These keycodes allow the processing to fall through to lower layers in search of a non-transparent keycode to process.
|
||||
|
||||
## Anatomy of a `keymap.c`
|
||||
|
||||
|
@@ -1,18 +1,41 @@
|
||||
# Flashing Your Keyboard
|
||||
# Flashing Your Keyboard
|
||||
|
||||
Now that you've built a custom firmware file you'll want to flash your keyboard.
|
||||
Now that you've built a custom firmware file you'll want to flash your keyboard.
|
||||
|
||||
## Put Your Keyboard into DFU (Bootloader) Mode
|
||||
|
||||
In order to flash your custom firmware you must first put your keyboard into a special flashing mode. While it is in this mode you will not be able to type or otherwise use your keyboard. It is very important that you do not unplug the keyboard or otherwise interrupt the flashing process while the firmware is being written.
|
||||
|
||||
Different keyboards have different ways to enter this special mode. If your PCB currently runs QMK, TMK, or PS2AVRGB (Bootmapper Client) and you have not been given specific instructions, try the following, in order:
|
||||
|
||||
* Hold down both shift keys and press `Pause`
|
||||
* Hold down both shift keys and press `B`
|
||||
* Unplug your keyboard, hold down the Spacebar and `B` at the same time, plug in your keyboard and wait a second before releasing the keys
|
||||
* Unplug your keyboard, hold down the top or bottom left key (usually Escape or Left Control) and plug in your keyboard
|
||||
* Press the physical `RESET` button, usually located on the underside of the PCB
|
||||
* Locate header pins on the PCB labeled `RESET` and `GND`, and short them together while plugging your PCB in
|
||||
|
||||
If you've attempted all of the above to no avail, and the main chip on the board says `STM32` on it, this may be a bit more complicated. Generally your best bet is to ask on [Discord](https://discord.gg/Uq7gcHh) for assistance. It's likely some photos of the board will be asked for -- if you can get them ready beforehand it'll help move things along!
|
||||
|
||||
Otherwise, you should see a message in yellow, similar to this in QMK Toolbox:
|
||||
|
||||
```
|
||||
*** DFU device connected: Atmel Corp. ATmega32U4 (03EB:2FF4:0000)
|
||||
```
|
||||
|
||||
and this bootloader device will also be present in Device Manager, System Information.app, or `lsusb`.
|
||||
|
||||
## Flashing Your Keyboard with QMK Toolbox
|
||||
|
||||
The simplest way to flash your keyboard will be with the [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases).
|
||||
The simplest way to flash your keyboard will be with the [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases).
|
||||
|
||||
However, the QMK Toolbox is only available for Windows and macOS currently. If you're using Linux (or just wish to flash the firmware from the command line), proceed down to [Flash Your Keyboard From The Command Line](#flash-your-keyboard-from-the-command-line).
|
||||
However, the Toolbox is currently only available for Windows and macOS. If you're using Linux (or just wish to flash the firmware from the command line), skip to the [Flash your Keyboard from the Command Line](#flash-your-keyboard-from-the-command-line) section.
|
||||
|
||||
### Load The File Into QMK Toolbox
|
||||
### Load the File into QMK Toolbox
|
||||
|
||||
Begin by opening the QMK Toolbox application. You'll want to locate the firmware file in Finder or Explorer. Your keyboard firmware may be in one of two formats- `.hex` or `.bin`. QMK tries to copy the appropriate one for your keyboard into the root `qmk_firmware` directory.
|
||||
|
||||
If you are on Windows or macOS there are commands you can use to easily open the current firmware folder in Explorer or Finder.
|
||||
If you are on Windows or macOS, there are commands you can use to easily open the current folder in Explorer or Finder.
|
||||
|
||||
#### Windows
|
||||
|
||||
@@ -38,65 +61,44 @@ For example, the `planck/rev5` with a `default` keymap will have this filename:
|
||||
planck_rev5_default.hex
|
||||
```
|
||||
|
||||
Once you have located your firmware file drag it into the "Local file" box in QMK Toolbox, or click "Open" and navigate to where your firmware file is stored.
|
||||
|
||||
### Put Your Keyboard Into DFU (Bootloader) Mode
|
||||
|
||||
In order to flash your custom firmware you have to put your keyboard into a special flashing mode. While it is in this mode you will not be able to type or otherwise use your keyboard. It is very important that you do not unplug your keyboard or otherwise interrupt the flashing process while the firmware is being written.
|
||||
|
||||
Different keyboards have different ways to enter this special mode. If your PCB currently runs QMK or TMK and you have not been given specific instructions try the following, in order:
|
||||
|
||||
* Hold down both shift keys and press `Pause`
|
||||
* Hold down both shift keys and press `B`
|
||||
* Unplug your keyboard, hold down the Spacebar and `B` at the same time, plug in your keyboard and wait a second before releasing the keys
|
||||
* Press the physical `RESET` button on the bottom of the PCB
|
||||
* Locate header pins on the PCB labeled `BOOT0` or `RESET`, short those together while plugging your PCB in
|
||||
|
||||
When you are successful you will see a message similar to this in QMK Toolbox:
|
||||
|
||||
```
|
||||
*** Clueboard - Clueboard 66% HotSwap disconnected -- 0xC1ED:0x2390
|
||||
*** DFU device connected
|
||||
```
|
||||
Once you have located your firmware file drag it into the "Local file" box in QMK Toolbox, or click "Open" and navigate to where your firmware file is stored.
|
||||
|
||||
### Flash Your Keyboard
|
||||
|
||||
Click the `Flash` button in QMK Toolbox. You will see output similar to the following:
|
||||
|
||||
```
|
||||
*** Clueboard - Clueboard 66% HotSwap disconnected -- 0xC1ED:0x2390
|
||||
*** DFU device connected
|
||||
*** DFU device connected: Atmel Corp. ATmega32U4 (03EB:2FF4:0000)
|
||||
*** Attempting to flash, please don't remove device
|
||||
>>> dfu-programmer atmega32u4 erase --force
|
||||
>>> dfu-programmer.exe atmega32u4 erase --force
|
||||
Erasing flash... Success
|
||||
Checking memory from 0x0 to 0x6FFF... Empty.
|
||||
>>> dfu-programmer atmega32u4 flash /Users/skully/qmk_firmware/clueboard_66_hotswap_gen1_skully.hex
|
||||
Checking memory from 0x0 to 0x55FF... Empty.
|
||||
0% 100% Programming 0x5600 bytes...
|
||||
>>> dfu-programmer.exe atmega32u4 flash "D:\Git\qmk_firmware\gh60_satan_default.hex"
|
||||
Checking memory from 0x0 to 0x3F7F... Empty.
|
||||
0% 100% Programming 0x3F80 bytes...
|
||||
[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] Success
|
||||
0% 100% Reading 0x7000 bytes...
|
||||
[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] Success
|
||||
Validating... Success
|
||||
0x5600 bytes written into 0x7000 bytes memory (76.79%).
|
||||
>>> dfu-programmer atmega32u4 reset
|
||||
0x3F80 bytes written into 0x7000 bytes memory (56.70%).
|
||||
>>> dfu-programmer.exe atmega32u4 reset
|
||||
|
||||
*** DFU device disconnected
|
||||
*** Clueboard - Clueboard 66% HotSwap connected -- 0xC1ED:0x2390
|
||||
*** DFU device disconnected: Atmel Corp: ATmega32U4 (03EB:2FF4:0000)
|
||||
```
|
||||
|
||||
## Flash your Keyboard from the Command Line
|
||||
|
||||
This has been made pretty simple compared to what it used to be. When you are ready to compile and flash your firmware, open up your terminal window and run the flash command:
|
||||
This has been made pretty simple compared to what it used to be. When you are ready to compile and flash your firmware, open up your terminal window and run the flash command:
|
||||
|
||||
qmk flash
|
||||
|
||||
If you have not configured your keyboard/keymap name, or you have multiple keyboards, you can specify the keyboard and keymap:
|
||||
If you have not configured your keyboard/keymap name in the CLI, or you have multiple keyboards, you can specify the keyboard and keymap:
|
||||
|
||||
qmk flash -kb <my_keyboard> -km <my_keymap>
|
||||
|
||||
This will check the keyboard's configuration, and then attempt to flash it based on the specified bootloader. This means that you don't need to know which bootloader that your keyboard uses. Just run the command, and let the command do the heavy lifting.
|
||||
This will check the keyboard's configuration, and then attempt to flash it based on the specified bootloader. This means that you don't need to know which bootloader that your keyboard uses. Just run the command, and let the command do the heavy lifting.
|
||||
|
||||
However, this does rely on the bootloader being set by the keyboard. If this information is not configured, or you're using a board that doesn't have a supported target to flash it, you will see this error:
|
||||
However, this does rely on the bootloader being set by the keyboard. If this information is not configured, or you're using a board that doesn't have a supported target to flash it, you will see this error:
|
||||
|
||||
WARNING: This board's bootloader is not specified or is not supported by the ":flash" target at this time.
|
||||
|
||||
|
@@ -57,18 +57,33 @@ You may be asked to close and reopen the window. Do this and keep running the ab
|
||||
|
||||
You will need to install Homebrew. Follow the instructions on the [Homebrew homepage](https://brew.sh).
|
||||
|
||||
After Homebrew is installed run these commands:
|
||||
After Homebrew is installed run this command:
|
||||
|
||||
brew tap qmk/qmk
|
||||
brew install qmk
|
||||
brew install qmk/qmk/qmk
|
||||
|
||||
### Linux
|
||||
|
||||
You will need to install Git and Python. It's very likely that you already have both, but if not, one of the following commands should install them:
|
||||
|
||||
* Debian / Ubuntu / Devuan: `apt-get install git python3 && python3 -m pip install qmk`
|
||||
* Fedora / Red Hat / CentOS: `yum install git python3 && python3 -m pip install qmk`
|
||||
* Arch: `yay -S qmk` (or use any other AUR Helper)
|
||||
* 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`
|
||||
|
||||
Install the global CLI to bootstrap your system:
|
||||
|
||||
`python3 -m pip install --user qmk` (on Arch-based distros you can also try the `qmk` package from AUR (**note**: it's maintained by a community member): `yay -S qmk`)
|
||||
|
||||
### FreeBSD
|
||||
|
||||
You will need to install Git and Python. It's possible that you already have both, but if not, run the following commands to install them:
|
||||
|
||||
pkg install git python3
|
||||
|
||||
Make sure that `$HOME/.local/bin` is added to your `$PATH` so that locally install Python packages are available.
|
||||
|
||||
Once installed, you can install QMK CLI:
|
||||
|
||||
python3 -m pip install --user qmk
|
||||
|
||||
## 3. Run QMK Setup :id=set-up-qmk
|
||||
|
||||
@@ -78,6 +93,18 @@ After installing QMK you can set it up with this command:
|
||||
|
||||
In most situations you will want to answer Yes to all of the prompts.
|
||||
|
||||
?>**Note on Debian, Ubuntu and their derivatives**:
|
||||
It's possible, that you will get an error saying something like: `bash: qmk: command not found`.
|
||||
This is due to a [bug](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=839155) Debian introduced with their Bash 4.4 release, which removed `$HOME/.local/bin` from the PATH. This bug was later fixed on Debian and Ubuntu.
|
||||
Sadly, Ubuntu reitroduced this bug and is [yet to fix it](https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1588562).
|
||||
Luckily, the fix is easy. Run this as your user: `echo "PATH=$HOME/.local/bin:$PATH" >> $HOME/.bashrc && source $HOME/.bashrc`
|
||||
|
||||
?>**Note on FreeBSD**:
|
||||
It is suggested to run `qmk setup` as a non-`root` user to start with, but this will likely identify packages that need to be installed to your
|
||||
base system using `pkg`. However the installation will probably fail when run as an unprivileged user.
|
||||
To manually install the base dependencies, run `./util/qmk_install.sh` either as `root`, or with `sudo`.
|
||||
Once that completes, re-run `qmk setup` to complete the setup and checks.
|
||||
|
||||
?> If you already know [how to use GitHub](getting_started_github.md), we recommend that you create your own fork and use `qmk setup <github_username>/qmk_firmware` to clone your personal fork. If you don't know what that means you can safely ignore this message.
|
||||
|
||||
## 4. Test Your Build Environment
|
||||
@@ -108,7 +135,7 @@ Most people new to QMK only have 1 keyboard. You can set this keyboard as your d
|
||||
|
||||
qmk config user.keyboard=clueboard/66/rev4
|
||||
|
||||
You can also set your default keymap name. Most people use their github username here, and we recommend that you do too.
|
||||
You can also set your default keymap name. Most people use their GitHub username here, and we recommend that you do too.
|
||||
|
||||
qmk config user.keymap=<github_username>
|
||||
|
||||
|
@@ -102,7 +102,7 @@ There are a number of extensions that you may want to install:
|
||||
This installs a bunch of Git related tools that may make using Git with QMK Firmware easier.
|
||||
* [EditorConfig for VS Code](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig) - _[Optional]_ - Helps to keep the code to the QMK Coding Conventions.
|
||||
* [Bracket Pair Colorizer 2](https://marketplace.visualstudio.com/items?itemName=CoenraadS.bracket-pair-colorizer-2) - _[Optional]_ - This color codes the brackets in your code, to make it easier to reference nested code.
|
||||
* [Github Markdown Preview](https://marketplace.visualstudio.com/items?itemName=bierner.github-markdown-preview) - _[Optional]_ - Makes the markdown preview in VS Code more like GitHub's.
|
||||
* [GitHub Markdown Preview](https://marketplace.visualstudio.com/items?itemName=bierner.github-markdown-preview) - _[Optional]_ - Makes the markdown preview in VS Code more like GitHub's.
|
||||
* [VS Live Share Extension Pack](https://marketplace.visualstudio.com/items?itemName=MS-vsliveshare.vsliveshare-pack) - _[Optional]_ - This extension allows somebody else to access your workspace (or you to access somebody else's workspace) and help out. This is great if you're having issues and need some help from somebody.
|
||||
* [VIM Keymap](https://marketplace.visualstudio.com/items?itemName=GiuseppeCesarano.vim-keymap) - _[Optional]_ - For those that prefer VIM style keybindings. There are other options for this, too.
|
||||
* [Travis CI Status](https://marketplace.visualstudio.com/items?itemName=felixrieseberg.vsc-travis-ci-status) - _[Optional]_ - This shows the current Travis CI status, if you have it set up.
|
||||
|
@@ -36,7 +36,7 @@ These are defaults based on what has been implemented for ARM boards.
|
||||
| [RGB Lighting](feature_rgblight.md) | Disabled |
|
||||
| [Backlight](feature_backlight.md) | Forces [task driven PWM](feature_backlight.md#software-pwm-driver) until ARM can provide automatic configuration |
|
||||
| USB Host (e.g. USB-USB converter) | Not supported (USB host code is AVR specific and is not currently supported on ARM) |
|
||||
| [Split keyboards](feature_split_keyboard.md) | Not supported yet |
|
||||
| [Split keyboards](feature_split_keyboard.md) | Partial - heavily dependent on enabled features |
|
||||
|
||||
## Manual Conversion
|
||||
|
||||
|
@@ -12,7 +12,7 @@ QMK (*Quantum Mechanical Keyboard*) é uma comunidade de código aberto que mant
|
||||
|
||||
## Como obter e usar o QMK
|
||||
|
||||
Se você planeja contribuir com um _keymap_ ("mapa de teclas"), teclado ou recursos para o QMK, o jeito mais fácil é [percorrer o repositório através do Github](https://github.com/qmk/qmk_firmware#fork-destination-box) e clonar seu repositório localmente para fazer suas alterações, dê um _push_ nelas e abra uma [_Pull request_](https://github.com/qmk/qmk_firmware/pulls) no seu fork.
|
||||
Se você planeja contribuir com um _keymap_ ("mapa de teclas"), teclado ou recursos para o QMK, o jeito mais fácil é [percorrer o repositório através do GitHub](https://github.com/qmk/qmk_firmware#fork-destination-box) e clonar seu repositório localmente para fazer suas alterações, dê um _push_ nelas e abra uma [_Pull request_](https://github.com/qmk/qmk_firmware/pulls) no seu fork.
|
||||
|
||||
Caso contrário, você pode cloná-lo diretamente com `git clone https://github.com/qmk/qmk_firmware`. Não faça o download dos arquivos zip ou tar; é necessário um repositório git para baixar os submódulos para compilar.
|
||||
|
||||
|
@@ -11,7 +11,7 @@
|
||||
* [QMK CLI](pt-br/cli.md)
|
||||
* [QMK CLI Config](pt-br/cli_configuration.md)
|
||||
* [Contributing to QMK](pt-br/contributing.md)
|
||||
* [How to Use Github](pt-br/getting_started_github.md)
|
||||
* [How to Use GitHub](pt-br/getting_started_github.md)
|
||||
* [Getting Help](pt-br/getting_started_getting_help.md)
|
||||
|
||||
* [Breaking Changes](pt-br/breaking_changes.md)
|
||||
|
@@ -11,7 +11,7 @@
|
||||
* [QMK CLI](ru-ru/cli.md)
|
||||
* [QMK CLI Config](ru-ru/cli_configuration.md)
|
||||
* [Contributing to QMK](ru-ru/contributing.md)
|
||||
* [How to Use Github](ru-ru/getting_started_github.md)
|
||||
* [How to Use GitHub](ru-ru/getting_started_github.md)
|
||||
* [Getting Help](ru-ru/getting_started_getting_help.md)
|
||||
|
||||
* [Breaking Changes](ru-ru/breaking_changes.md)
|
||||
|
@@ -6,10 +6,10 @@ GitHub может показаться несколько сложным для
|
||||
|
||||
Откройте [страницу QMK на GitHub] (https://github.com/qmk/qmk_firmware), и в правом верхнем углу вы увидите кнопку с надписью "Fork":
|
||||
|
||||

|
||||

|
||||
|
||||
Если вы состоите в какой-либо организации, вам нужно выбрать учетную запись, к которой будет привязан форк. В большинстве случаев это будет личной аккаунт. Как только ваш форк будет завершен (иногда это занимает немного времени), нажмите кнопку "Clone or Download":
|
||||

|
||||

|
||||
|
||||
И обязательно выберите "HTTPS", затем выделите ссылку и скопируйте ее:
|
||||
|
||||
|
69
docs/serial_driver.md
Normal file
69
docs/serial_driver.md
Normal file
@@ -0,0 +1,69 @@
|
||||
# 'serial' Driver
|
||||
This driver powers the [Split Keyboard](feature_split_keyboard.md) feature.
|
||||
|
||||
?> Serial in this context should be read as **sending information one bit at a time**, rather than implementing UART/USART/RS485/RS232 standards.
|
||||
|
||||
All drivers in this category have the following characteristics:
|
||||
* Provides data and signaling over a single conductor
|
||||
* Limited to single master, single slave
|
||||
|
||||
## Supported Driver Types
|
||||
|
||||
| | AVR | ARM |
|
||||
|-------------------|--------------------|--------------------|
|
||||
| bit bang | :heavy_check_mark: | :heavy_check_mark: |
|
||||
| USART Half-duplex | | :heavy_check_mark: |
|
||||
|
||||
## Driver configuration
|
||||
|
||||
### Bitbang
|
||||
Default driver, the absence of configuration assumes this driver. To configure it, add this to your rules.mk:
|
||||
|
||||
```make
|
||||
SERIAL_DRIVER = bitbang
|
||||
```
|
||||
|
||||
Configure the driver via your config.h:
|
||||
```c
|
||||
#define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6
|
||||
#define SELECT_SOFT_SERIAL_SPEED 1 // or 0, 2, 3, 4, 5
|
||||
// 0: about 189kbps (Experimental only)
|
||||
// 1: about 137kbps (default)
|
||||
// 2: about 75kbps
|
||||
// 3: about 39kbps
|
||||
// 4: about 26kbps
|
||||
// 5: about 20kbps
|
||||
```
|
||||
|
||||
#### ARM
|
||||
|
||||
!> The bitbang driver causes connection issues with bitbang WS2812 driver
|
||||
|
||||
Along with the generic options above, you must also turn on the `PAL_USE_CALLBACKS` feature in your halconf.h.
|
||||
|
||||
### USART Half-duplex
|
||||
Targeting STM32 boards where communication is offloaded to a USART hardware device. The advantage is that this provides fast and accurate timings. `SOFT_SERIAL_PIN` for this driver is the configured USART TX pin. **The TX pin must have appropriate pull-up resistors**. To configure it, add this to your rules.mk:
|
||||
|
||||
```make
|
||||
SERIAL_DRIVER = usart
|
||||
```
|
||||
|
||||
Configure the hardware via your config.h:
|
||||
```c
|
||||
#define SOFT_SERIAL_PIN B6 // USART TX pin
|
||||
#define SELECT_SOFT_SERIAL_SPEED 1 // or 0, 2, 3, 4, 5
|
||||
// 0: about 460800 baud
|
||||
// 1: about 230400 baud (default)
|
||||
// 2: about 115200 baud
|
||||
// 3: about 57600 baud
|
||||
// 4: about 38400 baud
|
||||
// 5: about 19200 baud
|
||||
#define SERIAL_USART_DRIVER SD1 // USART driver of TX pin. default: SD1
|
||||
#define SERIAL_USART_TX_PAL_MODE 7 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7
|
||||
```
|
||||
|
||||
You must also enable the ChibiOS `SERIAL` feature:
|
||||
* In your board's halconf.h: `#define HAL_USE_SERIAL TRUE`
|
||||
* In your board's mcuconf.h: `#define STM32_SERIAL_USE_USARTn TRUE` (where 'n' matches the peripheral number of your selected USART on the MCU)
|
||||
|
||||
Do note that the configuration required is for the `SERIAL` peripheral, not the `UART` peripheral.
|
@@ -18,7 +18,24 @@ You may use more than one slave select pin, not just the `SS` pin. This is usefu
|
||||
|
||||
## ChibiOS/ARM Configuration
|
||||
|
||||
ARM support for this driver is not ready yet. Check back later!
|
||||
You'll need to determine which pins can be used for SPI -- as an example, STM32 parts generally have multiple SPI peripherals, labeled SPI1, SPI2, SPI3 etc.
|
||||
|
||||
To enable SPI, modify your board's `halconf.h` to enable SPI - both `HAL_USE_SPI` and `SPI_USE_WAIT` should be `TRUE`, and `SPI_SELECT_MODE` should be `SPI_SELECT_MODE_PAD`.
|
||||
Then, modify your board's `mcuconf.h` to enable the SPI peripheral you've chosen -- in the case of using SPI2, modify `STM32_SPI_USE_SPI2` to be `TRUE`.
|
||||
|
||||
As per the AVR configuration, you may select any other standard GPIO as a slave select pin, and can be supplied to `spi_start()`.
|
||||
|
||||
Configuration-wise, you'll need to set up the peripheral as per your MCU's datasheet -- the defaults match the pins for a Proton-C, i.e. STM32F303.
|
||||
|
||||
`config.h` override | Description | Default Value
|
||||
----------------------------|---------------------------------------------------------------|--------------
|
||||
`#define SPI_DRIVER` | SPI peripheral to use - SPI1 => `SPID1`, SPI2 => `SPID2` etc. | `SPID2`
|
||||
`#define SPI_SCK_PIN` | The pin to use for the SCK | `B13`
|
||||
`#define SPI_SCK_PAL_MODE` | The alternate function mode for the SCK pin | `5`
|
||||
`#define SPI_MOSI_PIN` | The pin to use for the MOSI | `B15`
|
||||
`#define SPI_MOSI_PAL_MODE` | The alternate function mode for the MOSI pin | `5`
|
||||
`#define SPI_MISO_PIN` | The pin to use for the MISO | `B14`
|
||||
`#define SPI_MISO_PAL_MODE` | The alternate function mode for the MISO pin | `5`
|
||||
|
||||
## Functions
|
||||
|
||||
|
@@ -12,6 +12,6 @@ If you need help with something, the best place to get quick support is going to
|
||||
|
||||
The official QMK forum is [/r/olkb](https://reddit.com/r/olkb) on [reddit.com](https://reddit.com).
|
||||
|
||||
## Github Issues
|
||||
## GitHub Issues
|
||||
|
||||
You can open an [issue on GitHub](https://github.com/qmk/qmk_firmware/issues). This is especially handy when your issue will require long-term discussion or debugging.
|
||||
|
70
docs/syllabus.md
Normal file
70
docs/syllabus.md
Normal file
@@ -0,0 +1,70 @@
|
||||
# QMK Syllabus
|
||||
|
||||
This page helps you build up your QMK knowledge by introducing the basics first and guiding you to understanding all the concepts you need to know to be proficient with QMK.
|
||||
|
||||
# Beginning Topics
|
||||
|
||||
If you read nothing else you should read the documents in this section. After reading the [Tutorial](newbs.md) you should be able to create a basic keymap, compile it, and flash it to your keyboard. The remaining documents will flesh out your knowledge of these basics.
|
||||
|
||||
* **Learn How To Use QMK Tools**
|
||||
* [Tutorial](newbs.md)
|
||||
* [CLI](cli.md)
|
||||
* [GIT](newbs_git_best_practices.md)
|
||||
* **Learn About Keymaps**
|
||||
* [Layers](feature_layers.md)
|
||||
* [Keycodes](keycodes.md)
|
||||
* The full list of keycodes you can use. Note that some may require knowledge found in the Intermediate or Advanced Topics.
|
||||
* **Configuring IDEs** - Optional
|
||||
* [Eclipse](other_eclipse.md)
|
||||
* [VS Code](other_vscode.md)
|
||||
|
||||
# Intermediate Topics
|
||||
|
||||
These topics start to dig into some of the features that QMK supports. You don't have to read all of these documents, but some of the documents in the Advanced Topics section won't make sense if you skip over some of these.
|
||||
|
||||
* **Learn How To Configure Features**
|
||||
<!-- * Configuration Overview FIXME(skullydazed/anyone): write this document -->
|
||||
* [Audio](feature_audio.md)
|
||||
* Lighting
|
||||
* [Backlight](feature_backlight.md)
|
||||
* [LED Matrix](feature_led_matrix.md)
|
||||
* [RGB Lighting](feature_rgblight.md)
|
||||
* [RGB Matrix](feature_rgb_matrix.md)
|
||||
* [Tap-Hold Configuration](tap_hold.md)
|
||||
* **Learn More About Keymaps**
|
||||
* [Keymaps](keymap.md)
|
||||
* [Custom Functions and Keycodes](custom_quantum_functions.md)
|
||||
* Macros
|
||||
* [Dynamic Macros](feature_dynamic_macros.md)
|
||||
* [Compiled Macros](feature_macros.md)
|
||||
* [Tap Dance](feature_tap_dance.md)
|
||||
* [Combos](feature_combo.md)
|
||||
* [Userspace](feature_userspace.md)
|
||||
|
||||
# Advanced Topics
|
||||
|
||||
Everything below here requires a lot of foundational knowledge. Besides being able to create keymaps using advanced features you should be familiar with using both `config.h` and `rules.mk` to configure options for your keyboard.
|
||||
|
||||
* **Maintaining Keyboards Within QMK**
|
||||
* [Handwiring a Keyboard](hand_wire.md)
|
||||
* [Keyboard Guidelines](hardware_keyboard_guidelines.md)
|
||||
* [info.json Reference](reference_info_json.md)
|
||||
* [Debounce API](feature_debounce_type.md)
|
||||
* **Advanced Features**
|
||||
* [Unicode](feature_unicode.md)
|
||||
* [API](api_overview.md)
|
||||
* [Bootmagic](feature_bootmagic.md)
|
||||
* **Hardware**
|
||||
* [How Keyboards Work](how_keyboards_work.md)
|
||||
* [How A Keyboard Matrix Works](how_a_matrix_works.md)
|
||||
* [Split Keyboards](feature_split_keyboard.md)
|
||||
* [Stenography](feature_stenography.md)
|
||||
* [Pointing Devices](feature_pointing_device.md)
|
||||
* **Core Development**
|
||||
* [Coding Conventions](coding_conventions_c.md)
|
||||
* [Compatible Microcontrollers](compatible_microcontrollers.md)
|
||||
* [Custom Matrix](custom_matrix.md)
|
||||
* [Understanding QMK](understanding_qmk.md)
|
||||
* **CLI Development**
|
||||
* [Coding Conventions](coding_conventions_python.md)
|
||||
* [CLI Development Overview](cli_development.md)
|
@@ -12,7 +12,7 @@ As of [PR#1359](https://github.com/qmk/qmk_firmware/pull/1359/), there is a new
|
||||
#define PERMISSIVE_HOLD
|
||||
```
|
||||
|
||||
This makes tap and hold keys (like Mod Tap) work better for fast typist, or for high `TAPPING_TERM` settings.
|
||||
This makes tap and hold keys (like Mod Tap) work better for fast typists, or for high `TAPPING_TERM` settings.
|
||||
|
||||
If you press a Mod Tap key, tap another key (press and release) and then release the Mod Tap key, all within the tapping term, it will output the "tapping" function for both keys.
|
||||
|
||||
@@ -35,7 +35,7 @@ To enable this setting, add this to your `config.h`:
|
||||
#define IGNORE_MOD_TAP_INTERRUPT
|
||||
```
|
||||
|
||||
Similar to Permissive Hold, this alters how the firmware processes input for fast typist. If you press a Mod Tap key, press another key, release the Mod Tap key, and then release the normal key, it would normally output the "tapping" function for both keys. This may not be desirable for rolling combo keys.
|
||||
Similar to Permissive Hold, this alters how the firmware processes inputs for fast typists. If you press a Mod Tap key, press another key, release the Mod Tap key, and then release the normal key, it would normally output the "tapping" function for both keys. This may not be desirable for rolling combo keys.
|
||||
|
||||
Setting `Ignore Mod Tap Interrupt` requires holding both keys for the `TAPPING_TERM` to trigger the hold function (the mod).
|
||||
|
||||
|
@@ -50,7 +50,7 @@ In that model you would emulate the input, and expect a certain output from the
|
||||
|
||||
# Tracing Variables :id=tracing-variables
|
||||
|
||||
Sometimes you might wonder why a variable gets changed and where, and this can be quite tricky to track down without having a debugger. It's of course possible to manually add print statements to track it, but you can also enable the variable trace feature. This works for both for variables that are changed by the code, and when the variable is changed by some memory corruption.
|
||||
Sometimes you might wonder why a variable gets changed and where, and this can be quite tricky to track down without having a debugger. It's of course possible to manually add print statements to track it, but you can also enable the variable trace feature. This works for both variables that are changed by the code, and when the variable is changed by some memory corruption.
|
||||
|
||||
To take the feature into use add `VARIABLE_TRACE=x` to the end of you make command. `x` represents the number of variables you want to trace, which is usually 1.
|
||||
|
||||
|
@@ -13,7 +13,7 @@ QMK (*Quantum Mechanical Keyboard*) 是一个社区维护的开源软件,包
|
||||
|
||||
## 如何得到它
|
||||
|
||||
如果你打算贡献布局, 键盘, 或者其他QMK特性, 一下是最简单的方法:[从Github获得repo分支](https://github.com/qmk/qmk_firmware#fork-destination-box), 并克隆你的repo到本地进行编辑,推送,然后从你的分支打开 [Pull Request](https://github.com/qmk/qmk_firmware/pulls).
|
||||
如果你打算贡献布局, 键盘, 或者其他QMK特性, 一下是最简单的方法:[从GitHub获得repo分支](https://github.com/qmk/qmk_firmware#fork-destination-box), 并克隆你的repo到本地进行编辑,推送,然后从你的分支打开 [Pull Request](https://github.com/qmk/qmk_firmware/pulls).
|
||||
|
||||
此外, 你也可以直接下载 ([zip](https://github.com/qmk/qmk_firmware/zipball/master), [tar](https://github.com/qmk/qmk_firmware/tarball/master)), 或者从git克隆 (`git@github.com:qmk/qmk_firmware.git`), 或 https (`https://github.com/qmk/qmk_firmware.git`).
|
||||
|
||||
|
@@ -14,7 +14,7 @@
|
||||
* [QMK命令行工具](zh-cn/cli.md)
|
||||
* [QMK命令行工具配置](zh-cn/cli_configuration.md)
|
||||
* [向QMK贡献代码](zh-cn/contributing.md)
|
||||
* [如何使用Github](zh-cn/getting_started_github.md)
|
||||
* [如何使用GitHub](zh-cn/getting_started_github.md)
|
||||
* [获得帮助](zh-cn/getting_started_getting_help.md)
|
||||
|
||||
* [非兼容性修改](zh-cn/breaking_changes.md)
|
||||
|
@@ -10,6 +10,6 @@
|
||||
|
||||
QMK的官方论坛是[/r/olkb](https://reddit.com/r/olkb) 在[reddit.com](https://reddit.com)上.
|
||||
|
||||
## Github的Issue
|
||||
## GitHub的Issue
|
||||
|
||||
你可以在GitHub上 [提出issue](https://github.com/qmk/qmk_firmware/issues).当您的问题需要长期讨论或调试时,这尤其方便。
|
||||
|
@@ -1,16 +1,16 @@
|
||||
# 如何在QMK中使用Github
|
||||
# 如何在QMK中使用GitHub
|
||||
|
||||
Github can be a little tricky to those that aren't familiar with it - this guide will walk through each step of forking, cloning, and submitting a pull request with QMK.
|
||||
GitHub can be a little tricky to those that aren't familiar with it - this guide will walk through each step of forking, cloning, and submitting a pull request with QMK.
|
||||
|
||||
?> 本教程假设您已安装GitHub,并且您喜欢使用命令行工作。
|
||||
|
||||
首先 [Github上的QMK页面](https://github.com/qmk/qmk_firmware), 您能看到右上方有个按钮写着"Fork":
|
||||
首先 [GitHub上的QMK页面](https://github.com/qmk/qmk_firmware), 您能看到右上方有个按钮写着"Fork":
|
||||
|
||||

|
||||

|
||||
|
||||
如果你是某组织成员,你将需要选择分叉到哪个账户。一般情况下, 你是想要分叉到你的私人账户下。当你完成分叉 (有时需要等一会), 点击"Clone or Download" 按钮:
|
||||
|
||||
!从Github下载](http://i.imgur.com/N1NYcSz.jpg)
|
||||
!从GitHub下载](http://i.imgur.com/N1NYcSz.jpg)
|
||||
|
||||
你要选择 "HTTPS", 然后选择链接复制:
|
||||
|
||||
@@ -54,7 +54,7 @@ To https://github.com/whoeveryouare/qmk_firmware.git
|
||||
+ 20043e64...7da94ac5 master -> master
|
||||
```
|
||||
|
||||
现在你的改动已经在你Github上的分支中了 - 如果你回到这 (`https://github.com/你的GitHub账户名/qmk_firmware`) ,你可以点击下方所示按钮创建 "New Pull Request":
|
||||
现在你的改动已经在你GitHub上的分支中了 - 如果你回到这 (`https://github.com/你的GitHub账户名/qmk_firmware`) ,你可以点击下方所示按钮创建 "New Pull Request":
|
||||
|
||||

|
||||
|
||||
|
@@ -20,7 +20,7 @@
|
||||
|
||||
## 创建`default` 布局副本
|
||||
|
||||
打开`keymaps`文件夹后,您将需要创建`default`文件夹的副本。我们强烈建议您将文件夹命名为与Github用户名相同的名称,但您也可以使用任何您想使用的名称,只要它只包含小写字母、数字和下划线字符。
|
||||
打开`keymaps`文件夹后,您将需要创建`default`文件夹的副本。我们强烈建议您将文件夹命名为与GitHub用户名相同的名称,但您也可以使用任何您想使用的名称,只要它只包含小写字母、数字和下划线字符。
|
||||
|
||||
要自动执行此过程,您还可以选择运行`new_keymap.sh`脚本。
|
||||
|
||||
|
@@ -1,5 +1,4 @@
|
||||
tmk_core/protocol
|
||||
tmk_core/protocol/bluefruit
|
||||
tmk_core/protocol/chibios
|
||||
tmk_core/protocol/iwrap
|
||||
tmk_core/protocol/lufa
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* APA102 lib V1.0a
|
||||
*
|
||||
* Controls APA102 RGB-LEDs
|
||||
* Author: Mikkel (Duckle29 on github)
|
||||
* Author: Mikkel (Duckle29 on GitHub)
|
||||
*
|
||||
* Dec 22th, 2017 v1.0a Initial Version
|
||||
*
|
||||
@@ -30,8 +30,8 @@
|
||||
void inline apa102_setleds(LED_TYPE *ledarray, uint16_t leds) { apa102_setleds_pin(ledarray, leds, _BV(RGB_DI_PIN & 0xF), _BV(RGB_CLK_PIN & 0xF)); }
|
||||
|
||||
void static inline apa102_setleds_pin(LED_TYPE *ledarray, uint16_t leds, uint8_t pinmask_DI, uint8_t pinmask_CLK) {
|
||||
pinMode(RGB_DI_PIN, PinDirectionOutput);
|
||||
pinMode(RGB_CLK_PIN, PinDirectionOutput);
|
||||
setPinOutput(RGB_DI_PIN);
|
||||
setPinOutput(RGB_CLK_PIN);
|
||||
|
||||
apa102_send_array((uint8_t *)ledarray, leds)
|
||||
}
|
||||
@@ -90,7 +90,7 @@ void apa102_end_frame(uint16_t leds) {
|
||||
void apa102_send_byte(uint8_t byte) {
|
||||
uint8_t i;
|
||||
for (i = 0; i < 8; i++) {
|
||||
digitalWrite(RGB_DI_PIN, !!(byte & (1 << (7-i)));
|
||||
digitalWrite(RGB_CLK_PIN, PinLevelHigh);
|
||||
writePin(RGB_DI_PIN, !!(byte & (1 << (7 - i))));
|
||||
writePinHigh(RGB_CLK_PIN);
|
||||
}
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/* Library made by: g4lvanix
|
||||
* Github repository: https://github.com/g4lvanix/I2C-master-lib
|
||||
* GitHub repository: https://github.com/g4lvanix/I2C-master-lib
|
||||
*/
|
||||
|
||||
#include <avr/io.h>
|
||||
|
@@ -14,7 +14,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/* Library made by: g4lvanix
|
||||
* Github repository: https://github.com/g4lvanix/I2C-master-lib
|
||||
* GitHub repository: https://github.com/g4lvanix/I2C-master-lib
|
||||
*/
|
||||
|
||||
#ifndef I2C_MASTER_H
|
||||
|
@@ -14,7 +14,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/* Library made by: g4lvanix
|
||||
* Github repository: https://github.com/g4lvanix/I2C-slave-lib
|
||||
* GitHub repository: https://github.com/g4lvanix/I2C-slave-lib
|
||||
*/
|
||||
|
||||
#include <avr/io.h>
|
||||
|
@@ -14,7 +14,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/* Library made by: g4lvanix
|
||||
* Github repository: https://github.com/g4lvanix/I2C-slave-lib
|
||||
* GitHub repository: https://github.com/g4lvanix/I2C-slave-lib
|
||||
|
||||
Info: Inititate the library by giving the required address.
|
||||
Read or write to the necessary buffer according to the opperation.
|
||||
|
@@ -3,7 +3,6 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include "pincontrol.h"
|
||||
#include "config.h"
|
||||
|
||||
enum ssd1306_cmds {
|
||||
|
290
drivers/chibios/serial.c
Normal file
290
drivers/chibios/serial.c
Normal file
@@ -0,0 +1,290 @@
|
||||
/*
|
||||
* WARNING: be careful changing this code, it is very timing dependent
|
||||
*/
|
||||
|
||||
#include "quantum.h"
|
||||
#include "serial.h"
|
||||
#include "wait.h"
|
||||
|
||||
#include "hal.h"
|
||||
|
||||
// TODO: resolve/remove build warnings
|
||||
#if defined(RGBLIGHT_ENABLE) && defined(RGBLED_SPLIT) && defined(PROTOCOL_CHIBIOS) && defined(WS2812_DRIVER_BITBANG)
|
||||
# warning "RGBLED_SPLIT not supported with bitbang WS2812 driver"
|
||||
#endif
|
||||
|
||||
// default wait implementation cannot be called within interrupt
|
||||
// this method seems to be more accurate than GPT timers
|
||||
#if PORT_SUPPORTS_RT == FALSE
|
||||
# error "chSysPolledDelayX method not supported on this platform"
|
||||
#else
|
||||
# undef wait_us
|
||||
# define wait_us(x) chSysPolledDelayX(US2RTC(STM32_SYSCLK, x))
|
||||
#endif
|
||||
|
||||
#ifndef SELECT_SOFT_SERIAL_SPEED
|
||||
# define SELECT_SOFT_SERIAL_SPEED 1
|
||||
// TODO: correct speeds...
|
||||
// 0: about 189kbps (Experimental only)
|
||||
// 1: about 137kbps (default)
|
||||
// 2: about 75kbps
|
||||
// 3: about 39kbps
|
||||
// 4: about 26kbps
|
||||
// 5: about 20kbps
|
||||
#endif
|
||||
|
||||
// Serial pulse period in microseconds. At the moment, going lower than 12 causes communication failure
|
||||
#if SELECT_SOFT_SERIAL_SPEED == 0
|
||||
# define SERIAL_DELAY 12
|
||||
#elif SELECT_SOFT_SERIAL_SPEED == 1
|
||||
# define SERIAL_DELAY 16
|
||||
#elif SELECT_SOFT_SERIAL_SPEED == 2
|
||||
# define SERIAL_DELAY 24
|
||||
#elif SELECT_SOFT_SERIAL_SPEED == 3
|
||||
# define SERIAL_DELAY 32
|
||||
#elif SELECT_SOFT_SERIAL_SPEED == 4
|
||||
# define SERIAL_DELAY 48
|
||||
#elif SELECT_SOFT_SERIAL_SPEED == 5
|
||||
# define SERIAL_DELAY 64
|
||||
#else
|
||||
# error invalid SELECT_SOFT_SERIAL_SPEED value
|
||||
#endif
|
||||
|
||||
inline static void serial_delay(void) { wait_us(SERIAL_DELAY); }
|
||||
inline static void serial_delay_half(void) { wait_us(SERIAL_DELAY / 2); }
|
||||
inline static void serial_delay_blip(void) { wait_us(1); }
|
||||
inline static void serial_output(void) { setPinOutput(SOFT_SERIAL_PIN); }
|
||||
inline static void serial_input(void) { setPinInputHigh(SOFT_SERIAL_PIN); }
|
||||
inline static bool serial_read_pin(void) { return !!readPin(SOFT_SERIAL_PIN); }
|
||||
inline static void serial_low(void) { writePinLow(SOFT_SERIAL_PIN); }
|
||||
inline static void serial_high(void) { writePinHigh(SOFT_SERIAL_PIN); }
|
||||
|
||||
void interrupt_handler(void *arg);
|
||||
|
||||
// Use thread + palWaitLineTimeout instead of palSetLineCallback
|
||||
// - Methods like setPinOutput and palEnableLineEvent/palDisableLineEvent
|
||||
// cause the interrupt to lock up, which would limit to only receiving data...
|
||||
static THD_WORKING_AREA(waThread1, 128);
|
||||
static THD_FUNCTION(Thread1, arg) {
|
||||
(void)arg;
|
||||
chRegSetThreadName("blinker");
|
||||
while (true) {
|
||||
palWaitLineTimeout(SOFT_SERIAL_PIN, TIME_INFINITE);
|
||||
interrupt_handler(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
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(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);
|
||||
chThdCreateStatic(waThread1, sizeof(waThread1), HIGHPRIO, Thread1, NULL);
|
||||
}
|
||||
|
||||
// Used by the master to synchronize timing with the slave.
|
||||
static void __attribute__((noinline)) sync_recv(void) {
|
||||
serial_input();
|
||||
// This shouldn't hang if the slave disconnects because the
|
||||
// serial line will float to high if the slave does disconnect.
|
||||
while (!serial_read_pin()) {
|
||||
}
|
||||
|
||||
serial_delay();
|
||||
}
|
||||
|
||||
// Used by the slave to send a synchronization signal to the master.
|
||||
static void __attribute__((noinline)) sync_send(void) {
|
||||
serial_output();
|
||||
|
||||
serial_low();
|
||||
serial_delay();
|
||||
|
||||
serial_high();
|
||||
}
|
||||
|
||||
// Reads a byte from the serial line
|
||||
static uint8_t __attribute__((noinline)) serial_read_byte(void) {
|
||||
uint8_t byte = 0;
|
||||
serial_input();
|
||||
for (uint8_t i = 0; i < 8; ++i) {
|
||||
byte = (byte << 1) | serial_read_pin();
|
||||
serial_delay();
|
||||
}
|
||||
|
||||
return byte;
|
||||
}
|
||||
|
||||
// Sends a byte with MSB ordering
|
||||
static void __attribute__((noinline)) serial_write_byte(uint8_t data) {
|
||||
uint8_t b = 8;
|
||||
serial_output();
|
||||
while (b--) {
|
||||
if (data & (1 << b)) {
|
||||
serial_high();
|
||||
} else {
|
||||
serial_low();
|
||||
}
|
||||
serial_delay();
|
||||
}
|
||||
}
|
||||
|
||||
// interrupt handle to be used by the slave device
|
||||
void interrupt_handler(void *arg) {
|
||||
chSysLockFromISR();
|
||||
|
||||
sync_send();
|
||||
|
||||
// read mid pulses
|
||||
serial_delay_blip();
|
||||
|
||||
uint8_t checksum_computed = 0;
|
||||
int sstd_index = 0;
|
||||
|
||||
#ifdef SERIAL_USE_MULTI_TRANSACTION
|
||||
sstd_index = serial_read_byte();
|
||||
sync_send();
|
||||
#endif
|
||||
|
||||
SSTD_t *trans = &Transaction_table[sstd_index];
|
||||
for (int i = 0; i < trans->initiator2target_buffer_size; ++i) {
|
||||
trans->initiator2target_buffer[i] = serial_read_byte();
|
||||
sync_send();
|
||||
checksum_computed += trans->initiator2target_buffer[i];
|
||||
}
|
||||
checksum_computed ^= 7;
|
||||
uint8_t checksum_received = serial_read_byte();
|
||||
sync_send();
|
||||
|
||||
// wait for the sync to finish sending
|
||||
serial_delay();
|
||||
|
||||
uint8_t checksum = 0;
|
||||
for (int i = 0; i < trans->target2initiator_buffer_size; ++i) {
|
||||
serial_write_byte(trans->target2initiator_buffer[i]);
|
||||
sync_send();
|
||||
serial_delay_half();
|
||||
checksum += trans->target2initiator_buffer[i];
|
||||
}
|
||||
serial_write_byte(checksum ^ 7);
|
||||
sync_send();
|
||||
|
||||
// wait for the sync to finish sending
|
||||
serial_delay();
|
||||
|
||||
*trans->status = (checksum_computed == checksum_received) ? TRANSACTION_ACCEPTED : TRANSACTION_DATA_ERROR;
|
||||
|
||||
// end transaction
|
||||
serial_input();
|
||||
|
||||
// TODO: remove extra delay between transactions
|
||||
serial_delay();
|
||||
|
||||
chSysUnlockFromISR();
|
||||
}
|
||||
|
||||
/////////
|
||||
// start transaction by initiator
|
||||
//
|
||||
// int soft_serial_transaction(int sstd_index)
|
||||
//
|
||||
// Returns:
|
||||
// TRANSACTION_END
|
||||
// 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) {
|
||||
#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();
|
||||
|
||||
// this code is very time dependent, so we need to disable interrupts
|
||||
chSysLock();
|
||||
|
||||
// signal to the slave that we want to start a transaction
|
||||
serial_output();
|
||||
serial_low();
|
||||
serial_delay_blip();
|
||||
|
||||
// wait for the slaves response
|
||||
serial_input();
|
||||
serial_high();
|
||||
serial_delay();
|
||||
|
||||
// check if the slave is present
|
||||
if (serial_read_pin()) {
|
||||
// slave failed to pull the line low, assume not present
|
||||
dprintf("serial::NO_RESPONSE\n");
|
||||
chSysUnlock();
|
||||
return TRANSACTION_NO_RESPONSE;
|
||||
}
|
||||
|
||||
// if the slave is present syncronize with it
|
||||
|
||||
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(trans->initiator2target_buffer[i]);
|
||||
sync_recv();
|
||||
checksum += trans->initiator2target_buffer[i];
|
||||
}
|
||||
serial_write_byte(checksum ^ 7);
|
||||
sync_recv();
|
||||
|
||||
serial_delay();
|
||||
serial_delay(); // read mid pulses
|
||||
|
||||
// receive data from the slave
|
||||
uint8_t checksum_computed = 0;
|
||||
for (int i = 0; i < trans->target2initiator_buffer_size; ++i) {
|
||||
trans->target2initiator_buffer[i] = serial_read_byte();
|
||||
sync_recv();
|
||||
checksum_computed += trans->target2initiator_buffer[i];
|
||||
}
|
||||
checksum_computed ^= 7;
|
||||
uint8_t checksum_received = serial_read_byte();
|
||||
|
||||
sync_recv();
|
||||
serial_delay();
|
||||
|
||||
if ((checksum_computed) != (checksum_received)) {
|
||||
dprintf("serial::FAIL[%u,%u,%u]\n", checksum_computed, checksum_received, sstd_index);
|
||||
serial_output();
|
||||
serial_high();
|
||||
|
||||
chSysUnlock();
|
||||
return TRANSACTION_DATA_ERROR;
|
||||
}
|
||||
|
||||
// always, release the line when not in use
|
||||
serial_high();
|
||||
serial_output();
|
||||
|
||||
chSysUnlock();
|
||||
return TRANSACTION_END;
|
||||
}
|
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
|
234
drivers/chibios/serial_usart.c
Normal file
234
drivers/chibios/serial_usart.c
Normal file
@@ -0,0 +1,234 @@
|
||||
#include "quantum.h"
|
||||
#include "serial.h"
|
||||
#include "printf.h"
|
||||
|
||||
#include "ch.h"
|
||||
#include "hal.h"
|
||||
|
||||
#ifndef USART_CR1_M0
|
||||
# define USART_CR1_M0 USART_CR1_M // some platforms (f1xx) dont have this so
|
||||
#endif
|
||||
|
||||
#ifndef USE_GPIOV1
|
||||
// The default PAL alternate modes are used to signal that the pins are used for USART
|
||||
# ifndef SERIAL_USART_TX_PAL_MODE
|
||||
# define SERIAL_USART_TX_PAL_MODE 7
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef SERIAL_USART_DRIVER
|
||||
# define SERIAL_USART_DRIVER SD1
|
||||
#endif
|
||||
|
||||
#ifndef SERIAL_USART_CR1
|
||||
# define SERIAL_USART_CR1 (USART_CR1_PCE | USART_CR1_PS | USART_CR1_M0) // parity enable, odd parity, 9 bit length
|
||||
#endif
|
||||
|
||||
#ifndef SERIAL_USART_CR2
|
||||
# define SERIAL_USART_CR2 (USART_CR2_STOP_1) // 2 stop bits
|
||||
#endif
|
||||
|
||||
#ifndef SERIAL_USART_CR3
|
||||
# define SERIAL_USART_CR3 0
|
||||
#endif
|
||||
|
||||
#ifdef SOFT_SERIAL_PIN
|
||||
# define SERIAL_USART_TX_PIN SOFT_SERIAL_PIN
|
||||
#endif
|
||||
|
||||
#ifndef SELECT_SOFT_SERIAL_SPEED
|
||||
# define SELECT_SOFT_SERIAL_SPEED 1
|
||||
#endif
|
||||
|
||||
#ifdef SERIAL_USART_SPEED
|
||||
// Allow advanced users to directly set SERIAL_USART_SPEED
|
||||
#elif SELECT_SOFT_SERIAL_SPEED == 0
|
||||
# define SERIAL_USART_SPEED 460800
|
||||
#elif SELECT_SOFT_SERIAL_SPEED == 1
|
||||
# define SERIAL_USART_SPEED 230400
|
||||
#elif SELECT_SOFT_SERIAL_SPEED == 2
|
||||
# define SERIAL_USART_SPEED 115200
|
||||
#elif SELECT_SOFT_SERIAL_SPEED == 3
|
||||
# define SERIAL_USART_SPEED 57600
|
||||
#elif SELECT_SOFT_SERIAL_SPEED == 4
|
||||
# define SERIAL_USART_SPEED 38400
|
||||
#elif SELECT_SOFT_SERIAL_SPEED == 5
|
||||
# define SERIAL_USART_SPEED 19200
|
||||
#else
|
||||
# error invalid SELECT_SOFT_SERIAL_SPEED value
|
||||
#endif
|
||||
|
||||
#define TIMEOUT 100
|
||||
#define HANDSHAKE_MAGIC 7
|
||||
|
||||
static inline msg_t sdWriteHalfDuplex(SerialDriver* driver, uint8_t* data, uint8_t size) {
|
||||
msg_t ret = sdWrite(driver, data, size);
|
||||
|
||||
// Half duplex requires us to read back the data we just wrote - just throw it away
|
||||
uint8_t dump[size];
|
||||
sdRead(driver, dump, size);
|
||||
|
||||
return ret;
|
||||
}
|
||||
#undef sdWrite
|
||||
#define sdWrite sdWriteHalfDuplex
|
||||
|
||||
static inline msg_t sdWriteTimeoutHalfDuplex(SerialDriver* driver, uint8_t* data, uint8_t size, uint32_t timeout) {
|
||||
msg_t ret = sdWriteTimeout(driver, data, size, timeout);
|
||||
|
||||
// Half duplex requires us to read back the data we just wrote - just throw it away
|
||||
uint8_t dump[size];
|
||||
sdReadTimeout(driver, dump, size, timeout);
|
||||
|
||||
return ret;
|
||||
}
|
||||
#undef sdWriteTimeout
|
||||
#define sdWriteTimeout sdWriteTimeoutHalfDuplex
|
||||
|
||||
static inline void sdClear(SerialDriver* driver) {
|
||||
while (sdGetTimeout(driver, TIME_IMMEDIATE) != MSG_TIMEOUT) {
|
||||
// Do nothing with the data
|
||||
}
|
||||
}
|
||||
|
||||
static SerialConfig sdcfg = {
|
||||
(SERIAL_USART_SPEED), // speed - mandatory
|
||||
(SERIAL_USART_CR1), // CR1
|
||||
(SERIAL_USART_CR2), // CR2
|
||||
(SERIAL_USART_CR3) // CR3
|
||||
};
|
||||
|
||||
void handle_soft_serial_slave(void);
|
||||
|
||||
/*
|
||||
* This thread runs on the slave and responds to transactions initiated
|
||||
* by the master
|
||||
*/
|
||||
static THD_WORKING_AREA(waSlaveThread, 2048);
|
||||
static THD_FUNCTION(SlaveThread, arg) {
|
||||
(void)arg;
|
||||
chRegSetThreadName("slave_transport");
|
||||
|
||||
while (true) {
|
||||
handle_soft_serial_slave();
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((weak)) void usart_init(void) {
|
||||
#if defined(USE_GPIOV1)
|
||||
palSetLineMode(SERIAL_USART_TX_PIN, PAL_MODE_STM32_ALTERNATE_OPENDRAIN);
|
||||
#else
|
||||
palSetLineMode(SERIAL_USART_TX_PIN, PAL_MODE_ALTERNATE(SERIAL_USART_TX_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN);
|
||||
#endif
|
||||
}
|
||||
|
||||
void usart_master_init(void) {
|
||||
usart_init();
|
||||
|
||||
sdcfg.cr3 |= USART_CR3_HDSEL;
|
||||
sdStart(&SERIAL_USART_DRIVER, &sdcfg);
|
||||
}
|
||||
|
||||
void usart_slave_init(void) {
|
||||
usart_init();
|
||||
|
||||
sdcfg.cr3 |= USART_CR3_HDSEL;
|
||||
sdStart(&SERIAL_USART_DRIVER, &sdcfg);
|
||||
|
||||
// Start transport thread
|
||||
chThdCreateStatic(waSlaveThread, sizeof(waSlaveThread), HIGHPRIO, SlaveThread, NULL);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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
|
||||
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, trans->initiator2target_buffer, trans->initiator2target_buffer_size);
|
||||
}
|
||||
|
||||
if (trans->target2initiator_buffer_size) {
|
||||
sdWrite(&SERIAL_USART_DRIVER, trans->target2initiator_buffer, trans->target2initiator_buffer_size);
|
||||
}
|
||||
|
||||
if (trans->status) {
|
||||
*trans->status = TRANSACTION_ACCEPTED;
|
||||
}
|
||||
}
|
||||
|
||||
/////////
|
||||
// start transaction by initiator
|
||||
//
|
||||
// int soft_serial_transaction(int sstd_index)
|
||||
//
|
||||
// Returns:
|
||||
// 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 > Transaction_table_size) return TRANSACTION_TYPE_ERROR;
|
||||
SSTD_t* trans = &Transaction_table[sstd_index];
|
||||
msg_t res = 0;
|
||||
|
||||
sdClear(&SERIAL_USART_DRIVER);
|
||||
|
||||
// First chunk is always transaction id
|
||||
sdWriteTimeout(&SERIAL_USART_DRIVER, &sstd_index, sizeof(sstd_index), TIME_MS2I(TIMEOUT));
|
||||
|
||||
uint8_t sstd_index_shake = 0xFF;
|
||||
|
||||
// Which we always read back first so that we can error out correctly
|
||||
// - due to the half duplex limitations on return codes, we always have to read *something*
|
||||
// - without the read, write only transactions *always* succeed, even during the boot process where the slave is not ready
|
||||
res = sdReadTimeout(&SERIAL_USART_DRIVER, &sstd_index_shake, sizeof(sstd_index_shake), TIME_MS2I(TIMEOUT));
|
||||
if (res < 0 || (sstd_index_shake != (sstd_index ^ HANDSHAKE_MAGIC))) {
|
||||
dprintf("serial::usart_shake NO_RESPONSE\n");
|
||||
return TRANSACTION_NO_RESPONSE;
|
||||
}
|
||||
|
||||
if (trans->initiator2target_buffer_size) {
|
||||
res = sdWriteTimeout(&SERIAL_USART_DRIVER, trans->initiator2target_buffer, trans->initiator2target_buffer_size, TIME_MS2I(TIMEOUT));
|
||||
if (res < 0) {
|
||||
dprintf("serial::usart_transmit NO_RESPONSE\n");
|
||||
return TRANSACTION_NO_RESPONSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (trans->target2initiator_buffer_size) {
|
||||
res = sdReadTimeout(&SERIAL_USART_DRIVER, trans->target2initiator_buffer, trans->target2initiator_buffer_size, TIME_MS2I(TIMEOUT));
|
||||
if (res < 0) {
|
||||
dprintf("serial::usart_receive NO_RESPONSE\n");
|
||||
return TRANSACTION_NO_RESPONSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRANSACTION_END;
|
||||
}
|
137
drivers/chibios/spi_master.c
Normal file
137
drivers/chibios/spi_master.c
Normal file
@@ -0,0 +1,137 @@
|
||||
/* Copyright 2020 Nick Brassel (tzarc)
|
||||
*
|
||||
* 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 3 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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "spi_master.h"
|
||||
#include "quantum.h"
|
||||
#include "timer.h"
|
||||
|
||||
static pin_t currentSlavePin = NO_PIN;
|
||||
static SPIConfig spiConfig = {false, NULL, 0, 0, 0, 0};
|
||||
|
||||
__attribute__((weak)) void spi_init(void) {
|
||||
// Try releasing special pins for a short time
|
||||
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), 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);
|
||||
palSetPadMode(PAL_PORT(SPI_MISO_PIN), PAL_PAD(SPI_MISO_PIN), PAL_MODE_ALTERNATE(SPI_MISO_PAL_MODE) | PAL_STM32_OTYPE_PUSHPULL | PAL_STM32_OSPEED_HIGHEST);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool spi_start(pin_t slavePin, bool lsbFirst, uint8_t mode, uint16_t divisor) {
|
||||
if (currentSlavePin != NO_PIN || slavePin == NO_PIN) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint16_t roundedDivisor = 2;
|
||||
while (roundedDivisor < divisor) {
|
||||
roundedDivisor <<= 1;
|
||||
}
|
||||
|
||||
if (roundedDivisor < 2 || roundedDivisor > 256) {
|
||||
return false;
|
||||
}
|
||||
|
||||
spiConfig.cr1 = 0;
|
||||
|
||||
if (lsbFirst) {
|
||||
spiConfig.cr1 |= SPI_CR1_LSBFIRST;
|
||||
}
|
||||
|
||||
switch (mode) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
spiConfig.cr1 |= SPI_CR1_CPHA;
|
||||
break;
|
||||
case 2:
|
||||
spiConfig.cr1 |= SPI_CR1_CPOL;
|
||||
break;
|
||||
case 3:
|
||||
spiConfig.cr1 |= SPI_CR1_CPHA | SPI_CR1_CPOL;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (roundedDivisor) {
|
||||
case 2:
|
||||
break;
|
||||
case 4:
|
||||
spiConfig.cr1 |= SPI_CR1_BR_0;
|
||||
break;
|
||||
case 8:
|
||||
spiConfig.cr1 |= SPI_CR1_BR_1;
|
||||
break;
|
||||
case 16:
|
||||
spiConfig.cr1 |= SPI_CR1_BR_1 | SPI_CR1_BR_0;
|
||||
break;
|
||||
case 32:
|
||||
spiConfig.cr1 |= SPI_CR1_BR_2;
|
||||
break;
|
||||
case 64:
|
||||
spiConfig.cr1 |= SPI_CR1_BR_2 | SPI_CR1_BR_0;
|
||||
break;
|
||||
case 128:
|
||||
spiConfig.cr1 |= SPI_CR1_BR_2 | SPI_CR1_BR_1;
|
||||
break;
|
||||
case 256:
|
||||
spiConfig.cr1 |= SPI_CR1_BR_2 | SPI_CR1_BR_1 | SPI_CR1_BR_0;
|
||||
break;
|
||||
}
|
||||
|
||||
currentSlavePin = slavePin;
|
||||
spiConfig.ssport = PAL_PORT(slavePin);
|
||||
spiConfig.sspad = PAL_PAD(slavePin);
|
||||
|
||||
setPinOutput(slavePin);
|
||||
spiStart(&SPI_DRIVER, &spiConfig);
|
||||
spiSelect(&SPI_DRIVER);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
spi_status_t spi_write(uint8_t data) { return spi_transmit(&data, 1); }
|
||||
|
||||
spi_status_t spi_read(void) {
|
||||
uint8_t data = 0;
|
||||
spi_receive(&data, 1);
|
||||
return data;
|
||||
}
|
||||
|
||||
spi_status_t spi_transmit(const uint8_t *data, uint16_t length) {
|
||||
spiSend(&SPI_DRIVER, length, data);
|
||||
return SPI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
spi_status_t spi_receive(uint8_t *data, uint16_t length) {
|
||||
spiReceive(&SPI_DRIVER, length, data);
|
||||
return SPI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
void spi_stop(void) {
|
||||
if (currentSlavePin != NO_PIN) {
|
||||
spiUnselect(&SPI_DRIVER);
|
||||
spiStop(&SPI_DRIVER);
|
||||
currentSlavePin = NO_PIN;
|
||||
}
|
||||
}
|
78
drivers/chibios/spi_master.h
Normal file
78
drivers/chibios/spi_master.h
Normal file
@@ -0,0 +1,78 @@
|
||||
/* Copyright 2020 Nick Brassel (tzarc)
|
||||
*
|
||||
* 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 3 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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ch.h>
|
||||
#include <hal.h>
|
||||
#include <quantum.h>
|
||||
|
||||
#ifndef SPI_DRIVER
|
||||
# define SPI_DRIVER SPID2
|
||||
#endif
|
||||
|
||||
#ifndef SPI_SCK_PIN
|
||||
# define SPI_SCK_PIN B13
|
||||
#endif
|
||||
|
||||
#ifndef SPI_SCK_PAL_MODE
|
||||
# define SPI_SCK_PAL_MODE 5
|
||||
#endif
|
||||
|
||||
#ifndef SPI_MOSI_PIN
|
||||
# define SPI_MOSI_PIN B15
|
||||
#endif
|
||||
|
||||
#ifndef SPI_MOSI_PAL_MODE
|
||||
# define SPI_MOSI_PAL_MODE 5
|
||||
#endif
|
||||
|
||||
#ifndef SPI_MISO_PIN
|
||||
# define SPI_MISO_PIN B14
|
||||
#endif
|
||||
|
||||
#ifndef SPI_MISO_PAL_MODE
|
||||
# define SPI_MISO_PAL_MODE 5
|
||||
#endif
|
||||
|
||||
typedef int16_t spi_status_t;
|
||||
|
||||
#define SPI_STATUS_SUCCESS (0)
|
||||
#define SPI_STATUS_ERROR (-1)
|
||||
#define SPI_STATUS_TIMEOUT (-2)
|
||||
|
||||
#define SPI_TIMEOUT_IMMEDIATE (0)
|
||||
#define SPI_TIMEOUT_INFINITE (0xFFFF)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void spi_init(void);
|
||||
|
||||
bool spi_start(pin_t slavePin, bool lsbFirst, uint8_t mode, uint16_t divisor);
|
||||
|
||||
spi_status_t spi_write(uint8_t data);
|
||||
|
||||
spi_status_t spi_read(void);
|
||||
|
||||
spi_status_t spi_transmit(const uint8_t *data, uint16_t length);
|
||||
|
||||
spi_status_t spi_receive(uint8_t *data, uint16_t length);
|
||||
|
||||
void spi_stop(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@@ -20,19 +20,19 @@
|
||||
#include "eeprom_driver.h"
|
||||
|
||||
uint8_t eeprom_read_byte(const uint8_t *addr) {
|
||||
uint8_t ret;
|
||||
uint8_t ret = 0;
|
||||
eeprom_read_block(&ret, addr, 1);
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint16_t eeprom_read_word(const uint16_t *addr) {
|
||||
uint16_t ret;
|
||||
uint16_t ret = 0;
|
||||
eeprom_read_block(&ret, addr, 2);
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint32_t eeprom_read_dword(const uint32_t *addr) {
|
||||
uint32_t ret;
|
||||
uint32_t ret = 0;
|
||||
eeprom_read_block(&ret, addr, 4);
|
||||
return ret;
|
||||
}
|
||||
|
@@ -37,8 +37,9 @@
|
||||
|
||||
// #define DEBUG_EEPROM_OUTPUT
|
||||
|
||||
#ifdef DEBUG_EEPROM_OUTPUT
|
||||
# include "print.h"
|
||||
#if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT)
|
||||
# include "timer.h"
|
||||
# include "debug.h"
|
||||
#endif // DEBUG_EEPROM_OUTPUT
|
||||
|
||||
static inline void init_i2c_if_required(void) {
|
||||
@@ -50,7 +51,7 @@ static inline void init_i2c_if_required(void) {
|
||||
}
|
||||
|
||||
static inline void fill_target_address(uint8_t *buffer, const void *addr) {
|
||||
intptr_t p = (intptr_t)addr;
|
||||
uintptr_t p = (uintptr_t)addr;
|
||||
for (int i = 0; i < EXTERNAL_EEPROM_ADDRESS_SIZE; ++i) {
|
||||
buffer[EXTERNAL_EEPROM_ADDRESS_SIZE - 1 - i] = p & 0xFF;
|
||||
p >>= 8;
|
||||
@@ -60,11 +61,19 @@ static inline void fill_target_address(uint8_t *buffer, const void *addr) {
|
||||
void eeprom_driver_init(void) {}
|
||||
|
||||
void eeprom_driver_erase(void) {
|
||||
#if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT)
|
||||
uint32_t start = timer_read32();
|
||||
#endif
|
||||
|
||||
uint8_t buf[EXTERNAL_EEPROM_PAGE_SIZE];
|
||||
memset(buf, 0x00, EXTERNAL_EEPROM_PAGE_SIZE);
|
||||
for (intptr_t addr = 0; addr < EXTERNAL_EEPROM_BYTE_COUNT; addr += EXTERNAL_EEPROM_PAGE_SIZE) {
|
||||
eeprom_write_block(buf, (void *)addr, EXTERNAL_EEPROM_PAGE_SIZE);
|
||||
for (uint32_t addr = 0; addr < EXTERNAL_EEPROM_BYTE_COUNT; addr += EXTERNAL_EEPROM_PAGE_SIZE) {
|
||||
eeprom_write_block(buf, (void *)(uintptr_t)addr, EXTERNAL_EEPROM_PAGE_SIZE);
|
||||
}
|
||||
|
||||
#if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT)
|
||||
dprintf("EEPROM erase took %ldms to complete\n", ((long)(timer_read32() - start)));
|
||||
#endif
|
||||
}
|
||||
|
||||
void eeprom_read_block(void *buf, const void *addr, size_t len) {
|
||||
@@ -72,10 +81,10 @@ void eeprom_read_block(void *buf, const void *addr, size_t len) {
|
||||
fill_target_address(complete_packet, addr);
|
||||
|
||||
init_i2c_if_required();
|
||||
i2c_transmit(EXTERNAL_EEPROM_I2C_ADDRESS((intptr_t)addr), complete_packet, EXTERNAL_EEPROM_ADDRESS_SIZE, 100);
|
||||
i2c_receive(EXTERNAL_EEPROM_I2C_ADDRESS((intptr_t)addr), buf, len, 100);
|
||||
i2c_transmit(EXTERNAL_EEPROM_I2C_ADDRESS((uintptr_t)addr), complete_packet, EXTERNAL_EEPROM_ADDRESS_SIZE, 100);
|
||||
i2c_receive(EXTERNAL_EEPROM_I2C_ADDRESS((uintptr_t)addr), buf, len, 100);
|
||||
|
||||
#ifdef DEBUG_EEPROM_OUTPUT
|
||||
#if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT)
|
||||
dprintf("[EEPROM R] 0x%04X: ", ((int)addr));
|
||||
for (size_t i = 0; i < len; ++i) {
|
||||
dprintf(" %02X", (int)(((uint8_t *)buf)[i]));
|
||||
@@ -85,14 +94,14 @@ void eeprom_read_block(void *buf, const void *addr, size_t len) {
|
||||
}
|
||||
|
||||
void eeprom_write_block(const void *buf, void *addr, size_t len) {
|
||||
uint8_t complete_packet[EXTERNAL_EEPROM_ADDRESS_SIZE + EXTERNAL_EEPROM_PAGE_SIZE];
|
||||
uint8_t *read_buf = (uint8_t *)buf;
|
||||
intptr_t target_addr = (intptr_t)addr;
|
||||
uint8_t complete_packet[EXTERNAL_EEPROM_ADDRESS_SIZE + EXTERNAL_EEPROM_PAGE_SIZE];
|
||||
uint8_t * read_buf = (uint8_t *)buf;
|
||||
uintptr_t target_addr = (uintptr_t)addr;
|
||||
|
||||
init_i2c_if_required();
|
||||
while (len > 0) {
|
||||
intptr_t page_offset = target_addr % EXTERNAL_EEPROM_PAGE_SIZE;
|
||||
int write_length = EXTERNAL_EEPROM_PAGE_SIZE - page_offset;
|
||||
uintptr_t page_offset = target_addr % EXTERNAL_EEPROM_PAGE_SIZE;
|
||||
int write_length = EXTERNAL_EEPROM_PAGE_SIZE - page_offset;
|
||||
if (write_length > len) {
|
||||
write_length = len;
|
||||
}
|
||||
@@ -102,7 +111,7 @@ void eeprom_write_block(const void *buf, void *addr, size_t len) {
|
||||
complete_packet[EXTERNAL_EEPROM_ADDRESS_SIZE + i] = read_buf[i];
|
||||
}
|
||||
|
||||
#ifdef DEBUG_EEPROM_OUTPUT
|
||||
#if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT)
|
||||
dprintf("[EEPROM W] 0x%04X: ", ((int)target_addr));
|
||||
for (uint8_t i = 0; i < write_length; i++) {
|
||||
dprintf(" %02X", (int)(read_buf[i]));
|
||||
@@ -110,7 +119,7 @@ void eeprom_write_block(const void *buf, void *addr, size_t len) {
|
||||
dprintf("\n");
|
||||
#endif // DEBUG_EEPROM_OUTPUT
|
||||
|
||||
i2c_transmit(EXTERNAL_EEPROM_I2C_ADDRESS((intptr_t)addr), complete_packet, EXTERNAL_EEPROM_ADDRESS_SIZE + write_length, 100);
|
||||
i2c_transmit(EXTERNAL_EEPROM_I2C_ADDRESS((uintptr_t)addr), complete_packet, EXTERNAL_EEPROM_ADDRESS_SIZE + write_length, 100);
|
||||
wait_ms(EXTERNAL_EEPROM_WRITE_TIME);
|
||||
|
||||
read_buf += write_length;
|
||||
|
232
drivers/eeprom/eeprom_spi.c
Normal file
232
drivers/eeprom/eeprom_spi.c
Normal file
@@ -0,0 +1,232 @@
|
||||
/* Copyright 2020 Nick Brassel (tzarc)
|
||||
*
|
||||
* 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 <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
Note that the implementations of eeprom_XXXX_YYYY on AVR are normally
|
||||
provided by avr-libc. The same functions are reimplemented below and are
|
||||
rerouted to the external SPI equivalent.
|
||||
|
||||
Seemingly, as this is compiled from within QMK, the object file generated
|
||||
during the build overrides the avr-libc implementation during the linking
|
||||
stage.
|
||||
|
||||
On other platforms such as ARM, there are no provided implementations, so
|
||||
there is nothing to override during linkage.
|
||||
*/
|
||||
|
||||
#include "wait.h"
|
||||
#include "spi_master.h"
|
||||
#include "eeprom.h"
|
||||
#include "eeprom_spi.h"
|
||||
|
||||
#define CMD_WREN 6
|
||||
#define CMD_WRDI 4
|
||||
#define CMD_RDSR 5
|
||||
#define CMD_WRSR 1
|
||||
#define CMD_READ 3
|
||||
#define CMD_WRITE 2
|
||||
|
||||
#define SR_WIP 0x01
|
||||
|
||||
// #define DEBUG_EEPROM_OUTPUT
|
||||
|
||||
#ifndef EXTERNAL_EEPROM_SPI_TIMEOUT
|
||||
# define EXTERNAL_EEPROM_SPI_TIMEOUT 100
|
||||
#endif
|
||||
|
||||
#if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT)
|
||||
# include "timer.h"
|
||||
# include "debug.h"
|
||||
#endif // CONSOLE_ENABLE
|
||||
|
||||
static void init_spi_if_required(void) {
|
||||
static int done = 0;
|
||||
if (!done) {
|
||||
spi_init();
|
||||
done = 1;
|
||||
}
|
||||
}
|
||||
|
||||
static bool spi_eeprom_start(void) { return spi_start(EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN, EXTERNAL_EEPROM_SPI_LSBFIRST, EXTERNAL_EEPROM_SPI_MODE, EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR); }
|
||||
|
||||
static spi_status_t spi_eeprom_wait_while_busy(int timeout) {
|
||||
uint32_t deadline = timer_read32() + timeout;
|
||||
spi_status_t response;
|
||||
do {
|
||||
spi_write(CMD_RDSR);
|
||||
response = spi_read();
|
||||
if (timer_read32() >= deadline) {
|
||||
return SPI_STATUS_TIMEOUT;
|
||||
}
|
||||
} while (response & SR_WIP);
|
||||
return SPI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static void spi_eeprom_transmit_address(uintptr_t addr) {
|
||||
uint8_t buffer[EXTERNAL_EEPROM_ADDRESS_SIZE];
|
||||
|
||||
for (int i = 0; i < EXTERNAL_EEPROM_ADDRESS_SIZE; ++i) {
|
||||
buffer[EXTERNAL_EEPROM_ADDRESS_SIZE - 1 - i] = addr & 0xFF;
|
||||
addr >>= 8;
|
||||
}
|
||||
|
||||
spi_transmit(buffer, EXTERNAL_EEPROM_ADDRESS_SIZE);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void eeprom_driver_init(void) {}
|
||||
|
||||
void eeprom_driver_erase(void) {
|
||||
#if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT)
|
||||
uint32_t start = timer_read32();
|
||||
#endif
|
||||
|
||||
uint8_t buf[EXTERNAL_EEPROM_PAGE_SIZE];
|
||||
memset(buf, 0x00, EXTERNAL_EEPROM_PAGE_SIZE);
|
||||
for (uint32_t addr = 0; addr < EXTERNAL_EEPROM_BYTE_COUNT; addr += EXTERNAL_EEPROM_PAGE_SIZE) {
|
||||
eeprom_write_block(buf, (void *)(uintptr_t)addr, EXTERNAL_EEPROM_PAGE_SIZE);
|
||||
}
|
||||
|
||||
#if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT)
|
||||
dprintf("EEPROM erase took %ldms to complete\n", ((long)(timer_read32() - start)));
|
||||
#endif
|
||||
}
|
||||
|
||||
void eeprom_read_block(void *buf, const void *addr, size_t len) {
|
||||
init_spi_if_required();
|
||||
|
||||
//-------------------------------------------------
|
||||
// Wait for the write-in-progress bit to be cleared
|
||||
bool res = spi_eeprom_start();
|
||||
if (!res) {
|
||||
dprint("failed to start SPI for WIP check\n");
|
||||
memset(buf, 0, len);
|
||||
return;
|
||||
}
|
||||
|
||||
spi_status_t response = spi_eeprom_wait_while_busy(EXTERNAL_EEPROM_SPI_TIMEOUT);
|
||||
spi_stop();
|
||||
if (response == SPI_STATUS_TIMEOUT) {
|
||||
dprint("SPI timeout for WIP check\n");
|
||||
memset(buf, 0, len);
|
||||
return;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// Perform read
|
||||
res = spi_eeprom_start();
|
||||
if (!res) {
|
||||
dprint("failed to start SPI for read\n");
|
||||
memset(buf, 0, len);
|
||||
return;
|
||||
}
|
||||
|
||||
spi_write(CMD_READ);
|
||||
spi_eeprom_transmit_address((uintptr_t)addr);
|
||||
spi_receive(buf, len);
|
||||
|
||||
#if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT)
|
||||
dprintf("[EEPROM R] 0x%08lX: ", ((uint32_t)(uintptr_t)addr));
|
||||
for (size_t i = 0; i < len; ++i) {
|
||||
dprintf(" %02X", (int)(((uint8_t *)buf)[i]));
|
||||
}
|
||||
dprintf("\n");
|
||||
#endif // DEBUG_EEPROM_OUTPUT
|
||||
|
||||
spi_stop();
|
||||
}
|
||||
|
||||
void eeprom_write_block(const void *buf, void *addr, size_t len) {
|
||||
init_spi_if_required();
|
||||
|
||||
bool res;
|
||||
uint8_t * read_buf = (uint8_t *)buf;
|
||||
uintptr_t target_addr = (uintptr_t)addr;
|
||||
|
||||
while (len > 0) {
|
||||
uintptr_t page_offset = target_addr % EXTERNAL_EEPROM_PAGE_SIZE;
|
||||
int write_length = EXTERNAL_EEPROM_PAGE_SIZE - page_offset;
|
||||
if (write_length > len) {
|
||||
write_length = len;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// Wait for the write-in-progress bit to be cleared
|
||||
res = spi_eeprom_start();
|
||||
if (!res) {
|
||||
dprint("failed to start SPI for WIP check\n");
|
||||
return;
|
||||
}
|
||||
|
||||
spi_status_t response = spi_eeprom_wait_while_busy(EXTERNAL_EEPROM_SPI_TIMEOUT);
|
||||
spi_stop();
|
||||
if (response == SPI_STATUS_TIMEOUT) {
|
||||
dprint("SPI timeout for WIP check\n");
|
||||
return;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// Enable writes
|
||||
res = spi_eeprom_start();
|
||||
if (!res) {
|
||||
dprint("failed to start SPI for write-enable\n");
|
||||
return;
|
||||
}
|
||||
|
||||
spi_write(CMD_WREN);
|
||||
spi_stop();
|
||||
|
||||
//-------------------------------------------------
|
||||
// Perform the write
|
||||
res = spi_eeprom_start();
|
||||
if (!res) {
|
||||
dprint("failed to start SPI for write\n");
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT)
|
||||
dprintf("[EEPROM W] 0x%08lX: ", ((uint32_t)(uintptr_t)target_addr));
|
||||
for (size_t i = 0; i < write_length; i++) {
|
||||
dprintf(" %02X", (int)(uint8_t)(read_buf[i]));
|
||||
}
|
||||
dprintf("\n");
|
||||
#endif // DEBUG_EEPROM_OUTPUT
|
||||
|
||||
spi_write(CMD_WRITE);
|
||||
spi_eeprom_transmit_address(target_addr);
|
||||
spi_transmit(read_buf, write_length);
|
||||
spi_stop();
|
||||
|
||||
read_buf += write_length;
|
||||
target_addr += write_length;
|
||||
len -= write_length;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// Disable writes
|
||||
res = spi_eeprom_start();
|
||||
if (!res) {
|
||||
dprint("failed to start SPI for write-disable\n");
|
||||
return;
|
||||
}
|
||||
|
||||
spi_write(CMD_WRDI);
|
||||
spi_stop();
|
||||
}
|
80
drivers/eeprom/eeprom_spi.h
Normal file
80
drivers/eeprom/eeprom_spi.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/* Copyright 2020 Nick Brassel (tzarc)
|
||||
*
|
||||
* 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
|
||||
|
||||
/*
|
||||
The slave select pin of the EEPROM.
|
||||
This needs to be a normal GPIO pin_t value, such as A7.
|
||||
*/
|
||||
#ifndef EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN
|
||||
# error "No chip select pin defined -- missing EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN"
|
||||
#endif
|
||||
|
||||
/*
|
||||
The clock divisor for SPI to ensure that the MCU is within the
|
||||
specifications of the EEPROM chip. Generally this will be PCLK divided by
|
||||
the intended divisor -- check your clock settings and the datasheet of
|
||||
your EEPROM.
|
||||
*/
|
||||
#ifndef EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR
|
||||
# ifdef __AVR__
|
||||
# define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR 8
|
||||
# else
|
||||
# define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR 64
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
The SPI mode to communicate with the EEPROM.
|
||||
*/
|
||||
#ifndef EXTERNAL_EEPROM_SPI_MODE
|
||||
# define EXTERNAL_EEPROM_SPI_MODE 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
Whether or not the SPI communication between the MCU and EEPROM should be
|
||||
LSB-first.
|
||||
*/
|
||||
#ifndef EXTERNAL_EEPROM_SPI_LSBFIRST
|
||||
# define EXTERNAL_EEPROM_SPI_LSBFIRST false
|
||||
#endif
|
||||
|
||||
/*
|
||||
The total size of the EEPROM, in bytes. The EEPROM datasheet will usually
|
||||
specify this value in kbits, and will require conversion to bytes.
|
||||
*/
|
||||
#ifndef EXTERNAL_EEPROM_BYTE_COUNT
|
||||
# define EXTERNAL_EEPROM_BYTE_COUNT 8192
|
||||
#endif
|
||||
|
||||
/*
|
||||
The page size in bytes of the EEPROM, as specified in the datasheet.
|
||||
*/
|
||||
#ifndef EXTERNAL_EEPROM_PAGE_SIZE
|
||||
# define EXTERNAL_EEPROM_PAGE_SIZE 32
|
||||
#endif
|
||||
|
||||
/*
|
||||
The address size in bytes of the EEPROM. For EEPROMs with <=256 bytes, this
|
||||
will likely be 1. For EEPROMs >256 and <=65536, this will be 2. For EEPROMs
|
||||
>65536, this will likely need to be 4.
|
||||
|
||||
As expected, consult the datasheet for specifics of your EEPROM.
|
||||
*/
|
||||
#ifndef EXTERNAL_EEPROM_ADDRESS_SIZE
|
||||
# define EXTERNAL_EEPROM_ADDRESS_SIZE 2
|
||||
#endif
|
@@ -64,7 +64,7 @@ uint8_t g_twi_transfer_buffer[20];
|
||||
uint8_t g_pwm_buffer[DRIVER_COUNT][144];
|
||||
bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false};
|
||||
|
||||
uint8_t g_led_control_registers[DRIVER_COUNT][18] = {{0}, {0}};
|
||||
uint8_t g_led_control_registers[DRIVER_COUNT][18] = {{0}};
|
||||
bool g_led_control_registers_update_required[DRIVER_COUNT] = {false};
|
||||
|
||||
// This is the bit pattern in the LED control registers
|
||||
|
@@ -479,7 +479,7 @@ void oled_write_ln_P(const char *data, bool invert) {
|
||||
void oled_write_raw_P(const char *data, uint16_t size) {
|
||||
if (size > OLED_MATRIX_SIZE) size = OLED_MATRIX_SIZE;
|
||||
for (uint16_t i = 0; i < size; i++) {
|
||||
uint8_t c = pgm_read_byte(++data);
|
||||
uint8_t c = pgm_read_byte(data++);
|
||||
if (oled_buffer[i] == c) continue;
|
||||
oled_buffer[i] = c;
|
||||
oled_dirty |= (1 << (i / OLED_BLOCK_SIZE));
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user