Compare commits
50 Commits
Author | SHA1 | Date | |
---|---|---|---|
294caf1ff1 | |||
033c7af292 | |||
15e5f57952 | |||
4b11c2b552 | |||
201c5bfa5c | |||
34f302e1a5 | |||
722c196b08 | |||
c6ebb59a8b | |||
4808b930db | |||
c74295de88 | |||
a7209533a3 | |||
3d78e6078e | |||
e676278474 | |||
730a736ef0 | |||
a8320f20f7 | |||
f275ffbdfc | |||
36a6e269bf | |||
e8efc46e74 | |||
1b08a19e3e | |||
419128bfa1 | |||
2d256f48d0 | |||
380e05ad6e | |||
de4eb79c6a | |||
be47f91bc4 | |||
8030c17d63 | |||
9c8e66dc05 | |||
3ad389de55 | |||
66040506a7 | |||
d598f01cb7 | |||
1718dfa658 | |||
1c8208ad9a | |||
583be4a5f3 | |||
24507ddca8 | |||
3152bf572b | |||
96d4ba84c2 | |||
680924777b | |||
75c8a79d0e | |||
da1a527c90 | |||
bf962821b3 | |||
ce5678b819 | |||
d9cf6c6730 | |||
b386ccc786 | |||
0ed492978a | |||
a2c6257942 | |||
a14c9a057a | |||
c9838fea12 | |||
dfe18b40aa | |||
f099142004 | |||
d98ed28e7c | |||
beb9f3ab71 |
5
bin/qmk
5
bin/qmk
@ -25,6 +25,11 @@ with open(os.path.join(qmk_dir, 'requirements.txt'), 'r') as fd:
|
||||
line = line.split('#')[0]
|
||||
|
||||
module = line.split('=')[0] if '=' in line else line
|
||||
|
||||
if module in ['pep8-naming']:
|
||||
# Not every module is importable by its own name.
|
||||
continue
|
||||
|
||||
if not find_spec(module):
|
||||
print('Could not find module %s!' % module)
|
||||
print('Please run `pip3 install -r requirements.txt` to install the python dependencies.')
|
||||
|
@ -22,5 +22,5 @@ else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_1)/keymap.json)","")
|
||||
endif
|
||||
|
||||
# Generate the keymap.c
|
||||
$(KEYBOARD_OUTPUT)/src/keymap.c:
|
||||
$(KEYBOARD_OUTPUT)/src/keymap.c: $(KEYMAP_JSON)
|
||||
bin/qmk json-keymap --quiet --output $(KEYMAP_C) $(KEYMAP_JSON)
|
||||
|
@ -407,12 +407,18 @@ ifeq ($(strip $(SPACE_CADET_ENABLE)), yes)
|
||||
OPT_DEFS += -DSPACE_CADET_ENABLE
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(DIP_SWITCH_ENABLE)), yes)
|
||||
SRC += $(QUANTUM_DIR)/dip_switch.c
|
||||
OPT_DEFS += -DDIP_SWITCH_ENABLE
|
||||
MAGIC_ENABLE ?= yes
|
||||
ifeq ($(strip $(MAGIC_ENABLE)), yes)
|
||||
SRC += $(QUANTUM_DIR)/process_keycode/process_magic.c
|
||||
OPT_DEFS += -DMAGIC_KEYCODE_ENABLE
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(DYNAMIC_MACRO_ENABLE)), yes)
|
||||
SRC += $(QUANTUM_DIR)/process_keycode/process_dynamic_macro.c
|
||||
OPT_DEFS += -DDYNAMIC_MACRO_ENABLE
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(DIP_SWITCH_ENABLE)), yes)
|
||||
SRC += $(QUANTUM_DIR)/dip_switch.c
|
||||
OPT_DEFS += -DDIP_SWITCH_ENABLE
|
||||
endif
|
||||
|
@ -3,7 +3,10 @@
|
||||
* [Building Your First Firmware](newbs_building_firmware.md)
|
||||
* [Flashing Firmware](newbs_flashing.md)
|
||||
* [Testing and Debugging](newbs_testing_debugging.md)
|
||||
* [Git Best Practices](newbs_best_practices.md)
|
||||
* [Best Git Practices](newbs_git_best_practices.md)
|
||||
* [Using Your Fork's Master](newbs_git_using_your_master_branch.md)
|
||||
* [Resolving Merge Conflicts](newbs_git_resolving_merge_conflicts.md)
|
||||
* [Resynchronizing a Branch](newbs_git_resynchronize_a_branch.md)
|
||||
* [Learning Resources](newbs_learn_more_resources.md)
|
||||
|
||||
* [QMK Basics](README.md)
|
||||
@ -98,6 +101,7 @@
|
||||
* [Hand Wiring Guide](hand_wire.md)
|
||||
* [ISP Flashing Guide](isp_flashing_guide.md)
|
||||
* [ARM Debugging Guide](arm_debugging.md)
|
||||
* [ADC Driver](adc_driver.md)
|
||||
* [I2C Driver](i2c_driver.md)
|
||||
* [WS2812 Driver](ws2812_driver.md)
|
||||
* [GPIO Controls](internals_gpio_control.md)
|
||||
|
50
docs/adc_driver.md
Normal file
50
docs/adc_driver.md
Normal file
@ -0,0 +1,50 @@
|
||||
# ADC Driver
|
||||
|
||||
QMK can leverage the Analog-to-Digital Converter (ADC) on supported MCUs to measure voltages on certain pins. This can be useful for implementing things such as battery level indicators for Bluetooth keyboards, or volume controls using a potentiometer, as opposed to a [rotary encoder](feature_encoders.md).
|
||||
|
||||
This driver is currently AVR-only. The values returned are 10-bit integers (0-1023) mapped between 0V and VCC (usually 5V or 3.3V).
|
||||
|
||||
## Usage
|
||||
|
||||
To use this driver, add the following to your `rules.mk`:
|
||||
|
||||
```make
|
||||
SRC += analog.c
|
||||
```
|
||||
|
||||
Then place this include at the top of your code:
|
||||
|
||||
```c
|
||||
#include "analog.h"
|
||||
```
|
||||
|
||||
## Channels
|
||||
|
||||
|Channel|AT90USB64/128|ATmega16/32U4|ATmega32A|ATmega328P|
|
||||
|-------|-------------|-------------|---------|----------|
|
||||
|0 |`F0` |`F0` |`A0` |`C0` |
|
||||
|1 |`F1` |`F1` |`A1` |`C1` |
|
||||
|2 |`F2` | |`A2` |`C2` |
|
||||
|3 |`F3` | |`A3` |`C3` |
|
||||
|4 |`F4` |`F4` |`A4` |`C4` |
|
||||
|5 |`F5` |`F5` |`A5` |`C5` |
|
||||
|6 |`F6` |`F6` |`A6` |* |
|
||||
|7 |`F7` |`F7` |`A7` |* |
|
||||
|8 | |`D4` | | |
|
||||
|9 | |`D6` | | |
|
||||
|10 | |`D7` | | |
|
||||
|11 | |`B4` | | |
|
||||
|12 | |`B5` | | |
|
||||
|13 | |`B6` | | |
|
||||
|
||||
<sup>\* The ATmega328P possesses two extra ADC channels; however, they are not present on the DIP pinout, and are not shared with GPIO pins. You can use `adc_read()` directly to gain access to these.</sup>
|
||||
|
||||
## Functions
|
||||
|
||||
|Function |Description |
|
||||
|----------------------------|-------------------------------------------------------------------------------------------------------------------|
|
||||
|`analogReference(mode)` |Sets the analog voltage reference source. Must be one of `ADC_REF_EXTERNAL`, `ADC_REF_POWER` or `ADC_REF_INTERNAL`.|
|
||||
|`analogRead(pin)` |Reads the value from the specified Arduino pin, eg. `4` for ADC6 on the ATmega32U4. |
|
||||
|`analogReadPin(pin)` |Reads the value from the specified QMK pin, eg. `F6` for ADC6 on the ATmega32U4. |
|
||||
|`pinToMux(pin)` |Translates a given QMK pin to a mux value. If an unsupported pin is given, returns the mux value for "0V (GND)". |
|
||||
|`adc_read(mux)` |Reads the value from the ADC according to the specified mux. See your MCU's datasheet for more information. |
|
@ -14,7 +14,7 @@ Most of our style is pretty easy to pick up on, but right now it's not entirely
|
||||
* Think of them as a story describing the feature
|
||||
* Use them liberally to explain why particular decisions were made.
|
||||
* Do not write obvious comments
|
||||
* If you not sure if a comment is obvious, go ahead and include it.
|
||||
* If you're not sure if a comment is obvious, go ahead and include it.
|
||||
* In general we don't wrap lines, they can be as long as needed. If you do choose to wrap lines please do not wrap any wider than 76 columns.
|
||||
* We use `#pragma once` at the start of header files rather than old-style include guards (`#ifndef THIS_FILE_H`, `#define THIS_FILE_H`, ..., `#endif`)
|
||||
* We accept both forms of preprocessor if's: `#ifdef DEFINED` and `#if defined(DEFINED)`
|
||||
|
@ -8,7 +8,7 @@ Most of our style follows PEP8 with some local modifications to make things less
|
||||
* Think of them as a story describing the feature
|
||||
* Use them liberally to explain why particular decisions were made.
|
||||
* Do not write obvious comments
|
||||
* If you not sure if a comment is obvious, go ahead and include it.
|
||||
* If you're not sure if a comment is obvious, go ahead and include it.
|
||||
* We require useful docstrings for all functions.
|
||||
* In general we don't wrap lines, they can be as long as needed. If you do choose to wrap lines please do not wrap any wider than 76 columns.
|
||||
* Some of our practices conflict with the wider python community to make our codebase more approachable to non-pythonistas.
|
||||
|
@ -155,7 +155,7 @@ You can control the behavior of one shot keys by defining these in `config.h`:
|
||||
|
||||
Sometimes, you want to activate a one-shot key as part of a macro or tap dance routine.
|
||||
|
||||
For one shot layers, you need to call `set_oneshot_layer(LAYER, ONESHOT_START)` on key down, and `set_oneshot_layer(ONESHOT_PRESSED)` on key up. If you want to cancel the oneshot, call `reset_oneshot_layer()`.
|
||||
For one shot layers, you need to call `set_oneshot_layer(LAYER, ONESHOT_START)` on key down, and `clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED)` on key up. If you want to cancel the oneshot, call `reset_oneshot_layer()`.
|
||||
|
||||
For one shot mods, you need to call `set_oneshot_mods(MOD)` to set it, or `clear_oneshot_mods()` to cancel it.
|
||||
|
||||
|
@ -56,37 +56,37 @@ Hold down the Bootmagic key (Space by default) and the desired hotkey while plug
|
||||
|
||||
## Keycodes
|
||||
|
||||
|Keycode |Aliases |Description |
|
||||
|----------------------------------|---------|------------------------------------------|
|
||||
|`MAGIC_CAPSLOCK_TO_CONTROL` | |Treat Caps Lock as Left Control |
|
||||
|`MAGIC_UNCAPSLOCK_TO_CONTROL` | |Stop treating Caps Lock as Left Control |
|
||||
|`MAGIC_HOST_NKRO` | |Force N-Key Rollover (NKRO) on |
|
||||
|`MAGIC_UNHOST_NKRO` | |Force NKRO off |
|
||||
|`MAGIC_TOGGLE_NKRO` | |Turn NKRO on or off |
|
||||
|`MAGIC_NO_GUI` | |Disable the GUI keys (useful when gaming) |
|
||||
|`MAGIC_UNNO_GUI` | |Enable the GUI keys |
|
||||
|`MAGIC_SWAP_ALT_GUI` |`AG_SWAP`|Swap Alt and GUI on both sides (for macOS)|
|
||||
|`MAGIC_UNSWAP_ALT_GUI` |`AG_NORM`|Unswap Alt and GUI |
|
||||
|`MAGIC_TOGGLE_ALT_GUI` |`AG_TOGG`|Toggle Alt and GUI swap |
|
||||
|`MAGIC_SWAP_CTL_GUI` |`CG_SWAP`|Swap Ctrl and GUI on both sides (for macOS)|
|
||||
|`MAGIC_UNSWAP_CTL_GUI` |`CG_NORM`|Unswap Ctrl and GUI |
|
||||
|`MAGIC_TOGGLE_CTL_GUI` |`CG_TOGG`|Toggle Ctrl and GUI swap |
|
||||
|`MAGIC_SWAP_BACKSLASH_BACKSPACE` | |Swap `\` and Backspace |
|
||||
|`MAGIC_UNSWAP_BACKSLASH_BACKSPACE`| |Unswap `\` and Backspace |
|
||||
|`MAGIC_SWAP_CONTROL_CAPSLOCK` | |Swap Left Control and Caps Lock |
|
||||
|`MAGIC_UNSWAP_CONTROL_CAPSLOCK` | |Unswap Left Control and Caps Lock |
|
||||
|`MAGIC_SWAP_GRAVE_ESC` | |Swap <code>`</code> and Escape |
|
||||
|`MAGIC_UNSWAP_GRAVE_ESC` | |Unswap <code>`</code> and Escape |
|
||||
|`MAGIC_SWAP_LALT_LGUI` | |Swap Left Alt and Left GUI |
|
||||
|`MAGIC_UNSWAP_LALT_LGUI` | |Unswap Left Alt and Left GUI |
|
||||
|`MAGIC_SWAP_RALT_RGUI` | |Swap Right Alt and Right GUI |
|
||||
|`MAGIC_UNSWAP_RALT_RGUI` | |Unswap Right Alt and Right GUI |
|
||||
|`MAGIC_SWAP_LCTL_LGUI` | |Swap Left Control and Left GUI |
|
||||
|`MAGIC_UNSWAP_LCTL_LGUI` | |Unswap Left Control and Left GUI |
|
||||
|`MAGIC_SWAP_RCTL_RGUI` | |Swap Right Control and Right GUI |
|
||||
|`MAGIC_UNSWAP_RCTL_RGUI` | |Unswap Right Control and Right GUI |
|
||||
|`MAGIC_EE_HANDS_LEFT` | |Set "Left Hand" for EE_HANDS handedness |
|
||||
|`MAGIC_EE_HANDS_RIGHT` | |Set "Right Hand" for EE_HANDS handedness |
|
||||
|Key |Aliases |Description |
|
||||
|----------------------------------|---------|--------------------------------------------------------------------------|
|
||||
|`MAGIC_SWAP_CONTROL_CAPSLOCK` |`CL_SWAP`|Swap Caps Lock and Left Control |
|
||||
|`MAGIC_UNSWAP_CONTROL_CAPSLOCK` |`CL_NORM`|Unswap Caps Lock and Left Control |
|
||||
|`MAGIC_CAPSLOCK_TO_CONTROL` |`CL_CTRL`|Treat Caps Lock as Control |
|
||||
|`MAGIC_UNCAPSLOCK_TO_CONTROL` |`CL_CAPS`|Stop treating Caps Lock as Control |
|
||||
|`MAGIC_SWAP_LCTL_LGUI` |`LCG_SWP`|Swap Left Control and GUI |
|
||||
|`MAGIC_UNSWAP_LCTL_LGUI` |`LCG_NRM`|Unswap Left Control and GUI |
|
||||
|`MAGIC_SWAP_RCTL_RGUI` |`RCG_SWP`|Swap Right Control and GUI |
|
||||
|`MAGIC_UNSWAP_RCTL_RGUI` |`RCG_NRM`|Unswap Right Control and GUI |
|
||||
|`MAGIC_SWAP_CTL_GUI` |`CG_SWAP`|Swap Control and GUI on both sides |
|
||||
|`MAGIC_UNSWAP_CTL_GUI` |`CG_NORM`|Unswap Control and GUI on both sides |
|
||||
|`MAGIC_TOGGLE_CTL_GUI` |`CG_TOGG`|Toggle Control and GUI swap on both sides |
|
||||
|`MAGIC_SWAP_LALT_LGUI` |`LAG_SWP`|Swap Left Alt and GUI |
|
||||
|`MAGIC_UNSWAP_LALT_LGUI` |`LAG_NRM`|Unswap Left Alt and GUI |
|
||||
|`MAGIC_SWAP_RALT_RGUI` |`RAG_SWP`|Swap Right Alt and GUI |
|
||||
|`MAGIC_UNSWAP_RALT_RGUI` |`RAG_NRM`|Unswap Right Alt and GUI |
|
||||
|`MAGIC_SWAP_ALT_GUI` |`AG_SWAP`|Swap Alt and GUI on both sides |
|
||||
|`MAGIC_UNSWAP_ALT_GUI` |`AG_NORM`|Unswap Alt and GUI on both sides |
|
||||
|`MAGIC_TOGGLE_ALT_GUI` |`AG_TOGG`|Toggle Alt and GUI swap on both sides |
|
||||
|`MAGIC_NO_GUI` |`GUI_OFF`|Disable the GUI keys |
|
||||
|`MAGIC_UNNO_GUI` |`GUI_ON` |Enable the GUI keys |
|
||||
|`MAGIC_SWAP_GRAVE_ESC` |`GE_SWAP`|Swap <code>`</code> and Escape |
|
||||
|`MAGIC_UNSWAP_GRAVE_ESC` |`GE_NORM`|Unswap <code>`</code> and Escape |
|
||||
|`MAGIC_SWAP_BACKSLASH_BACKSPACE` |`BS_SWAP`|Swap `\` and Backspace |
|
||||
|`MAGIC_UNSWAP_BACKSLASH_BACKSPACE`|`BS_NORM`|Unswap `\` and Backspace |
|
||||
|`MAGIC_HOST_NKRO` |`NK_ON` |Enable N-key rollover |
|
||||
|`MAGIC_UNHOST_NKRO` |`NK_OFF` |Disable N-key rollover |
|
||||
|`MAGIC_TOGGLE_NKRO` |`NK_TOGG`|Toggle N-key rollover |
|
||||
|`MAGIC_EE_HANDS_LEFT` |`EH_LEFT`|Set the master half of a split keyboard as the left hand (for `EE_HANDS`) |
|
||||
|`MAGIC_EE_HANDS_RIGHT` |`EH_RGHT`|Set the master half of a split keyboard as the right hand (for `EE_HANDS`)|
|
||||
|
||||
## Configuration
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
## Haptic feedback rules.mk options
|
||||
|
||||
The following options are currently available for haptic feedback in `rule.mk`:
|
||||
The following options are currently available for haptic feedback in `rules.mk`:
|
||||
|
||||
`HAPTIC_ENABLE += DRV2605L`
|
||||
|
||||
|
@ -286,7 +286,7 @@ You can disable a single effect by defining `DISABLE_[EFFECT_NAME]` in your `con
|
||||
|
||||
## Custom RGB Matrix Effects
|
||||
|
||||
By setting `RGB_MATRIX_CUSTOM_USER` (and/or `RGB_MATRIX_CUSTOM_KB`) in `rule.mk`, new effects can be defined directly from userspace, without having to edit any QMK core files.
|
||||
By setting `RGB_MATRIX_CUSTOM_USER` (and/or `RGB_MATRIX_CUSTOM_KB`) in `rules.mk`, new effects can be defined directly from userspace, without having to edit any QMK core files.
|
||||
|
||||
To declare new effects, create a new `rgb_matrix_user/kb.inc` that looks something like this:
|
||||
|
||||
|
@ -59,7 +59,7 @@ To disable debug messages (*dprint*) and reduce the .hex file size, include `#de
|
||||
|
||||
To disable print messages (*print*, *xprintf*) and user print messages (*uprint*) and reduce the .hex file size, include `#define NO_PRINT` in your `config.h` file.
|
||||
|
||||
To disable print messages (*print*, *xprintf*) and **KEEP** user print messages (*uprint*), include `#define USER_PRINT` in your `config.h` file.
|
||||
To disable print messages (*print*, *xprintf*) and **KEEP** user print messages (*uprint*), include `#define USER_PRINT` in your `config.h` file (do not also include `#define NO_PRINT` in this case).
|
||||
|
||||
To see the text, open `hid_listen` and enjoy looking at your printed messages.
|
||||
|
||||
|
37
docs/ja/README.md
Normal file
37
docs/ja/README.md
Normal file
@ -0,0 +1,37 @@
|
||||
# Quantum Mechanical Keyboard Firmware
|
||||
|
||||
<!---
|
||||
original document: eae21eed7:docs/README.md
|
||||
git diff eae21eed7 HEAD docs/README.md | cat
|
||||
-->
|
||||
|
||||
[](https://github.com/qmk/qmk_firmware/tags)
|
||||
[](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/)
|
||||
|
||||
## QMK ファームウェアとは何か?
|
||||
|
||||
QMK (*Quantum Mechanical Keyboard*)は QMK ファームウェア、QMK ツールボックス、qmk.fm およびそれらのドキュメントを保守するオープンソースコミュニティです。QMK ファームウェアは[tmk\_keyboard](http://github.com/tmk/tmk_keyboard) を元にしたキーボードファームウェアで、Atmel AVR コントローラ、より具体的には [OLKB 製品](http://olkb.com)、[ErgoDox EZ](http://www.ergodox-ez.com) キーボードおよび [Clueboard 製品](http://clueboard.co/) のための幾つかの便利な機能を持ちます。また、ChibiOS を使って ARM チップに移植されています。これを使ってあなたの作った手配線のキーボードあるいはカスタムキーボード PCB で作ったキーボードを動かすことができます。
|
||||
|
||||
## 入手方法
|
||||
|
||||
QMK のキーマップ、キーボード、機能に貢献をする予定がある場合、最も簡単なのは、[Github を介してリポジトリをフォークし](https://github.com/qmk/qmk_firmware#fork-destination-box)、リポジトリをあなたの開発環境にクローンして変更を加え、それらをプッシュし、[プルリクエスト](https://github.com/qmk/qmk_firmware/pulls)を開くことです。
|
||||
|
||||
それ以外の場合は、`git clone https://github.com/qmk/qmk_firmware` を介して直接クローンすることができます。zip または tar ファイルをダウンロードしないでください。コンパイルするためのサブモジュールをダウンロードするために git リポジトリが必要です。
|
||||
|
||||
## コンパイル方法
|
||||
|
||||
コンパイルをする前に、AVR または ARM 開発のための[環境をインストール](ja/getting_started_build_tools.md)する必要があります。それが完了したら、`make` コマンドを使用して、以下の表記でキーボードとキーマップをビルドします。
|
||||
|
||||
make planck/rev4:default
|
||||
|
||||
これは、`planck` の `rev4` リビジョンを `default` キーマップでビルドします。全てのキーボードにリビジョン(サブプロジェクトまたはフォルダとも呼ばれます)があるわけではありません。その場合は省略されます:
|
||||
|
||||
make preonic:default
|
||||
|
||||
## カスタマイズ方法
|
||||
|
||||
QMK には、探求すべき多くの[機能](ja/features.md)と、深堀りするための[リファレンス ドキュメント](http://docs.qmk.fm)がたくさんあります。ほとんどの機能は[キーマップ](ja/keymap.md)を変更し、[キーコード](ja/keycodes.md)を変更することで活用されます。
|
92
docs/ja/arm_debugging.md
Normal file
92
docs/ja/arm_debugging.md
Normal file
@ -0,0 +1,92 @@
|
||||
# Eclipse を使った ARM デバッグ
|
||||
|
||||
<!---
|
||||
original document: eae21eed7:docs/arm_debugging.md
|
||||
git diff eae21eed7 HEAD docs/arm_debugging.md | cat
|
||||
-->
|
||||
|
||||
このページでは、SWD アダプタとオープンソース/フリーツールを使って ARM MCU をデバッグするためのセットアップ方法について説明します。このガイドでは、GNU MCU Eclipse IDE for C/C++ Developers および OpenOCD を必要な依存関係と一緒にインストールします。
|
||||
|
||||
このガイドは上級者向けであり、あなたのマシンで、MAKE フローを使って、ARM 互換キーボードをコンパイルできることを前提にしています。
|
||||
|
||||
## ソフトウェアのインストール
|
||||
|
||||
ここでの主な目的は MCU Eclipse IDE を正しくマシンにインストールすることです。必要な手順は[この](https://gnu-mcu-eclipse.github.io/install/)インストールガイドから派生しています。
|
||||
|
||||
### xPack マネージャ
|
||||
|
||||
このツールはソフトウェアパッケージマネージャであり、必要な依存関係を取得するために使われます。
|
||||
|
||||
XPM は Node.js を使って実行されるため、[ここ](https://nodejs.org/en/)から取得してください。インストール後に、ターミナルを開き `npm -v` と入力します。バージョン番号が返ってくるとインストールは成功です。
|
||||
|
||||
XPM のインストール手順は[ここ](https://www.npmjs.com/package/xpm)で見つけることができ、OS 固有のものです。ターミナルに `xpm --version` と入力すると、ソフトウェアのバージョンが返ってくるはずです。
|
||||
|
||||
### ARM ツールチェーン
|
||||
|
||||
XPM を使うと、ARM ツールチェーンをとても簡単にインストールできます。`xpm install --global @gnu-mcu-eclipse/arm-none-eabi-gcc` とコマンドを入力します。
|
||||
|
||||
### Windows ビルドツール
|
||||
|
||||
Windows を使っている場合は、これをインストールする必要があります!
|
||||
|
||||
`xpm install --global @gnu-mcu-eclipse/windows-build-tools`
|
||||
|
||||
### プログラマ/デバッガドライバ
|
||||
|
||||
プログラマのドライバをインストールします。このチュートリアルはほとんどどこでも入手できる ST-Link v2 を使って作成されました。
|
||||
ST-Link を持っている場合は、ドライバは[ここ](https://www.st.com/en/development-tools/stsw-link009.html)で見つけることができます。そうでない場合はツールの製造元にお問い合わせください。
|
||||
|
||||
### OpenOCD
|
||||
|
||||
この依存関係により、SWD は GDB からアクセスでき、デバッグに不可欠です。`xpm install --global @gnu-mcu-eclipse/openocd` を実行します。
|
||||
|
||||
### Java
|
||||
|
||||
Java は Eclipse で必要とされるため、[ここ](https://www.oracle.com/technetwork/java/javase/downloads/index.html)からダウンロードしてください。
|
||||
|
||||
### GNU MCU Eclipse IDE
|
||||
|
||||
最後に IDE をインストールする番です。[ここ](https://github.com/gnu-mcu-eclipse/org.eclipse.epp.packages/releases/)のリリースページから最新バージョンを取得します。
|
||||
|
||||
## Eclipse の設定
|
||||
|
||||
ダウンロードした Eclipse IDE を開きます。QMK ディレクトリをインポートするために、File -> Import -> C/C++ -> Existing code as Makefile Project を選択します。Next を選択し、Browse を使用して QMK フォルダを選択します。tool-chain リストから ARM Cross GCC を選択し、Finish を選択します。
|
||||
|
||||
これで、左側に QMK フォルダが表示されます。右クリックして、Properties を選択します。左側で MCU を展開し、ARM Toolchain Paths を選択します。xPack を押して OK を押します。OpenOCD Path で同じことを繰り返し、Windows の場合は、Build Tool Path でも同じことを繰り返します。Apply and Close を選択します。
|
||||
|
||||
ここで、必要な MCU パッケージをインストールします。Window -> Open Perspective -> Others -> Packs を選択して、Packs perspective に移動します。Packs タブの横にある黄色のリフレッシュ記号を選択します。これは様々な場所から MCU の定義を要求するため、時間が掛かります。一部のリンクが失敗した場合は、おそらく Ignore を選択できます。
|
||||
|
||||
これが終了すると、ビルドやデバッグする MCU を見つけることができるはずです。この例では、STM32F3 シリーズの MCU を使います。左側で、STMicroelectronics -> STM32F3 Series を選択します。中央のウィンドウに、pack が表示されます。右クリックし、Install を選択します。それが終了したら、Window -> Open Perspective -> Others -> C/C++ を選択してデフォルトのパースペクティブに戻ることができます。
|
||||
|
||||
Eclipse に QMK をビルドしようとするデバイスを教える必要があります。QMK フォルダを右クリック -> Properties -> C/C++ Build -> Settings を選択します。Devices タブを選択し、devices の下から MCU の適切な種類を選択します。私の例では、STM32F303CC です。
|
||||
|
||||
この間に、build コマンドもセットアップしましょう。C/C++ Build を選択し、Behavior タブを選択します。build コマンドのところで、`all` を必要な make コマンドに置き換えます。例えば、rev6 Planck の default キーマップの場合、これは `planck/rev6:default` になります。Apply and Close を選択します。
|
||||
|
||||
## ビルド
|
||||
|
||||
全て正しくセットアップできていれば、ハンマーボタンを押すとファームウェアがビルドされ、.binファイルが出力されるはずです。
|
||||
|
||||
## デバッグ
|
||||
|
||||
### デバッガの接続
|
||||
|
||||
ARM MCU は、クロック信号(SWCLK) とデータ信号(SWDIO) で構成される Single Wire Debug (SWD) プロトコルを使います。MCUを 完全に操作するには、この2本のワイヤとグラウンドを接続するだけで十分です。ここでは、キーボードは USB を介して電力が供給されると想定しています。手動でリセットボタンを使えるため、RESET 信号は必要ありません。より高度なセットアップのために printf と scanf をホストに非同期にパイプする SWO 信号を使用できますが、私たちのセットアップでは無視します。
|
||||
|
||||
注意: SWCLK と SWDIO ピンがキーボードのマトリックスで使われていないことを確認してください。もし使われている場合は、一時的に他のピンに切り替えることができます。
|
||||
|
||||
### デバッガの設定
|
||||
|
||||
QMK フォルダを右クリックし、Debug As -> Debug Configuration を選択します。ここで、GDB OpenOCD Debugging をダブルクリックします。Debugger タブを選択し、MCU に必要な設定を入力します。これを見つけるにはいじったりググったりする必要があるかもしれません。STM32F3 用のデフォルトスクリプトは stm32f3discovery.cfg と呼ばれます。OpenOCD に伝えるには、Config options で `-f board/stm32f3discovery.cfg` と入力します。
|
||||
|
||||
注意: 私の場合、この設定スクリプトはリセット操作を無効にするために編集が必要です。スクリプトの場所は、通常はパス `openocd/version/.content/scripts/board` の下の実際の実行可能フィールドの中で見つかります。ここで、私は `reset_config srst_only` を `reset_config none` に編集しました。
|
||||
|
||||
Apply and Close を選択します。
|
||||
|
||||
### デバッガの実行
|
||||
|
||||
キーボードをリセットしてください。
|
||||
|
||||
虫アイコンをクリックし、もし全てうまく行けば debug パースペクティブに移動します。ここでは、main 関数の最初でプログラムカウンタが停止するので、Play ボタンを押します。全てのデバッガのほとんどの機能は ARM MCU で動作しますが、正確な詳細については google があなたのお友達です!
|
||||
|
||||
|
||||
ハッピーデバッギング!
|
376
docs/ja/config_options.md
Normal file
376
docs/ja/config_options.md
Normal file
File diff suppressed because it is too large
Load Diff
@ -257,37 +257,37 @@ This is a reference only. Each group of keys links to the page documenting their
|
||||
|
||||
## [Bootmagic](feature_bootmagic.md)
|
||||
|
||||
|Key |Aliases |Description |
|
||||
|----------------------------------|---------|-------------------------------------------|
|
||||
|`MAGIC_SWAP_CONTROL_CAPSLOCK` | |Swap Caps Lock and Left Control |
|
||||
|`MAGIC_CAPSLOCK_TO_CONTROL` | |Treat Caps Lock as Control |
|
||||
|`MAGIC_SWAP_LCTL_LGUI` | |Swap Left Control and GUI |
|
||||
|`MAGIC_SWAP_RCTL_RGUI` | |Swap Right Control and GUI |
|
||||
|`MAGIC_SWAP_LALT_LGUI` | |Swap Left Alt and GUI |
|
||||
|`MAGIC_SWAP_RALT_RGUI` | |Swap Right Alt and GUI |
|
||||
|`MAGIC_NO_GUI` | |Disable the GUI key |
|
||||
|`MAGIC_SWAP_GRAVE_ESC` | |Swap <code>`</code> and Escape |
|
||||
|`MAGIC_SWAP_BACKSLASH_BACKSPACE` | |Swap `\` and Backspace |
|
||||
|`MAGIC_HOST_NKRO` | |Force NKRO on |
|
||||
|`MAGIC_SWAP_ALT_GUI` |`AG_SWAP`|Swap Alt and GUI on both sides |
|
||||
|`MAGIC_SWAP_CTL_GUI` |`CG_SWAP`|Swap Ctrl and GUI on both sides (for macOS)|
|
||||
|`MAGIC_UNSWAP_CONTROL_CAPSLOCK` | |Unswap Caps Lock and Left Control |
|
||||
|`MAGIC_UNCAPSLOCK_TO_CONTROL` | |Stop treating Caps Lock as Control |
|
||||
|`MAGIC_UNSWAP_LCTL_LGUI` | |Unswap Left Control and GUI |
|
||||
|`MAGIC_UNSWAP_RCTL_RGUI` | |Unswap Right Control and GUI |
|
||||
|`MAGIC_UNSWAP_LALT_LGUI` | |Unswap Left Alt and GUI |
|
||||
|`MAGIC_UNSWAP_RALT_RGUI` | |Unswap Right Alt and GUI |
|
||||
|`MAGIC_UNNO_GUI` | |Enable the GUI key |
|
||||
|`MAGIC_UNSWAP_GRAVE_ESC` | |Unswap <code>`</code> and Escape |
|
||||
|`MAGIC_UNSWAP_BACKSLASH_BACKSPACE`| |Unswap `\` and Backspace |
|
||||
|`MAGIC_UNHOST_NKRO` | |Force NKRO off |
|
||||
|`MAGIC_UNSWAP_ALT_GUI` |`AG_NORM`|Unswap Alt and GUI on both sides |
|
||||
|`MAGIC_UNSWAP_CTL_GUI` |`CG_NORM`|Unswap Ctrl and GUI on both sides |
|
||||
|`MAGIC_TOGGLE_ALT_GUI` |`AG_TOGG`|Toggle Alt and GUI swap on both sides |
|
||||
|`MAGIC_TOGGLE_CTL_GUI` |`CG_TOGG`|Toggle Ctrl and GUI swap on both sides |
|
||||
|`MAGIC_TOGGLE_NKRO` | |Turn NKRO on or off |
|
||||
|`MAGIC_EE_HANDS_LEFT` | |Set "Left Hand" for EE_HANDS handedness |
|
||||
|`MAGIC_EE_HANDS_RIGHT` | |Set "Right Hand" for EE_HANDS handedness |
|
||||
|Key |Aliases |Description |
|
||||
|----------------------------------|---------|--------------------------------------------------------------------------|
|
||||
|`MAGIC_SWAP_CONTROL_CAPSLOCK` |`CL_SWAP`|Swap Caps Lock and Left Control |
|
||||
|`MAGIC_UNSWAP_CONTROL_CAPSLOCK` |`CL_NORM`|Unswap Caps Lock and Left Control |
|
||||
|`MAGIC_CAPSLOCK_TO_CONTROL` |`CL_CTRL`|Treat Caps Lock as Control |
|
||||
|`MAGIC_UNCAPSLOCK_TO_CONTROL` |`CL_CAPS`|Stop treating Caps Lock as Control |
|
||||
|`MAGIC_SWAP_LCTL_LGUI` |`LCG_SWP`|Swap Left Control and GUI |
|
||||
|`MAGIC_UNSWAP_LCTL_LGUI` |`LCG_NRM`|Unswap Left Control and GUI |
|
||||
|`MAGIC_SWAP_RCTL_RGUI` |`RCG_SWP`|Swap Right Control and GUI |
|
||||
|`MAGIC_UNSWAP_RCTL_RGUI` |`RCG_NRM`|Unswap Right Control and GUI |
|
||||
|`MAGIC_SWAP_CTL_GUI` |`CG_SWAP`|Swap Control and GUI on both sides |
|
||||
|`MAGIC_UNSWAP_CTL_GUI` |`CG_NORM`|Unswap Control and GUI on both sides |
|
||||
|`MAGIC_TOGGLE_CTL_GUI` |`CG_TOGG`|Toggle Control and GUI swap on both sides |
|
||||
|`MAGIC_SWAP_LALT_LGUI` |`LAG_SWP`|Swap Left Alt and GUI |
|
||||
|`MAGIC_UNSWAP_LALT_LGUI` |`LAG_NRM`|Unswap Left Alt and GUI |
|
||||
|`MAGIC_SWAP_RALT_RGUI` |`RAG_SWP`|Swap Right Alt and GUI |
|
||||
|`MAGIC_UNSWAP_RALT_RGUI` |`RAG_NRM`|Unswap Right Alt and GUI |
|
||||
|`MAGIC_SWAP_ALT_GUI` |`AG_SWAP`|Swap Alt and GUI on both sides |
|
||||
|`MAGIC_UNSWAP_ALT_GUI` |`AG_NORM`|Unswap Alt and GUI on both sides |
|
||||
|`MAGIC_TOGGLE_ALT_GUI` |`AG_TOGG`|Toggle Alt and GUI swap on both sides |
|
||||
|`MAGIC_NO_GUI` |`GUI_OFF`|Disable the GUI keys |
|
||||
|`MAGIC_UNNO_GUI` |`GUI_ON` |Enable the GUI keys |
|
||||
|`MAGIC_SWAP_GRAVE_ESC` |`GE_SWAP`|Swap <code>`</code> and Escape |
|
||||
|`MAGIC_UNSWAP_GRAVE_ESC` |`GE_NORM`|Unswap <code>`</code> and Escape |
|
||||
|`MAGIC_SWAP_BACKSLASH_BACKSPACE` |`BS_SWAP`|Swap `\` and Backspace |
|
||||
|`MAGIC_UNSWAP_BACKSLASH_BACKSPACE`|`BS_NORM`|Unswap `\` and Backspace |
|
||||
|`MAGIC_HOST_NKRO` |`NK_ON` |Enable N-key rollover |
|
||||
|`MAGIC_UNHOST_NKRO` |`NK_OFF` |Disable N-key rollover |
|
||||
|`MAGIC_TOGGLE_NKRO` |`NK_TOGG`|Toggle N-key rollover |
|
||||
|`MAGIC_EE_HANDS_LEFT` |`EH_LEFT`|Set the master half of a split keyboard as the left hand (for `EE_HANDS`) |
|
||||
|`MAGIC_EE_HANDS_RIGHT` |`EH_RGHT`|Set the master half of a split keyboard as the right hand (for `EE_HANDS`)|
|
||||
|
||||
## [Bluetooth](feature_bluetooth.md)
|
||||
|
||||
|
@ -1,163 +0,0 @@
|
||||
# Best Practices
|
||||
|
||||
## Or, "How I Learned to Stop Worrying and Love Git."
|
||||
|
||||
This document aims to instruct novices in the best ways to have a smooth experience in contributing to QMK. We will walk through the process of contributing to QMK, detailing some ways to make this task easier, and then later we'll break some things in order to teach you how to fix them.
|
||||
|
||||
This document assumes a few things:
|
||||
|
||||
1. You have a GitHub account, and have [forked the qmk_firmware repository](getting_started_github.md) to your account.
|
||||
2. You've [set up your build environment](newbs_getting_started.md#set-up-your-environment).
|
||||
|
||||
|
||||
## Your fork's master: Update Often, Commit Never
|
||||
|
||||
It is highly recommended for QMK development, regardless of what is being done or where, to keep your `master` branch updated, but ***never*** commit to it. Instead, do all your changes in a development branch and issue pull requests from your branches when you're developing.
|
||||
|
||||
To reduce the chances of merge conflicts — instances where two or more users have edited the same part of a file concurrently — keep your `master` branch relatively up-to-date, and start any new developments by creating a new branch.
|
||||
|
||||
### Updating your master branch
|
||||
|
||||
To keep your `master` branch updated, it is recommended to add the QMK Firmware repository ("repo") as a remote repository in git. To do this, open your Git command line interface and enter:
|
||||
|
||||
```
|
||||
git remote add upstream https://github.com/qmk/qmk_firmware.git
|
||||
```
|
||||
|
||||
To verify that the repository has been added, run `git remote -v`, which should return the following:
|
||||
|
||||
```
|
||||
$ git remote -v
|
||||
origin https://github.com/<your_username>/qmk_firmware.git (fetch)
|
||||
origin https://github.com/<your_username>/qmk_firmware.git (push)
|
||||
upstream https://github.com/qmk/qmk_firmware.git (fetch)
|
||||
upstream https://github.com/qmk/qmk_firmware.git (push)
|
||||
```
|
||||
|
||||
Now that this is done, you can check for updates to the repo by running `git fetch upstream`. This retrieves the branches and tags — collectively referred to as "refs" — from the QMK repo, which now has the nickname `upstream`. We can now compare the data on our fork `origin` to that held by QMK.
|
||||
|
||||
To update your fork's master, run the following, hitting the Enter key after each line:
|
||||
|
||||
```
|
||||
git checkout master
|
||||
git fetch upstream
|
||||
git pull upstream master
|
||||
git push origin master
|
||||
```
|
||||
|
||||
This switches you to your `master` branch, retrieves the refs from the QMK repo, downloads the current QMK `master` branch to your computer, and then uploads it to your fork.
|
||||
|
||||
### Making Changes
|
||||
|
||||
To make changes, create a new branch by entering:
|
||||
|
||||
```
|
||||
git checkout -b dev_branch
|
||||
git push --set-upstream origin dev_branch
|
||||
```
|
||||
|
||||
This creates a new branch named `dev_branch`, checks it out, and then saves the new branch to your fork. The `--set-upstream` argument tells git to use your fork and the `dev_branch` branch every time you use `git push` or `git pull` from this branch. It only needs to be used on the first push; after that, you can safely use `git push` or `git pull`, without the rest of the arguments.
|
||||
|
||||
!> With `git push`, you can use `-u` in place of `--set-upstream` — `-u` is an alias for `--set-upstream`.
|
||||
|
||||
You can name your branch nearly anything you want, though it is recommended to name it something related to the changes you are going to make.
|
||||
|
||||
By default `git checkout -b` will base your new branch on the branch that is checked out. You can base your new branch on an existing branch that is not checked out by adding the name of the existing branch to the command:
|
||||
|
||||
```
|
||||
git checkout -b dev_branch master
|
||||
```
|
||||
|
||||
Now that you have a development branch, open your text editor and make whatever changes you need to make. It is recommended to make many small commits to your branch; that way, any change that causes issues can be more easily traced and undone if needed. To make your changes, edit and save any files that need to be updated, add them to Git's *staging area*, and then commit them to your branch:
|
||||
|
||||
```
|
||||
git add path/to/updated_file
|
||||
git commit -m "My commit message."
|
||||
```
|
||||
|
||||
`git add` adds files that have been changed to Git's *staging area*, which is Git's "loading zone." This contains the changes that are going to be *committed* by `git commit`, which saves the changes to the repo. Use descriptive commit messages so you can know what was changed at a glance.
|
||||
|
||||
!> If you've changed a lot of files, but all the files are part of the same change, you can use `git add .` to add all the changed files that are in your current directory, rather than having to add each file individually.
|
||||
|
||||
### Publishing Your Changes
|
||||
|
||||
The last step is to push your changes to your fork. To do this, enter `git push`. Git now publishes the current state of `dev_branch` to your fork.
|
||||
|
||||
|
||||
## Resolving Merge Conflicts
|
||||
|
||||
Sometimes when your work in a branch takes a long time to complete, changes that have been made by others conflict with changes you have made to your branch when you open a pull request. This is called a *merge conflict*, and is what happens when multiple people edit the same parts of the same files.
|
||||
|
||||
### Rebasing Your Changes
|
||||
|
||||
A *rebase* is Git's way of taking changes that were applied at one point, reversing them, and then applying the same changes to another point. In the case of a merge conflict, you can rebase your branch to grab the changes that were made between when you created your branch and the present time.
|
||||
|
||||
To start, run the following:
|
||||
|
||||
```
|
||||
git fetch upstream
|
||||
git rev-list --left-right --count HEAD...upstream/master
|
||||
```
|
||||
|
||||
The `git rev-list` command entered here returns the number of commits that differ between the current branch and QMK's master branch. We run `git fetch` first to make sure we have the refs that represent the current state of the upstream repo. The output of the `git rev-list` command entered returns two numbers:
|
||||
|
||||
```
|
||||
$ git rev-list --left-right --count HEAD...upstream/master
|
||||
7 35
|
||||
```
|
||||
|
||||
The first number represents the number of commits on the current branch since it was created, and the second number is the number of commits made to `upstream/master` since the current branch was created, and thus, the changes that are not recorded in the current branch.
|
||||
|
||||
Now that the current states of both the current branch and the upstream repo are known, we can start a rebase operation:
|
||||
|
||||
```
|
||||
git rebase upstream/master
|
||||
```
|
||||
|
||||
This tells Git to undo the commits on the current branch, and then reapply them against QMK's master branch.
|
||||
|
||||
```
|
||||
$ git rebase upstream/master
|
||||
First, rewinding head to replay your work on top of it...
|
||||
Applying: Commit #1
|
||||
Using index info to reconstruct a base tree...
|
||||
M conflicting_file_1.txt
|
||||
Falling back to patching base and 3-way merge...
|
||||
Auto-merging conflicting_file_1.txt
|
||||
CONFLICT (content): Merge conflict in conflicting_file_1.txt
|
||||
error: Failed to merge in the changes.
|
||||
hint: Use 'git am --show-current-patch' to see the failed patch
|
||||
Patch failed at 0001 Commit #1
|
||||
|
||||
Resolve all conflicts manually, mark them as resolved with
|
||||
"git add/rm <conflicted_files>", then run "git rebase --continue".
|
||||
You can instead skip this commit: run "git rebase --skip".
|
||||
To abort and get back to the state before "git rebase", run "git rebase --abort".
|
||||
```
|
||||
|
||||
This tells us that we have a merge conflict, and gives the name of the file with the conflict. Open the conflicting file in your text editor, and somewhere in the file, you'll find something like this:
|
||||
|
||||
```
|
||||
<<<<<<< HEAD
|
||||
<p>For help with any issues, email us at support@webhost.us.</p>
|
||||
=======
|
||||
<p>Need help? Email support@webhost.us.</p>
|
||||
>>>>>>> Commit #1
|
||||
```
|
||||
|
||||
The line `<<<<<<< HEAD` marks the beginning of a merge conflict, and the `>>>>>>> Commit #1` line marks the end, with the conflicting sections separated by `=======`. The part on the `HEAD` side is from the QMK master version of the file, and the part marked with the commit message is from the current branch and commit.
|
||||
|
||||
Because Git tracks *changes to files* rather than the contents of the files directly, if Git can't find the text that was in the file previous to the commit that was made, it won't know how to edit the file. Re-editing the file will solve the conflict. Make your changes, and then save the file.
|
||||
|
||||
```
|
||||
<p>Need help? Email support@webhost.us.</p>
|
||||
```
|
||||
|
||||
Now run:
|
||||
|
||||
```
|
||||
git add conflicting_file_1.txt
|
||||
git rebase --continue
|
||||
```
|
||||
|
||||
Git logs the changes to the conflicting file, and continues applying the commits from our branch until it reaches the end.
|
16
docs/newbs_git_best_practices.md
Normal file
16
docs/newbs_git_best_practices.md
Normal file
@ -0,0 +1,16 @@
|
||||
# Best Git Practices for Working with QMK
|
||||
|
||||
## Or, "How I Learned to Stop Worrying and Love Git."
|
||||
|
||||
This section aims to instruct novices in the best ways to have a smooth experience in contributing to QMK. We will walk through the process of contributing to QMK, detailing some ways to make this task easier, and then later we'll break some things in order to teach you how to fix them.
|
||||
|
||||
This section assumes a few things:
|
||||
|
||||
1. You have a GitHub account, and have [forked the qmk_firmware repository](getting_started_github.md) to your account.
|
||||
2. You've set up both [your build environment](newbs_getting_started.md#set-up-your-environment) and [QMK](newbs_getting_started.md#set-up-qmk).
|
||||
|
||||
---
|
||||
|
||||
- Part 1: [Your Fork's Master: Update Often, Commit Never](newbs_git_using_your_master_branch.md)
|
||||
- Part 2: [Resolving Merge Conflicts](newbs_git_resolving_merge_conflicts.md)
|
||||
- Part 3: [Resynchronizing an Out-of-Sync Git Branch](newbs_git_resynchronize_a_branch.md)
|
79
docs/newbs_git_resolving_merge_conflicts.md
Normal file
79
docs/newbs_git_resolving_merge_conflicts.md
Normal file
@ -0,0 +1,79 @@
|
||||
# Resolving Merge Conflicts
|
||||
|
||||
Sometimes when your work in a branch takes a long time to complete, changes that have been made by others conflict with changes you have made to your branch when you open a pull request. This is called a *merge conflict*, and is what happens when multiple people edit the same parts of the same files.
|
||||
|
||||
?> This document builds upon the concepts detailed in [Your Fork's Master: Update Often, Commit Never](newbs_git_using_your_master_branch.md). If you are not familiar with that document, please read it first, then return here.
|
||||
|
||||
## Rebasing Your Changes
|
||||
|
||||
A *rebase* is Git's way of taking changes that were applied at one point in the commit history, reversing them, and then applying the same changes at another point. In the case of a merge conflict, you can rebase your branch to grab the changes that were made between when you created your branch and the present time.
|
||||
|
||||
To start, run the following:
|
||||
|
||||
```
|
||||
git fetch upstream
|
||||
git rev-list --left-right --count HEAD...upstream/master
|
||||
```
|
||||
|
||||
The `git rev-list` command entered here returns the number of commits that differ between the current branch and QMK's master branch. We run `git fetch` first to make sure we have the refs that represent the current state of the upstream repo. The output of the `git rev-list` command entered returns two numbers:
|
||||
|
||||
```
|
||||
$ git rev-list --left-right --count HEAD...upstream/master
|
||||
7 35
|
||||
```
|
||||
|
||||
The first number represents the number of commits on the current branch since it was created, and the second number is the number of commits made to `upstream/master` since the current branch was created, and thus, the changes that are not recorded in the current branch.
|
||||
|
||||
Now that the current states of both the current branch and the upstream repo are known, we can start a rebase operation:
|
||||
|
||||
```
|
||||
git rebase upstream/master
|
||||
```
|
||||
|
||||
This tells Git to undo the commits on the current branch, and then reapply them against QMK's master branch.
|
||||
|
||||
```
|
||||
$ git rebase upstream/master
|
||||
First, rewinding head to replay your work on top of it...
|
||||
Applying: Commit #1
|
||||
Using index info to reconstruct a base tree...
|
||||
M conflicting_file_1.txt
|
||||
Falling back to patching base and 3-way merge...
|
||||
Auto-merging conflicting_file_1.txt
|
||||
CONFLICT (content): Merge conflict in conflicting_file_1.txt
|
||||
error: Failed to merge in the changes.
|
||||
hint: Use 'git am --show-current-patch' to see the failed patch
|
||||
Patch failed at 0001 Commit #1
|
||||
|
||||
Resolve all conflicts manually, mark them as resolved with
|
||||
"git add/rm <conflicted_files>", then run "git rebase --continue".
|
||||
You can instead skip this commit: run "git rebase --skip".
|
||||
To abort and get back to the state before "git rebase", run "git rebase --abort".
|
||||
```
|
||||
|
||||
This tells us that we have a merge conflict, and gives the name of the file with the conflict. Open the conflicting file in your text editor, and somewhere in the file, you'll find something like this:
|
||||
|
||||
```
|
||||
<<<<<<< HEAD
|
||||
<p>For help with any issues, email us at support@webhost.us.</p>
|
||||
=======
|
||||
<p>Need help? Email support@webhost.us.</p>
|
||||
>>>>>>> Commit #1
|
||||
```
|
||||
|
||||
The line `<<<<<<< HEAD` marks the beginning of a merge conflict, and the `>>>>>>> Commit #1` line marks the end, with the conflicting sections separated by `=======`. The part on the `HEAD` side is from the QMK master version of the file, and the part marked with the commit message is from the current branch and commit.
|
||||
|
||||
Because Git tracks *changes to files* rather than the contents of the files directly, if Git can't find the text that was in the file previous to the commit that was made, it won't know how to edit the file. Re-editing the file will solve the conflict. Make your changes, and then save the file.
|
||||
|
||||
```
|
||||
<p>Need help? Email support@webhost.us.</p>
|
||||
```
|
||||
|
||||
Now run:
|
||||
|
||||
```
|
||||
git add conflicting_file_1.txt
|
||||
git rebase --continue
|
||||
```
|
||||
|
||||
Git logs the changes to the conflicting file, and continues applying the commits from our branch until it reaches the end.
|
71
docs/newbs_git_resynchronize_a_branch.md
Normal file
71
docs/newbs_git_resynchronize_a_branch.md
Normal file
@ -0,0 +1,71 @@
|
||||
# Resynchronizing an Out-of-Sync Git Branch
|
||||
|
||||
Suppose you have committed to your `master` branch, and now need to update your QMK repository. You could `git pull` QMK's `master` branch into your own, but GitHub will tell you that your commit is a number of commits ahead of `qmk:master`, which can create issues if you want to make a pull request to QMK.
|
||||
|
||||
?> This document builds upon the concepts detailed in [Your Fork's Master: Update Often, Commit Never](newbs_git_using_your_master_branch.md). If you are not familiar with that document, please read it first, then return here.
|
||||
|
||||
## Backing Up the Changes on Your Own Master Branch (Optional)
|
||||
|
||||
No one wants to lose work if it can be helped. If you want to save the changes you've already made to your `master` branch, the simplest way to do so is to simply create a duplicate of your "dirty" `master` branch:
|
||||
|
||||
```sh
|
||||
git branch old_master master
|
||||
```
|
||||
|
||||
Now you have a branch named `old_master` that is a duplicate of your `master` branch.
|
||||
|
||||
## Resynchronizing Your Branch
|
||||
|
||||
Now it's time to resynchronize your `master` branch. For this step, you'll want to have QMK's repository configured as a remote in Git. To check your configured remotes, run `git remote -v`, which should return something similar to:
|
||||
|
||||
```sh
|
||||
QMKuser ~/qmk_firmware (master)
|
||||
$ git remote -v
|
||||
origin https://github.com/<your_username>/qmk_firmware.git (fetch)
|
||||
origin https://github.com/<your_username>/qmk_firmware.git (push)
|
||||
upstream https://github.com/qmk/qmk_firmware.git (fetch)
|
||||
upstream https://github.com/qmk/qmk_firmware.git (push)
|
||||
```
|
||||
|
||||
If you only see one fork referenced:
|
||||
|
||||
```sh
|
||||
QMKuser ~/qmk_firmware (master)
|
||||
$ git remote -v
|
||||
origin https://github.com/qmk/qmk_firmware.git (fetch)
|
||||
origin https://github.com/qmk/qmk_firmware.git (push)
|
||||
```
|
||||
|
||||
add a new remote with:
|
||||
|
||||
```sh
|
||||
git remote add upstream https://github.com/qmk/qmk_firmware.git
|
||||
```
|
||||
|
||||
Then, redirect the `origin` remote to your own fork with:
|
||||
|
||||
```sh
|
||||
git remote set-url origin https://github.com/<your_username>/qmk_firmware.git
|
||||
```
|
||||
|
||||
Now that you have both remotes configured, you need to update the references for the upstream repository, which is QMK's, by running:
|
||||
|
||||
```sh
|
||||
git fetch upstream
|
||||
```
|
||||
|
||||
At this point, resynchronize your branch to QMK's by running:
|
||||
|
||||
```sh
|
||||
git reset --hard upstream/master
|
||||
```
|
||||
|
||||
These steps will update the repository on your computer, but your GitHub fork will still be out of sync. To resynchronize your fork on GitHub, you need to push to your fork, instructing Git to override any remote changes that are not reflected in your local repository. To do this, run:
|
||||
|
||||
```sh
|
||||
git push --force-with-lease
|
||||
```
|
||||
|
||||
!> **DO NOT** run `git push --force-with-lease` on a fork to which other users post commits. This will erase their commits.
|
||||
|
||||
Now your GitHub fork, your local files, and QMK's repository are all the same. From here you can make further needed changes ([use a branch!](newbs_git_using_your_master_branch.md#making-changes)) and post them as normal.
|
74
docs/newbs_git_using_your_master_branch.md
Normal file
74
docs/newbs_git_using_your_master_branch.md
Normal file
@ -0,0 +1,74 @@
|
||||
# Your Fork's Master: Update Often, Commit Never
|
||||
|
||||
It is highly recommended for QMK development, regardless of what is being done or where, to keep your `master` branch updated, but ***never*** commit to it. Instead, do all your changes in a development branch and issue pull requests from your branches when you're developing.
|
||||
|
||||
To reduce the chances of merge conflicts — instances where two or more users have edited the same part of a file concurrently — keep your `master` branch relatively up-to-date, and start any new developments by creating a new branch.
|
||||
|
||||
## Updating your master branch
|
||||
|
||||
To keep your `master` branch updated, it is recommended to add the QMK Firmware repository ("repo") as a remote repository in git. To do this, open your Git command line interface and enter:
|
||||
|
||||
```
|
||||
git remote add upstream https://github.com/qmk/qmk_firmware.git
|
||||
```
|
||||
|
||||
?> The name `upstream` is arbitrary, but a common convention; you can give the QMK remote any name that suits you. Git's `remote` command uses the syntax `git remote add <name> <url>`, `<name>` being shorthand for the remote repo. This name can be used with many Git commands, including but not limited to `fetch`, `pull` and `push`, to specify the remote repo on which to act.
|
||||
|
||||
To verify that the repository has been added, run `git remote -v`, which should return the following:
|
||||
|
||||
```
|
||||
$ git remote -v
|
||||
origin https://github.com/<your_username>/qmk_firmware.git (fetch)
|
||||
origin https://github.com/<your_username>/qmk_firmware.git (push)
|
||||
upstream https://github.com/qmk/qmk_firmware.git (fetch)
|
||||
upstream https://github.com/qmk/qmk_firmware.git (push)
|
||||
```
|
||||
|
||||
Now that this is done, you can check for updates to the repo by running `git fetch upstream`. This retrieves the branches and tags — collectively referred to as "refs" — from the QMK repo, which now has the nickname `upstream`. We can now compare the data on our fork `origin` to that held by QMK.
|
||||
|
||||
To update your fork's master, run the following, hitting the Enter key after each line:
|
||||
|
||||
```
|
||||
git checkout master
|
||||
git fetch upstream
|
||||
git pull upstream master
|
||||
git push origin master
|
||||
```
|
||||
|
||||
This switches you to your `master` branch, retrieves the refs from the QMK repo, downloads the current QMK `master` branch to your computer, and then uploads it to your fork.
|
||||
|
||||
## Making Changes
|
||||
|
||||
To make changes, create a new branch by entering:
|
||||
|
||||
```
|
||||
git checkout -b dev_branch
|
||||
git push --set-upstream origin dev_branch
|
||||
```
|
||||
|
||||
This creates a new branch named `dev_branch`, checks it out, and then saves the new branch to your fork. The `--set-upstream` argument tells git to use your fork and the `dev_branch` branch every time you use `git push` or `git pull` from this branch. It only needs to be used on the first push; after that, you can safely use `git push` or `git pull`, without the rest of the arguments.
|
||||
|
||||
?> With `git push`, you can use `-u` in place of `--set-upstream` — `-u` is an alias for `--set-upstream`.
|
||||
|
||||
You can name your branch nearly anything you want, though it is recommended to name it something related to the changes you are going to make.
|
||||
|
||||
By default `git checkout -b` will base your new branch on the branch that is currently checked out. You can base your new branch on an existing branch that is not checked out by adding the name of the existing branch to the command:
|
||||
|
||||
```
|
||||
git checkout -b dev_branch master
|
||||
```
|
||||
|
||||
Now that you have a development branch, open your text editor and make whatever changes you need to make. It is recommended to make many small commits to your branch; that way, any change that causes issues can be more easily traced and undone if needed. To make your changes, edit and save any files that need to be updated, add them to Git's *staging area*, and then commit them to your branch:
|
||||
|
||||
```
|
||||
git add path/to/updated_file
|
||||
git commit -m "My commit message."
|
||||
```
|
||||
|
||||
`git add` adds files that have been changed to Git's *staging area*, which is Git's "loading zone." This contains the changes that are going to be *committed* by `git commit`, which saves the changes to the repo. Use descriptive commit messages so you can know what was changed at a glance.
|
||||
|
||||
?> If you've changed multiple files, you can use `git add -- path/to/file1 path/to/file2 ...` to add all your desired files.
|
||||
|
||||
## Publishing Your Changes
|
||||
|
||||
The last step is to push your changes to your fork. To do this, enter `git push`. Git will then publish the current state of `dev_branch` to your fork.
|
123
docs/ru-ru/_summary.md
Normal file
123
docs/ru-ru/_summary.md
Normal file
@ -0,0 +1,123 @@
|
||||
* [Complete Newbs Guide](ru-ru/newbs.md)
|
||||
* [Getting Started](ru-ru/newbs_getting_started.md)
|
||||
* [Building Your First Firmware](ru-ru/newbs_building_firmware.md)
|
||||
* [Flashing Firmware](ru-ru/newbs_flashing.md)
|
||||
* [Testing and Debugging](ru-ru/newbs_testing_debugging.md)
|
||||
* [Git Best Practices](ru-ru/newbs_best_practices.md)
|
||||
* [Learning Resources](ru-ru/newbs_learn_more_resources.md)
|
||||
|
||||
* [QMK Basics](ru-ru/README.md)
|
||||
* [QMK Introduction](ru-ru/getting_started_introduction.md)
|
||||
* [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)
|
||||
* [Getting Help](ru-ru/getting_started_getting_help.md)
|
||||
|
||||
* [Breaking Changes](ru-ru/breaking_changes.md)
|
||||
* [2019 Aug 30](ru-ru/ChangeLog/20190830.md)
|
||||
|
||||
* [FAQ](ru-ru/faq.md)
|
||||
* [General FAQ](ru-ru/faq_general.md)
|
||||
* [Build/Compile QMK](ru-ru/faq_build.md)
|
||||
* [Debugging/Troubleshooting QMK](ru-ru/faq_debug.md)
|
||||
* [Keymap](ru-ru/faq_keymap.md)
|
||||
* [Driver Installation with Zadig](ru-ru/driver_installation_zadig.md)
|
||||
|
||||
* Detailed Guides
|
||||
* [Install Build Tools](ru-ru/getting_started_build_tools.md)
|
||||
* [Vagrant Guide](ru-ru/getting_started_vagrant.md)
|
||||
* [Build/Compile Instructions](ru-ru/getting_started_make_guide.md)
|
||||
* [Flashing Firmware](ru-ru/flashing.md)
|
||||
* [Customizing Functionality](ru-ru/custom_quantum_functions.md)
|
||||
* [Keymap Overview](ru-ru/keymap.md)
|
||||
|
||||
* [Hardware](ru-ru/hardware.md)
|
||||
* [Compatible Microcontrollers](ru-ru/compatible_microcontrollers.md)
|
||||
* [AVR Processors](ru-ru/hardware_avr.md)
|
||||
* [Drivers](ru-ru/hardware_drivers.md)
|
||||
|
||||
* Reference
|
||||
* [Keyboard Guidelines](ru-ru/hardware_keyboard_guidelines.md)
|
||||
* [Config Options](ru-ru/config_options.md)
|
||||
* [Keycodes](ru-ru/keycodes.md)
|
||||
* [Coding Conventions - C](ru-ru/coding_conventions_c.md)
|
||||
* [Coding Conventions - Python](ru-ru/coding_conventions_python.md)
|
||||
* [Documentation Best Practices](ru-ru/documentation_best_practices.md)
|
||||
* [Documentation Templates](ru-ru/documentation_templates.md)
|
||||
* [Glossary](ru-ru/reference_glossary.md)
|
||||
* [Unit Testing](ru-ru/unit_testing.md)
|
||||
* [Useful Functions](ru-ru/ref_functions.md)
|
||||
* [Configurator Support](ru-ru/reference_configurator_support.md)
|
||||
* [info.json Format](ru-ru/reference_info_json.md)
|
||||
* [Python CLI Development](ru-ru/cli_development.md)
|
||||
|
||||
* [Features](ru-ru/features.md)
|
||||
* [Basic Keycodes](ru-ru/keycodes_basic.md)
|
||||
* [US ANSI Shifted Keys](ru-ru/keycodes_us_ansi_shifted.md)
|
||||
* [Quantum Keycodes](ru-ru/quantum_keycodes.md)
|
||||
* [Advanced Keycodes](ru-ru/feature_advanced_keycodes.md)
|
||||
* [Audio](ru-ru/feature_audio.md)
|
||||
* [Auto Shift](ru-ru/feature_auto_shift.md)
|
||||
* [Backlight](ru-ru/feature_backlight.md)
|
||||
* [Bluetooth](ru-ru/feature_bluetooth.md)
|
||||
* [Bootmagic](ru-ru/feature_bootmagic.md)
|
||||
* [Combos](ru-ru/feature_combo.md)
|
||||
* [Command](ru-ru/feature_command.md)
|
||||
* [Debounce API](ru-ru/feature_debounce_type.md)
|
||||
* [DIP Switch](ru-ru/feature_dip_switch.md)
|
||||
* [Dynamic Macros](ru-ru/feature_dynamic_macros.md)
|
||||
* [Encoders](ru-ru/feature_encoders.md)
|
||||
* [Grave Escape](ru-ru/feature_grave_esc.md)
|
||||
* [Haptic Feedback](ru-ru/feature_haptic_feedback.md)
|
||||
* [HD44780 LCD Controller](ru-ru/feature_hd44780.md)
|
||||
* [Key Lock](ru-ru/feature_key_lock.md)
|
||||
* [Layouts](ru-ru/feature_layouts.md)
|
||||
* [Leader Key](ru-ru/feature_leader_key.md)
|
||||
* [LED Matrix](ru-ru/feature_led_matrix.md)
|
||||
* [Macros](ru-ru/feature_macros.md)
|
||||
* [Mouse Keys](ru-ru/feature_mouse_keys.md)
|
||||
* [OLED Driver](ru-ru/feature_oled_driver.md)
|
||||
* [One Shot Keys](ru-ru/feature_advanced_keycodes.md#one-shot-keys)
|
||||
* [Pointing Device](ru-ru/feature_pointing_device.md)
|
||||
* [PS/2 Mouse](ru-ru/feature_ps2_mouse.md)
|
||||
* [RGB Lighting](ru-ru/feature_rgblight.md)
|
||||
* [RGB Matrix](ru-ru/feature_rgb_matrix.md)
|
||||
* [Space Cadet](ru-ru/feature_space_cadet.md)
|
||||
* [Split Keyboard](ru-ru/feature_split_keyboard.md)
|
||||
* [Stenography](ru-ru/feature_stenography.md)
|
||||
* [Swap Hands](ru-ru/feature_swap_hands.md)
|
||||
* [Tap Dance](ru-ru/feature_tap_dance.md)
|
||||
* [Terminal](ru-ru/feature_terminal.md)
|
||||
* [Thermal Printer](ru-ru/feature_thermal_printer.md)
|
||||
* [Unicode](ru-ru/feature_unicode.md)
|
||||
* [Userspace](ru-ru/feature_userspace.md)
|
||||
* [Velocikey](ru-ru/feature_velocikey.md)
|
||||
|
||||
* For Makers and Modders
|
||||
* [Hand Wiring Guide](ru-ru/hand_wire.md)
|
||||
* [ISP Flashing Guide](ru-ru/isp_flashing_guide.md)
|
||||
* [ARM Debugging Guide](ru-ru/arm_debugging.md)
|
||||
* [I2C Driver](ru-ru/i2c_driver.md)
|
||||
* [WS2812 Driver](ru-ru/ws2812_driver.md)
|
||||
* [GPIO Controls](ru-ru/internals_gpio_control.md)
|
||||
* [Proton C Conversion](ru-ru/proton_c_conversion.md)
|
||||
|
||||
* For a Deeper Understanding
|
||||
* [How Keyboards Work](ru-ru/how_keyboards_work.md)
|
||||
* [Understanding QMK](ru-ru/understanding_qmk.md)
|
||||
|
||||
* Other Topics
|
||||
* [Using Eclipse with QMK](ru-ru/other_eclipse.md)
|
||||
* [Using VSCode with QMK](ru-ru/other_vscode.md)
|
||||
* [Support](ru-ru/support.md)
|
||||
* [Translating the QMK Docs](ru-ru/translating.md)
|
||||
|
||||
* QMK Internals (In Progress)
|
||||
* [Defines](ru-ru/internals_defines.md)
|
||||
* [Input Callback Reg](ru-ru/internals_input_callback_reg.md)
|
||||
* [Midi Device](ru-ru/internals_midi_device.md)
|
||||
* [Midi Device Setup Process](ru-ru/internals_midi_device_setup_process.md)
|
||||
* [Midi Util](ru-ru/internals_midi_util.md)
|
||||
* [Send Functions](ru-ru/internals_send_functions.md)
|
||||
* [Sysex Tools](ru-ru/internals_sysex_tools.md)
|
9
docs/ru-ru/becoming_a_qmk_collaborator.md
Normal file
9
docs/ru-ru/becoming_a_qmk_collaborator.md
Normal file
@ -0,0 +1,9 @@
|
||||
# Стать соавтором QMK
|
||||
|
||||
Соавтор QMK - это производитель или разработчик клавиатуры, который заинтересован в том, чтобы помочь QMK вырасти. Для этого он полностью поддерживает свои клавиатуры, поощряет пользователей и клиентов создавать новый функционал, идеи и раскладки клавиатур. Мы всегда стремимся добавлять больше клавиатур и соавторов, но нам важно, чтобы они соответствовали следующим требованиям:
|
||||
|
||||
* **Иметь печатную плату на продажу.** К сожалению, у собранных вручную клавиатур слишком много вариаций и сложностей.
|
||||
* **Поддерживать вашу клавиатуру в QMK.** Это может потребовать просто начальной настройки, чтобы ваша клавиатура заработала. Но поддержка также может заключаться в адаптации изменений ядра QMK, которые способны сломать или сделать избыточным любой пользовательский код.
|
||||
* **Одобрять и производить слияние пулреквестов для вашей клавиатуры.** Мы призываем пользователей делиться своими раскладками клавиатур, чтобы другие могли их видеть и опираться на них при создании своих собственных.
|
||||
|
||||
Если вы чувствуете, что удовлетворяете этим требованиям, напишите нам письмо по адресу hello@qmk.fm с кратким описанием и ссылками на вашу клавиатуру!
|
58
docs/ru-ru/getting_started_introduction.md
Normal file
58
docs/ru-ru/getting_started_introduction.md
Normal file
@ -0,0 +1,58 @@
|
||||
# Введение
|
||||
|
||||
Эта страница пытается объяснить основную информацию, которую вы должны знать, чтобы работать с проектом QMK. Предполагается, что вы знакомы с навигацией в оболочке Unix, но не предполагается, что вы знакомы с C или с компиляцией с использованием make.
|
||||
|
||||
## Базовая структура QMK
|
||||
|
||||
QMK - это форк [Джуна Вако (Jun Wako)](https://github.com/tmk) проекта [tmk_keyboard](https://github.com/tmk/tmk_keyboard). Оригинальный код TMK с изменениями можно найти в папке `tmk`. Дополнения QMK к проекту можно найти в папке `quantum`. Проекты клавиатур можно найти в папках `handwired` и `keyboard`.
|
||||
|
||||
### Структура пространства пользователя
|
||||
|
||||
Внутри папки `users` находится каталог для каждого пользователя. Это место для пользователей, куда они могут поместить код, чтобы использовать его с разными клавиатурами. Для получения дополнительной информации обратитесь к документации по [функциям пользовательского пространства](ru-ru/feature_userspace.md).
|
||||
|
||||
### Структура проекта клавиатуры
|
||||
|
||||
Внутри папки `keyboards` есть подпапки `handwired` и есть подкаталоги поставщиков и производителей, для примера, `clueboard` - это каталог для каждого проекта клавиатуры, например, `qmk_firmware/keyboards/clueboard/2x1800`. В нем вы найдете следующую структуру:
|
||||
* `keymaps/`: Различные раскладки клавиш, которые можно собрать.
|
||||
* `rules.mk`: Файл, который устанавливает параметры по умолчанию для команды "make". Не редактируйте этот файл напрямую, вместо этого используйте `rules.mk`, относящийся к конкретной раскладке.
|
||||
* `config.h`: Файл, который устанавливает параметры времени компиляции по умолчанию. Не редактируйте этот файл напрямую, вместо этого используйте `config.h`, относящийся к конкретной раскладке.
|
||||
* `info.json`: Файл настройки раскладки для QMK Configurator. Посмотрите [Поддержку конфигуратора](ru-ru/reference_configurator_support.md) для дополнительной информации.
|
||||
* `readme.md`: Краткий обзор клавиатуры.
|
||||
* `<keyboardName>.h`: В этом файле определяется раскладка клавиатуры по матрице переключателей клавиатуры.
|
||||
* `<keyboardName>.c`: В этом файле вы можете найти пользовательский код для клавиатуры.
|
||||
|
||||
Для получения дополнительной информации о структуре проекта обратитесь к [Руководству QMK по клавиатуре](ru-ru/hardware_keyboard_guidelines.md).
|
||||
|
||||
### Структура раскладки клавиатуры
|
||||
|
||||
В каждой папке раскладки клавиатуры могут быть найдены следующие файлы. Обязательным является только файл `keymap.c`, и если остальные файлы не найдены, то будут выбраны параметры по умолчанию.
|
||||
|
||||
* `config.h`: настройки вашей раскладки клавиатуры.
|
||||
* `keymap.c`: весь код вашей раскладки клавиатуры (обязателен).
|
||||
* `rules.mk`: активированные функции QMK.
|
||||
* `readme.md`: описание вашей раскладки клавиш, как ее могут использовать другие, и объяснения функций. Пожалуйста, загрузите изображения на сервис, такой как imgur.
|
||||
|
||||
# Файл `config.h`
|
||||
|
||||
Существует 3 возможных местоположения `config.h`:
|
||||
|
||||
* клавиатура (`/keyboards/<keyboard>/config.h`)
|
||||
* пространство пользователя (`/users/<user>/config.h`)
|
||||
* раскладка клавиш (`/keyboards/<keyboard>/keymaps/<keymap>/config.h`)
|
||||
|
||||
Система сборки автоматически загружает файлы конфигурации в указанном выше порядке. Если вы хотите переопределить любую настройку, заданную предыдущим `config.h`, вам сначала нужно будет включить некоторый шаблонный код для настроек, которые вы хотите изменить.
|
||||
|
||||
```
|
||||
#pragma once
|
||||
```
|
||||
|
||||
Затем, чтобы переопределить настройку из предыдущего файла `config.h`, вы должны сделать `#undef` и `#define` для неё снова.
|
||||
|
||||
Код и настройка шаблона вместе выглядят так:
|
||||
```
|
||||
#pragma once
|
||||
|
||||
// Переопределения производятся здесь!
|
||||
#undef MY_SETTING
|
||||
#define MY_SETTING 4
|
||||
```
|
@ -14,24 +14,31 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Simple analog to digitial conversion
|
||||
|
||||
#include <avr/io.h>
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdint.h>
|
||||
#include "analog.h"
|
||||
|
||||
static uint8_t aref = (1 << REFS0); // default to AREF = Vcc
|
||||
static uint8_t aref = ADC_REF_POWER;
|
||||
|
||||
void analogReference(uint8_t mode) { aref = mode & 0xC0; }
|
||||
void analogReference(uint8_t mode) { aref = mode & (_BV(REFS1) | _BV(REFS0)); }
|
||||
|
||||
// Arduino compatible pin input
|
||||
int16_t analogRead(uint8_t pin) {
|
||||
#if defined(__AVR_ATmega32U4__)
|
||||
static const uint8_t PROGMEM pin_to_mux[] = {0x00, 0x01, 0x04, 0x05, 0x06, 0x07, 0x25, 0x24, 0x23, 0x22, 0x21, 0x20};
|
||||
// clang-format off
|
||||
static const uint8_t PROGMEM pin_to_mux[] = {
|
||||
//A0 A1 A2 A3 A4 A5
|
||||
//F7 F6 F5 F4 F1 F0
|
||||
0x07, 0x06, 0x05, 0x04, 0x01, 0x00,
|
||||
//A6 A7 A8 A9 A10 A11
|
||||
//D4 D7 B4 B5 B6 D6
|
||||
0x20, 0x22, 0x23, 0x24, 0x25, 0x21
|
||||
};
|
||||
// clang-format on
|
||||
if (pin >= 12) return 0;
|
||||
return adc_read(pgm_read_byte(pin_to_mux + pin));
|
||||
#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
|
||||
#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__) || defined(__AVR_ATmega328P__)
|
||||
if (pin >= 8) return 0;
|
||||
return adc_read(pin);
|
||||
#else
|
||||
@ -39,20 +46,87 @@ int16_t analogRead(uint8_t pin) {
|
||||
#endif
|
||||
}
|
||||
|
||||
// Mux input
|
||||
int16_t analogReadPin(pin_t pin) { return adc_read(pinToMux(pin)); }
|
||||
|
||||
uint8_t pinToMux(pin_t pin) {
|
||||
switch (pin) {
|
||||
// clang-format off
|
||||
#if defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__)
|
||||
case F0: return 0; // ADC0
|
||||
case F1: return _BV(MUX0); // ADC1
|
||||
case F2: return _BV(MUX1); // ADC2
|
||||
case F3: return _BV(MUX1) | _BV(MUX0); // ADC3
|
||||
case F4: return _BV(MUX2); // ADC4
|
||||
case F5: return _BV(MUX2) | _BV(MUX0); // ADC5
|
||||
case F6: return _BV(MUX2) | _BV(MUX1); // ADC6
|
||||
case F7: return _BV(MUX2) | _BV(MUX1) | _BV(MUX0); // ADC7
|
||||
default: return _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1) | _BV(MUX0); // 0V
|
||||
#elif defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__)
|
||||
case F0: return 0; // ADC0
|
||||
case F1: return _BV(MUX0); // ADC1
|
||||
case F4: return _BV(MUX2); // ADC4
|
||||
case F5: return _BV(MUX2) | _BV(MUX0); // ADC5
|
||||
case F6: return _BV(MUX2) | _BV(MUX1); // ADC6
|
||||
case F7: return _BV(MUX2) | _BV(MUX1) | _BV(MUX0); // ADC7
|
||||
case D4: return _BV(MUX5); // ADC8
|
||||
case D6: return _BV(MUX5) | _BV(MUX0); // ADC9
|
||||
case D7: return _BV(MUX5) | _BV(MUX1); // ADC10
|
||||
case B4: return _BV(MUX5) | _BV(MUX1) | _BV(MUX0); // ADC11
|
||||
case B5: return _BV(MUX5) | _BV(MUX2); // ADC12
|
||||
case B6: return _BV(MUX5) | _BV(MUX2) | _BV(MUX0); // ADC13
|
||||
default: return _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1) | _BV(MUX0); // 0V
|
||||
#elif defined(__AVR_ATmega32A__)
|
||||
case A0: return 0; // ADC0
|
||||
case A1: return _BV(MUX0); // ADC1
|
||||
case A2: return _BV(MUX1); // ADC2
|
||||
case A3: return _BV(MUX1) | _BV(MUX0); // ADC3
|
||||
case A4: return _BV(MUX2); // ADC4
|
||||
case A5: return _BV(MUX2) | _BV(MUX0); // ADC5
|
||||
case A6: return _BV(MUX2) | _BV(MUX1); // ADC6
|
||||
case A7: return _BV(MUX2) | _BV(MUX1) | _BV(MUX0); // ADC7
|
||||
default: return _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1) | _BV(MUX0); // 0V
|
||||
#elif defined(__AVR_ATmega328P__)
|
||||
case C0: return 0; // ADC0
|
||||
case C1: return _BV(MUX0); // ADC1
|
||||
case C2: return _BV(MUX1); // ADC2
|
||||
case C3: return _BV(MUX1) | _BV(MUX0); // ADC3
|
||||
case C4: return _BV(MUX2); // ADC4
|
||||
case C5: return _BV(MUX2) | _BV(MUX0); // ADC5
|
||||
// ADC7:6 not present in DIP package and not shared by GPIO pins
|
||||
default: return _BV(MUX3) | _BV(MUX2) | _BV(MUX1) | _BV(MUX0); // 0V
|
||||
#endif
|
||||
// clang-format on
|
||||
}
|
||||
}
|
||||
|
||||
int16_t adc_read(uint8_t mux) {
|
||||
#if defined(__AVR_AT90USB162__)
|
||||
return 0;
|
||||
#else
|
||||
uint8_t low;
|
||||
|
||||
ADCSRA = (1 << ADEN) | ADC_PRESCALER; // enable ADC
|
||||
ADCSRB = (1 << ADHSM) | (mux & 0x20); // high speed mode
|
||||
ADMUX = aref | (mux & 0x1F); // configure mux input
|
||||
ADCSRA = (1 << ADEN) | ADC_PRESCALER | (1 << ADSC); // start the conversion
|
||||
while (ADCSRA & (1 << ADSC))
|
||||
; // wait for result
|
||||
low = ADCL; // must read LSB first
|
||||
return (ADCH << 8) | low; // must read MSB only once!
|
||||
// Enable ADC and configure prescaler
|
||||
ADCSRA = _BV(ADEN) | ADC_PRESCALER;
|
||||
|
||||
#if defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__)
|
||||
// High speed mode and ADC8-13
|
||||
ADCSRB = _BV(ADHSM) | (mux & _BV(MUX5));
|
||||
#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__)
|
||||
// High speed mode only
|
||||
ADCSRB = _BV(ADHSM);
|
||||
#endif
|
||||
|
||||
// Configure mux input
|
||||
#if defined(MUX4)
|
||||
ADMUX = aref | (mux & (_BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1) | _BV(MUX0)));
|
||||
#else
|
||||
ADMUX = aref | (mux & (_BV(MUX3) | _BV(MUX2) | _BV(MUX1) | _BV(MUX0)));
|
||||
#endif
|
||||
|
||||
// Start the conversion
|
||||
ADCSRA |= _BV(ADSC);
|
||||
// Wait for result
|
||||
while (ADCSRA & _BV(ADSC))
|
||||
;
|
||||
// Must read LSB first
|
||||
low = ADCL;
|
||||
// Must read MSB only once!
|
||||
return (ADCH << 8) | low;
|
||||
}
|
||||
|
@ -14,45 +14,40 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _analog_h_included__
|
||||
#define _analog_h_included__
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include "quantum.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void analogReference(uint8_t mode);
|
||||
int16_t analogRead(uint8_t pin);
|
||||
|
||||
int16_t analogReadPin(pin_t pin);
|
||||
uint8_t pinToMux(pin_t pin);
|
||||
|
||||
int16_t adc_read(uint8_t mux);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#define ADC_REF_POWER (1 << REFS0)
|
||||
#define ADC_REF_INTERNAL ((1 << REFS1) | (1 << REFS0))
|
||||
#define ADC_REF_EXTERNAL (0)
|
||||
#define ADC_REF_EXTERNAL 0 // AREF, Internal Vref turned off
|
||||
#define ADC_REF_POWER _BV(REFS0) // AVCC with external capacitor on AREF pin
|
||||
#define ADC_REF_INTERNAL (_BV(REFS1) | _BV(REFS0)) // Internal 2.56V Voltage Reference with external capacitor on AREF pin (1.1V for 328P)
|
||||
|
||||
// These prescaler values are for high speed mode, ADHSM = 1
|
||||
#if F_CPU == 16000000L
|
||||
# define ADC_PRESCALER ((1 << ADPS2) | (1 << ADPS1))
|
||||
#if F_CPU == 16000000L || F_CPU == 12000000L
|
||||
# define ADC_PRESCALER (_BV(ADPS2) | _BV(ADPS1)) // /64
|
||||
#elif F_CPU == 8000000L
|
||||
# define ADC_PRESCALER ((1 << ADPS2) | (1 << ADPS0))
|
||||
# define ADC_PRESCALER (_BV(ADPS2) | _BV(ADPS0)) // /32
|
||||
#elif F_CPU == 4000000L
|
||||
# define ADC_PRESCALER ((1 << ADPS2))
|
||||
# define ADC_PRESCALER (_BV(ADPS2)) // /16
|
||||
#elif F_CPU == 2000000L
|
||||
# define ADC_PRESCALER ((1 << ADPS1) | (1 << ADPS0))
|
||||
# define ADC_PRESCALER (_BV(ADPS1) | _BV(ADPS0)) // /8
|
||||
#elif F_CPU == 1000000L
|
||||
# define ADC_PRESCALER ((1 << ADPS1))
|
||||
# define ADC_PRESCALER _BV(ADPS1) // /4
|
||||
#else
|
||||
# define ADC_PRESCALER ((1 << ADPS0))
|
||||
#endif
|
||||
|
||||
// some avr-libc versions do not properly define ADHSM
|
||||
#if defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
|
||||
# if !defined(ADHSM)
|
||||
# define ADHSM (7)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# define ADC_PRESCALER _BV(ADPS0) // /2
|
||||
#endif
|
||||
|
@ -76,3 +76,20 @@ uint8_t pca9555_readPins(uint8_t slave_addr, uint8_t port) {
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
uint16_t pca9555_readAllPins(uint8_t slave_addr) {
|
||||
uint8_t addr = SLAVE_TO_ADDR(slave_addr);
|
||||
|
||||
typedef union {
|
||||
uint8_t u8[2];
|
||||
uint16_t u16;
|
||||
} data16;
|
||||
|
||||
data16 data;
|
||||
|
||||
i2c_status_t ret = i2c_readReg(addr, CMD_INPUT_0, &data.u8[0], sizeof(data), TIMEOUT);
|
||||
if (ret != I2C_STATUS_SUCCESS) {
|
||||
print("pca9555_readAllPins::FAILED\n");
|
||||
}
|
||||
return data.u16;
|
||||
}
|
||||
|
@ -53,3 +53,5 @@ void pca9555_set_config(uint8_t slave_addr, uint8_t port, uint8_t conf);
|
||||
void pca9555_set_output(uint8_t slave_addr, uint8_t port, uint8_t conf);
|
||||
|
||||
uint8_t pca9555_readPins(uint8_t slave_addr, uint8_t port);
|
||||
|
||||
uint16_t pca9555_readAllPins(uint8_t slave_addr);
|
||||
|
@ -54,7 +54,7 @@ bool is_keyboard_master(void)
|
||||
}
|
||||
|
||||
static void keyboard_master_setup(void) {
|
||||
#if defined(USE_I2C) || defined(EH)
|
||||
#if defined(USE_I2C)
|
||||
#ifdef SSD1306OLED
|
||||
matrix_master_OLED_init ();
|
||||
#endif
|
||||
|
@ -18,7 +18,7 @@
|
||||
extern backlight_config_t backlight_config;
|
||||
#endif
|
||||
|
||||
#if defined(USE_I2C) || defined(EH)
|
||||
#if defined(USE_I2C)
|
||||
|
||||
#include "i2c.h"
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user