aboutsummaryrefslogtreecommitdiff
path: root/docs/zh-cn
diff options
context:
space:
mode:
authorymzcdg <49898694+ymzcdg@users.noreply.github.com>2019-06-05 02:06:17 +0800
committerMechMerlin <30334081+mechmerlin@users.noreply.github.com>2019-06-04 11:06:17 -0700
commite0a0d80bd329b4a289e3c4f817c96857c25b0f16 (patch)
tree88d7f5693ec3afc041589d7968da4be595c897ad /docs/zh-cn
parente7711b3b665c7df0a2a1d7272580cc01be28590d (diff)
downloadqmk_firmware-e0a0d80bd329b4a289e3c4f817c96857c25b0f16.tar.gz
qmk_firmware-e0a0d80bd329b4a289e3c4f817c96857c25b0f16.zip
docs to Mandarin Chinese (#5960)
* faq_general.md to Chinese faq_general.md to Chinese faq finished * custom_quantum_functions.md to Chinese custom_quantum_functions.md to Chinese * custom_quantum_functions.md fix custom_quantum_functions.md fix * custom_quantum_functions.md fix translate custom_quantum_functions.md fix translate * !ver.English! _summary.md bug fix _summary.md bug fix of English doc. add".md" behind "feature_combo" * !ver.English! custom_quantum_functions.md fix#5869 custom_quantum_functions.md in English : delete redundant "is" . issue#5869 * !ver.English! how_keyboards_work.md link fix change https://en.wikipedia.org/wiki/Unicode_input#Hexadecimal_code_input to https://en.wikipedia.org/wiki/Unicode_input#Hexadecimal_input "#Hexadecimal_code_input" not exist * !English! how_keyboards_work.md add missing "t" Tied to a specific OS a a time (need recompilation when changing OS); change to Tied to a specific OS at a time (need recompilation when changing OS); * _summary.md improve translation _summary.md improve translation * reference_glossary.md into Chinese reference_glossary.md into Chinese 术语表翻译,这个术语表英文版似乎不太全,应该补充英文版,并在中文版添加其他具有中国特色的术语。
Diffstat (limited to 'docs/zh-cn')
-rw-r--r--docs/zh-cn/_summary.md66
-rw-r--r--docs/zh-cn/custom_quantum_functions.md490
-rw-r--r--docs/zh-cn/faq_general.md19
-rw-r--r--docs/zh-cn/reference_glossary.md170
4 files changed, 712 insertions, 33 deletions
diff --git a/docs/zh-cn/_summary.md b/docs/zh-cn/_summary.md
index df25a3ccd..b0d9f1c06 100644
--- a/docs/zh-cn/_summary.md
+++ b/docs/zh-cn/_summary.md
@@ -7,27 +7,27 @@
7 * [学习资源](newbs_learn_more_resources.md) 7 * [学习资源](newbs_learn_more_resources.md)
8 8
9* [QMK基础](README.md) 9* [QMK基础](README.md)
10 * [QMK 简介](getting_started_introduction.md) 10 * [QMK简介](getting_started_introduction.md)
11 * [贡献 QMK](contributing.md) 11 * [向QMK贡献](contributing.md)
12 * [如何使用Github](getting_started_github.md) 12 * [如何使用Github](getting_started_github.md)
13 * [获得帮助](getting_started_getting_help.md) 13 * [获得帮助](getting_started_getting_help.md)
14 14
15* [问题解答](faq.md) 15* [问题解答](faq.md)
16 * [一般问题](faq_general.md) 16 * [一般问题](faq_general.md)
17 * [构建/编译QMK](faq_build.md) 17 * [构建/编译](faq_build.md)
18 * [调试/故障排除 QMK](faq_debug.md) 18 * [调试/故障排除](faq_debug.md)
19 * [键盘](faq_keymap.md) 19 * [键盘](faq_keymap.md)
20 20
21* 详细指南 21* 详细指南
22 * [安装构建工具](getting_started_build_tools.md) 22 * [安装构建工具](getting_started_build_tools.md)
23 * [浪者南](getting_started_vagrant.md) 23 * [vagrant指南](getting_started_vagrant.md)
24 * [构建/编译指令](getting_started_make_guide.md) 24 * [构建/编译指令](getting_started_make_guide.md)
25 * [刷新固件](flashing.md) 25 * [刷新固件](flashing.md)
26 * [定制功能](custom_quantum_functions.md) 26 * [定制功能](custom_quantum_functions.md)
27 * [概述](keymap.md) 27 * [概述](keymap.md)
28 28
29* [硬件](hardware.md) 29* [硬件](hardware.md)
30 * [AVR 处理器](hardware_avr.md) 30 * [AVR处理器](hardware_avr.md)
31 * [驱动](hardware_drivers.md) 31 * [驱动](hardware_drivers.md)
32 32
33* 参考 33* 参考
@@ -35,8 +35,8 @@
35 * [配置选项](config_options.md) 35 * [配置选项](config_options.md)
36 * [键码](keycodes.md) 36 * [键码](keycodes.md)
37 * [记录最佳实践](documentation_best_practices.md) 37 * [记录最佳实践](documentation_best_practices.md)
38 * [文档](documentation_templates.md) 38 * [文档](documentation_templates.md)
39 * [表](reference_glossary.md) 39 * [表](reference_glossary.md)
40 * [单元测试](unit_testing.md) 40 * [单元测试](unit_testing.md)
41 * [有用的功能](ref_functions.md) 41 * [有用的功能](ref_functions.md)
42 * [配置器支持](reference_configurator_support.md) 42 * [配置器支持](reference_configurator_support.md)
@@ -44,35 +44,35 @@
44 44
45* [特性](features.md) 45* [特性](features.md)
46 * [基本键码](keycodes_basic.md) 46 * [基本键码](keycodes_basic.md)
47 * [US ANSI 控制](keycodes_us_ansi_shifted.md) 47 * [US ANSI控制](keycodes_us_ansi_shifted.md)
48 * [量子键码](quantum_keycodes.md) 48 * [量子键码](quantum_keycodes.md)
49 * [高级键码](feature_advanced_keycodes.md) 49 * [高级键码](feature_advanced_keycodes.md)
50 * [音频](feature_audio.md) 50 * [音频](feature_audio.md)
51 * [自动控制](feature_auto_shift.md) 51 * [自动shift](feature_auto_shift.md)
52 * [背光](feature_backlight.md) 52 * [背光](feature_backlight.md)
53 * [蓝牙](feature_bluetooth.md) 53 * [蓝牙](feature_bluetooth.md)
54 * [Bootmagic](feature_bootmagic.md) 54 * [热改键](feature_bootmagic.md)
55 * [组合](feature_combo) 55 * [组合](feature_combo)
56 * [命令](feature_command.md) 56 * [命令](feature_command.md)
57 * [动态宏指令](feature_dynamic_macros.md) 57 * [动态宏指令](feature_dynamic_macros.md)
58 * [编码器](feature_encoders.md) 58 * [编码器](feature_encoders.md)
59 * [Grave Escape](feature_grave_esc.md) 59 * [重音号Esc复合键](feature_grave_esc.md)
60 * [](feature_key_lock.md) 60 * [](feature_key_lock.md)
61 * [](feature_layouts.md) 61 * [](feature_layouts.md)
62 * [导键](feature_leader_key.md) 62 * [导键](feature_leader_key.md)
63 * [LED 阵列](feature_led_matrix.md) 63 * [LED阵列](feature_led_matrix.md)
64 * [宏指令](feature_macros.md) 64 * [宏指令](feature_macros.md)
65 * [鼠标键](feature_mouse_keys.md) 65 * [鼠标键](feature_mouse_keys.md)
66 * [一键功能](feature_advanced_keycodes.md#one-shot-keys) 66 * [一键功能](feature_advanced_keycodes.md#one-shot-keys)
67 * [指针设备](feature_pointing_device.md) 67 * [指针设备](feature_pointing_device.md)
68 * [PS/2 鼠标](feature_ps2_mouse.md) 68 * [PS/2鼠标](feature_ps2_mouse.md)
69 * [RGB 光](feature_rgblight.md) 69 * [RGB光](feature_rgblight.md)
70 * [RGB 矩阵](feature_rgb_matrix.md) 70 * [RGB矩阵](feature_rgb_matrix.md)
71 * [空格候补换挡](feature_space_cadet_shift.md) 71 * [空格候补换挡](feature_space_cadet_shift.md)
72 * [空格候补换挡回车](feature_space_cadet_shift_enter.md) 72 * [空格候补换挡回车](feature_space_cadet_shift_enter.md)
73 * [速录机](feature_stenography.md) 73 * [速录机](feature_stenography.md)
74 * [换手](feature_swap_hands.md) 74 * [换手](feature_swap_hands.md)
75 * [踢踏舞](feature_tap_dance.md) 75 * [多击键](feature_tap_dance.md)
76 * [终端](feature_terminal.md) 76 * [终端](feature_terminal.md)
77 * [热敏打印机](feature_thermal_printer.md) 77 * [热敏打印机](feature_thermal_printer.md)
78 * [Unicode](feature_unicode.md) 78 * [Unicode](feature_unicode.md)
@@ -80,16 +80,16 @@
80 * [速度键](feature_velocikey.md) 80 * [速度键](feature_velocikey.md)
81 81
82* 针对制造者和定制者 82* 针对制造者和定制者
83 * [线指南](hand_wire.md) 83 * [手工线指南](hand_wire.md)
84 * [ISP 刷新指南](isp_flashing_guide.md) 84 * [ISP刷新指南](isp_flashing_guide.md)
85 * [ARM 调试指南](arm_debugging.md) 85 * [ARM调试指南](arm_debugging.md)
86 * [I2C 驱动](i2c_driver.md) 86 * [I2C驱动](i2c_driver.md)
87 * [GPIO 控制器](internals_gpio_control.md) 87 * [GPIO控制器](internals_gpio_control.md)
88 * [Proton C 转换](proton_c_conversion.md) 88 * [Proton C转换](proton_c_conversion.md)
89 89
90* 深入了解 90* 深入了解
91 * [键盘如何工作](how_keyboards_work.md) 91 * [键盘如何工作](how_keyboards_work.md)
92 * [理解 QMK](understanding_qmk.md) 92 * [理解QMK](understanding_qmk.md)
93 93
94* 其他话题 94* 其他话题
95 * [使用Eclipse开发QMK](other_eclipse.md) 95 * [使用Eclipse开发QMK](other_eclipse.md)
@@ -99,8 +99,8 @@
99* QMK 内构 (正在编写) 99* QMK 内构 (正在编写)
100 * [定义](internals_defines.md) 100 * [定义](internals_defines.md)
101 * [输入回调寄存器](internals_input_callback_reg.md) 101 * [输入回调寄存器](internals_input_callback_reg.md)
102 * [Midi 设备](internals_midi_device.md) 102 * [Midi设备](internals_midi_device.md)
103 * [Midi 设备设置过程](internals_midi_device_setup_process.md) 103 * [Midi设备设置过程](internals_midi_device_setup_process.md)
104 * [Midi 工具库](internals_midi_util.md) 104 * [Midi工具库](internals_midi_util.md)
105 * [发送函数](internals_send_functions.md) 105 * [发送函数](internals_send_functions.md)
106 * [Sysex 工具](internals_sysex_tools.md) 106 * [Sysex工具](internals_sysex_tools.md)
diff --git a/docs/zh-cn/custom_quantum_functions.md b/docs/zh-cn/custom_quantum_functions.md
new file mode 100644
index 000000000..42ceba9ca
--- /dev/null
+++ b/docs/zh-cn/custom_quantum_functions.md
@@ -0,0 +1,490 @@
1# ζ̵Ĺ
2
3ںܶ˵ƻ̿ɲֻĵԷ㰴Ǹô򵥡϶ʵֱȼ򵥰ͺӵĹܡQMKעĹ, ǹ, ⣬ԶڲͬµΪ
4
5ҳٶκQMK֪ʶĶ[QMK](understanding_qmk.md)ڸIJⷢʲô
6
7## A Word on Core vs vs
8
9ǰqmk֯һνṹ
10
11* Core (`_quantum`)
12 * Keyboard/Revision (`_kb`)
13 * Keymap (`_user`)
14
15ÿһڶϼһ`_kb()` `_user()` ׺ ڼ/޶ʹ`_kb()`׺ڲֲʹ`_user()`׺
16
17ڼ/޶㶨庯ʱ`_kb()`ִκδǰȵ`_user()`DZҪģȻֲ㺯ͲҪá
18<!-- ⣺Ǿ䷭IJ̫-->
19# Զ
20
21ĿǰΪֹǸмΪ򴴽µļ롣ӴǶЩơ
22
23## һ¼
24
25һöٳȫҲǸֲΨһֵQMKûֱֵСṩһ`SAFE_RANGE`ꡣöʱ`SAFE_RANGE`֤ȡΨһļֵ
26
27
28öӡӵ`keymap.c`Ļڲ`FOO``BAR`ˡ
29
30```c
31enum my_keycodes {
32 FOO = SAFE_RANGE,
33 BAR
34};
35```
36
37## ΪΪ
38
39㸲һѴڰΪʱΪ¼ʱҪ`process_record_kb()``process_record_user()`ڼʵ¼ǰQMKá`true`QMKķʽ롣ԺܷչĹܶ滻`false` QMKȻͼ̧ǰ¼ˡ
40
41ij»ͷʱᱻá
42
43### process_record_user()`ʾʵ
44
45¡Զһ`FOO`ļΪڰ»سʱ
46
47```c
48bool process_record_user(uint16_t keycode, keyrecord_t *record) {
49 switch (keycode) {
50 case FOO:
51 if (record->event.pressed) {
52 // ʱЩʲô
53 } else {
54 // ͷʱЩʲô
55 }
56 return false; // ˼нһ
57 case KC_ENTER:
58 // »سʱ
59 if (record->event.pressed) {
60 PLAY_NOTE_ARRAY(tone_qwerty);
61 }
62 return true; // QMKس/ͷ¼
63 default:
64 return true; //
65 }
66}
67```
68
69### `process_record_*` ĵ
70
71* /޶: `bool process_record_kb(uint16_t keycode, keyrecord_t *record)`
72* : `bool process_record_user(uint16_t keycode, keyrecord_t *record)`
73
74`keycode()`ڲ϶ģ`MO(1)`, `KC_L`, ȵȡ Ҫ `switch...case` Щ¼
75
76`record`ʵʰϢ
77
78```c
79keyrecord_t record {
80 keyevent_t event {
81 keypos_t key {
82 uint8_t col
83 uint8_t row
84 }
85 bool pressed
86 uint16_t time
87 }
88}
89```
90
91# LED
92
93qmkṩ˶ȡHID淶5LEDķ:
94
95* `USB_LED_NUM_LOCK`
96* `USB_LED_CAPS_LOCK`
97* `USB_LED_SCROLL_LOCK`
98* `USB_LED_COMPOSE`
99* `USB_LED_KANA`
100
101ӦLED״̬λλ
102ַԻLED״̬
103
104* ִͨ `led_set_user()`
105* ͨ `host_keyboard_leds()`
106
107## `led_set_user()`
108
1095LEDκһ״̬Ҫıʱ˺á˺ͨLED
110ʹ`IS_LED_ON(usb_led, led_name)``IS_LED_OFF(usb_led, led_name)`LED״̬
111
112!> `host_keyboard_leds()`ܻ`led_set_user()`ǰֵ
113
114### `led_set_user()`ʾʵ
115
116```c
117void led_set_user(uint8_t usb_led) {
118 if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) {
119 writePinLow(B0);
120 } else {
121 writePinHigh(B0);
122 }
123 if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
124 writePinLow(B1);
125 } else {
126 writePinHigh(B1);
127 }
128 if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) {
129 writePinLow(B2);
130 } else {
131 writePinHigh(B2);
132 }
133 if (IS_LED_ON(usb_led, USB_LED_COMPOSE)) {
134 writePinLow(B3);
135 } else {
136 writePinHigh(B3);
137 }
138 if (IS_LED_ON(usb_led, USB_LED_KANA)) {
139 writePinLow(B4);
140 } else {
141 writePinHigh(B4);
142 }
143}
144```
145
146### `led_set_*`ĵ
147
148* /޶: `void led_set_kb(uint8_t usb_led)`
149* : `void led_set_user(uint8_t usb_led)`
150
151## `host_keyboard_leds()`
152
153᷵յLED״̬`led_set_*`֮ȡLED״̬ʱã[`matrix_scan_user()`](#ɨ).
154Ϊ˱ݣ`IS_HOST_LED_ON(led_name)``IS_HOST_LED_OFF(led_name)` ֱ꣬ӵúͼ`host_keyboard_leds()`
155
156## LED״̬
157
158һЩʵΪLED״̬ṩ˷ķ
159
160### Ergodox Boards
161
162Ergodoxʵṩ`ergodox_right_led_1`/`2`/`3_on`/`off()`ÿLED, Ҳ `ergodox_right_led_on`/`off(uint8_t led)` 򿪻رǡ
163
164⣬ʹ`ergodox_led_all_set(uint8_t n)`ָLEDȼÿLED`ergodox_right_led_1`/`2`/`3_set(uint8_t n)`ʹĻ`ergodox_right_led_set(uint8_t led, uint8_t n)`
165
166Ergodox boards ͬʱȼ`LED_BRIGHTNESS_LO`ȼ`LED_BRIGHTNESS_HI`(Ĭ).
167
168# ̳ʼ
169
170̳ʼм衣ǸȡҪʲô
171
172Ҫʼ˳г
173
174* `keyboard_pre_init_*` - ڴǰСЩҪǰеӲʼ
175* `matrix_init_*` - ڹ̼м䱻áʱӲѳʼδʼ
176* `keyboard_post_init_*` - ڹ̼󱻵á£ġƻ붼Է
177
178!> ڴ˵`keyboard_post_init_user`Ҫõĺ, ʱRGBƷ⡣
179
180## Ԥʼ
181
182뼫УUSBʼǰС
183
184֮󲻾þͱʼˡ
185
186ڴû˵,òΪҪӲijʼ
187
188ӲʼĻٺò(ʼLEDһ).
189
190### `keyboard_pre_init_user()`ʾʵ
191
192ڼ̼趨 B0, B1, B2, B3, B4 LEDš
193
194```c
195void keyboard_pre_init_user(void) {
196 // üԤʼ
197
198 // LEDΪģʽ
199 setPinOutput(B0);
200 setPinOutput(B1);
201 setPinOutput(B2);
202 setPinOutput(B3);
203 setPinOutput(B4);
204}
205```
206
207### `keyboard_pre_init_*` ĵ
208
209* /޶: `void keyboard_pre_init_kb(void)`
210* : `void keyboard_pre_init_user(void)`
211
212## ʼ
213
214⽫ھʼʱãijЩӲúú󣬵һЩܱʼǰ
215
216طõĶʱãӲ޹أҲλá
217
218
219### `matrix_init_*`ĵ
220
221* /޶: `void matrix_init_kb(void)`
222* : `void matrix_init_user(void)`
223
224
225## ̺ʼ
226
227Ǽ̳ʼеһijЩԣãΪʱӦöǽгʼ
228
229
230### `keyboard_post_init_user()`ʾʵ
231
232ʾгʼɺУRGBơ
233
234```c
235void keyboard_post_init_user(void) {
236 // úʼ
237 rgblight_enable_noeeprom(); // ʹRgb
238 rgblight_sethsv_noeeprom(180, 255, 255); // ɫõɫ(ɫ)
239 rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING + 3); // ÿٺģʽ
240}
241```
242
243### `keyboard_post_init_*` ĵ
244
245* /޶: `void keyboard_post_init_kb(void)`
246* : `void keyboard_post_init_user(void)`
247
248# ɨ
249
250ܵĻҪ`process_record_*()`Զַ̣ʽӵ¼Уȷ벻Լ̲Ӱ졣Ȼڼ£бҪоɨ衣ЩҪرעܣΪÿٱ10Ρ
251
252### `matrix_scan_*`ʾʵ
253
254ӱʡˡhookһܼе֮ǰӦ㹻˽qmkڲṹԱûʾ±дҪ[һissue](https://github.com/qmk/qmk_firmware/issues/new)[Discordǽ](https://discord.gg/Uq7gcHh).
255
256### `matrix_scan_*` ĵ
257
258* /޶: `void matrix_scan_kb(void)`
259* : `void matrix_scan_user(void)`
260
261úÿξɨʱãMCUͬдҪΪкܶΡ
262
263ԶɨʱõҲԶ״̬(LEDƻĻ)ûҲ붨еĹܡ
264
265
266# /
267
268֧־ͿֹͨͣһƱﵽ""RGBƺͱǺܺõӡԽԼܺģҲ̷ζѡ
269
270: `suspend_power_down_*``suspend_wakeup_init_*`, ֱϵͳкͻʱá
271
272
273### suspend_power_down_user()suspend_wakeup_init_user()ʾʵ
274
275
276```c
277void suspend_power_down_user(void) {
278 rgb_matrix_set_suspend_state(true);
279}
280
281void suspend_wakeup_init_user(void) {
282 rgb_matrix_set_suspend_state(false);
283}
284```
285
286### / ĵ
287
288* /޶: `void suspend_power_down_kb(void)` `void suspend_wakeup_init_user(void)`
289* : `void suspend_power_down_kb(void)` `void suspend_wakeup_init_user(void)`
290
291# ı
292
293ÿıд롣ڲָʾԶ㴦á
294
295### `layer_state_set_*` ʾʵ
296
297ʹPlanckʾ [RGB](feature_rgblight.md)ʹ֮Ӧ
298
299```c
300uint32_t layer_state_set_user(uint32_t state) {
301 switch (biton32(state)) {
302 case _RAISE:
303 rgblight_setrgb (0x00, 0x00, 0xFF);
304 break;
305 case _LOWER:
306 rgblight_setrgb (0xFF, 0x00, 0x00);
307 break;
308 case _PLOVER:
309 rgblight_setrgb (0x00, 0xFF, 0x00);
310 break;
311 case _ADJUST:
312 rgblight_setrgb (0x7A, 0x00, 0xFF);
313 break;
314 default: // for any other layers, or the default layer
315 rgblight_setrgb (0x00, 0xFF, 0xFF);
316 break;
317 }
318 return state;
319}
320```
321### `layer_state_set_*` ĵ
322
323* /޶: `uint32_t layer_state_set_kb(uint32_t state)`
324* : `uint32_t layer_state_set_user(uint32_t state)`
325
326
327`״̬`ǻbitmask, [ָ](keymap.md#ֵIJ״̬)
328
329
330# 籣 (EEPROM)
331
332óڵıڼСЩñصEEPROM粻ʧ ÿ`eeconfig_read_kb``eeconfig_read_user`ȡ`eeconfig_update_kb``eeconfig_update_user`д롣ϣܹлĹܺ(лRGBָʾ⣬`eeconfig_init_kb``eeconfig_init_user`EEPROMĬֵ
333
334ӵIJֿǣкܶ෽ͨEEPROM洢ͷݣҲûַǡȷġÿֻһ˫(ֽ)ռ䡣
335
336סEEPROMдġдܸߣDzֻдEEPROMСдƵMCU̡
337
338* ӣôϣʹԣΪ൱ӡ
339
340### ʾʵ
341
342ãҶдʹû֡һӵĺкܶҪʵϣʹ˺ܶ
343
344
345keymap.cļУ´:
346```c
347typedef union {
348 uint32_t raw;
349 struct {
350 bool rgb_layer_change :1;
351 };
352} user_config_t;
353
354user_config_t user_config;
355```
356
357ϴ뽨һṹ壬ýṹԴ洢òдEEPROM㽫趨ΪڽṹȻ塣Ҫס`bool` ()ֵʹ1λ, `uint8_t`ʹ8λ, `uint16_t`ʹ16λԻϴʹã˳Ǵܻ鷳Ϊǻıддֵ
358
359 `layer_state_set_*`ʹ`rgb_layer_change`ʹ`keyboard_post_init_user``process_record_user`һС
360
361Ҫʹ`keyboard_post_init_userҪ`eeconfig_read_user()`ոմĽṹ塣ȻʹṹIJеĹܡ
362```c
363void keyboard_post_init_user(void) {
364 // òּľʼ
365
366 // EEPROMû
367 user_config.raw = eeconfig_read_user();
368
369 // ʹܣĬϲ
370 if (user_config.rgb_layer_change) {
371 rgblight_enable_noeeprom();
372 rgblight_sethsv_noeeprom_cyan();
373 rgblight_mode_noeeprom(1);
374 }
375}
376```
377ϺڶEEPROMúʹøĬϲRGBɫ"raw"ֵǴ"union"Ľṹתġ
378
379```c
380uint32_t layer_state_set_user(uint32_t state) {
381 switch (biton32(state)) {
382 case _RAISE:
383 if (user_config.rgb_layer_change) { rgblight_sethsv_noeeprom_magenta(); rgblight_mode_noeeprom(1); }
384 break;
385 case _LOWER:
386 if (user_config.rgb_layer_change) { rgblight_sethsv_noeeprom_red(); rgblight_mode_noeeprom(1); }
387 break;
388 case _PLOVER:
389 if (user_config.rgb_layer_change) { rgblight_sethsv_noeeprom_green(); rgblight_mode_noeeprom(1); }
390 break;
391 case _ADJUST:
392 if (user_config.rgb_layer_change) { rgblight_sethsv_noeeprom_white(); rgblight_mode_noeeprom(1); }
393 break;
394 default: // Ĭϲ
395 if (user_config.rgb_layer_change) { rgblight_sethsv_noeeprom_cyan(); rgblight_mode_noeeprom(1); }
396 break;
397 }
398 return state;
399}
400```
401ֵʹʱıRGBơֵ, Ϊ`process_record_user`һ¼`RGB_LYR`ҪȷʹRGB룬ʹʾرգ뽫Ϊ
402```c
403
404bool process_record_user(uint16_t keycode, keyrecord_t *record) {
405 switch (keycode) {
406 case FOO:
407 if (record->event.pressed) {
408 // ʱʲô
409 } else {
410 // ͷʱʲô
411 }
412 return false; // ˼Ľһ
413 case KC_ENTER:
414 // ڰ»سʱ
415 if (record->event.pressed) {
416 PLAY_NOTE_ARRAY(tone_qwerty);
417 }
418 return true; // QMKس/ͷ¼
419 case RGB_LYR: // underglowΪָʾʹá
420 if (record->event.pressed) {
421 user_config.rgb_layer_change ^= 1; // л״̬
422 eeconfig_update_user(user_config.raw); // EEPROMд״̬
423 if (user_config.rgb_layer_change) { // ״̬ʹ
424 layer_state_set(layer_state); // ô̸²ɫ
425 }
426 }
427 return false; break;
428 case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // еRGB (see quantum_keycodes.h, L400 Բο)
429 if (record->event.pressed) { //ʧָܲʾıҪ
430 if (user_config.rgb_layer_change) { // ʹʱ
431 user_config.rgb_layer_change = false; // ʧܣȻ
432 eeconfig_update_user(user_config.raw); // EEPROMд
433 }
434 }
435 return true; break;
436 default:
437 return true; //
438 }
439}
440```
441Ҫ`eeconfig_init_user`ԵEEPROMʱָĬֵ, ԶǿEEPROM`EEP_RST`[Bootmagic](feature_bootmagic.md)磬ҪĬRGBָʾĬֵ
442
443```c
444void eeconfig_init_user(void) { // EEPROM
445 user_config.raw = 0;
446 user_config.rgb_layer_change = true; // ҪĬʹ
447 eeconfig_update_user(user_config.raw); // EEPROMдĬֵ
448
449 // use the non noeeprom versions, ҪEEPROMдЩֵ
450 rgblight_enable(); // ĬʹRGB
451 rgblight_sethsv_cyan(); // Ĭɫ
452 rgblight_mode(1); // Ĭó
453}
454```
455
456ȻˡRGBָʾʱûһֱ棬¼̡ʹRGB룬ָʾʧܣˡ
457
458### 'EECONFIG' ĵ
459
460* /޶: `void eeconfig_init_kb(void)`, `uint32_t eeconfig_read_kb(void)``void eeconfig_update_kb(uint32_t val)`
461* : `void eeconfig_init_user(void)`, `uint32_t eeconfig_read_user(void)``void eeconfig_update_user(uint32_t val)`
462
463`val` дEEPROMֵ`eeconfig_read_*`EEPROMһ32λ(˫)ֵ
464
465# Զ-ٽֵ(TAPPING_TERM)
466Ĭ,-ٽֵȫͳһģҲͨáڴû˵ܺáЩ£`LT`˵ʱ˫ܼ󣬿ΪЩļװסΪ˲ÿԶ룬ܿΪÿ`TAPPING_TERM`
467
468ʹܵĻ, Ҫ`config.h``#define TAPPING_TERM_PER_KEY`
469
470
471## `get_tapping_term`ʾʵ
472
473Ҫ޸Ļڼ`TAPPING TERM`,Ҫ`keymap.c`ļ´:
474
475```c
476uint16_t get_tapping_term(uint16_t keycode) {
477 switch (keycode) {
478 case SFT_T(KC_SPC):
479 return TAPPING_TERM + 1250;
480 case LT(1, KC_GRV):
481 return 130;
482 default:
483 return TAPPING_TERM;
484 }
485}
486```
487
488### `get_tapping_term` ĵ
489
490ƪ,Ҫquantum߼̼ĺֻҪûɡ
diff --git a/docs/zh-cn/faq_general.md b/docs/zh-cn/faq_general.md
new file mode 100644
index 000000000..4949acb8c
--- /dev/null
+++ b/docs/zh-cn/faq_general.md
@@ -0,0 +1,19 @@
1#
2
3## QMKʲô?
4
5[QMK](https://github.com/qmk), ӻе(Quantum Mechanical Keyboard)дһȺԴΪƼ̿ĹߡǴ[QMK̼](https://github.com/qmk/qmk_firmware)ʼ[TMK](https://github.com/tmk/tmk_keyboard)ħķֲ档
6
7### Ϊʲô(Quantum)?
8
9<!-- ޸ ²ۣĵ߾ȻҲ֪Ϊɶ -->
10
11## QMKTMKʲô?
12
13TMK[Jun Wako](https://github.com/tmk)ƺִСQMKʼ[Jack Humbert](https://github.com/jackhumbert)ΪPlanck̴TMKֲ档һʱJackķֲͺTMKȥԶˣ2015꣬JackQMK
14
15Ӽ۵QMKTMKһЩ¹ܶɵġQMKչ˿õļ룬ʹ߼ܽһḻ `S()`, `LCTL()`, `MO()`ȫ[](keycodes.md).
16
17ӹ̵TMKԼάйٷֵ֧ļֻ̣кСһ֧֡άѴڷֲΪ̴ķֲ档Ĭֺ֧ٵļ룬ûͨ˷֡QMKͨйֺֿͼ̣ǻз׼PRͼı֤άͬʱQMKСҲڱҪʱ
18
19ַŵȱ㣬ҴʱTMKQMK֮
diff --git a/docs/zh-cn/reference_glossary.md b/docs/zh-cn/reference_glossary.md
new file mode 100644
index 000000000..7b9adcc2a
--- /dev/null
+++ b/docs/zh-cn/reference_glossary.md
@@ -0,0 +1,170 @@
1# QMK术语表
2
3## ARM
4多家公司生产的32位单片机系列,例如Atmel, Cypress, Kinetis, NXP, ST, 和 TI等公司。
5
6## AVR
7[Atmel](http://www.microchip.com/)公司的单片机系列。 AVR是TMK的初始支持平台。
8
9## AZERTY
10Français (法国)标准键盘布局。用键盘的前六个字母命名。
11
12## Backlight(背光)
13键盘上照明的通称。背光通常是一组LED灯,通过键帽或者按轴发光,但也不总是这样。
14
15## Bluetooth(蓝牙)
16一种短距离点对点无线协议。许多多无线键盘使用此协议。
17
18## Bootloader(引导加载程序)
19一种写到你单片机的保护区的特殊的程序,该程序可以使单片机升级自己的固件,通常是通过USB来升级。
20
21## Bootmagic(热改键)
22允许各种键盘行为动态变化的功能,如交换或禁用常用键。
23
24## C
25一种适用于系统代码的低级编程语言。大多数qmk代码是用C编写的。
26
27## Colemak
28一种流行的键盘布局。
29
30## Compile(编译)
31把人可读的代码转换成你的单片机可以运行的机器代码的过程。
32
33## Dvorak
34一个由August Dvorak博士在20世纪30年代创建的布局。Dvorak简化键盘(Dvorak Simplified Keyboard)的缩写。
35
36## Dynamic Macro(动态宏)
37一种记录在键盘上的宏,当键盘拔出或计算机重新启动时,宏将丢失。
38
39* [动态宏文档](feature_dynamic_macros.md)
40
41## Eclipse
42是一种受C语言开发者追捧的集成开发环境(IDE)。
43
44* [Eclipse安装说明](eclipse.md)
45
46## Firmware(固件)
47用来控制单片机的软件。
48
49## FLIP
50爱特梅尔(Atmel)提供的AVR器件刷写软件。我们一般推荐 [QMK刷写工具](https://github.com/qmk/qmk_flasher),但是对于一些高级用例,需要FLIP。
51
52## git
53命令行版本控制软件
54
55## GitHub
56负责大多数QMK项目的网站。它是Git、问题跟踪和其他帮助我们运行qmk的功能的集成平台。
57
58## ISP(在系统编程)
59在系统编程(In-system programming), 使用外部硬件和JTAG管脚对AVR芯片进行编程的一种方法。
60
61## hid_listen
62从键盘接收调试消息的接口。 您可以使用[QMK Flasher](https://github.com/qmk/qmk_flasher)或[PJRC's hid_listen](https://www.pjrc.com/teensy/hid_listen.html)查看这些消息
63
64## Keycode(键码)
65表示特定键的2字节数据。`0x00`-`0xFF`用于[基本键码](keycodes_basic.md)而`0x100`-`0xFFFF`用于[量子键码](quantum_keycodes.md).
66
67## Key Down
68一个键按下尚未抬起时触发的事件。
69
70## Key Up
71一个键抬起时触发的事件。
72
73## Keymap(键映射)
74映射到物理键盘布局的一组键码,在按键和按键释放时进行处理。有时翻译为布局,意为软件上表示的布局,即映射。
75
76## Layer(层)
77为了让一个键实现多个功能的抽象结构。最高活动层有限。
78
79## Leader Key(前导键、设置菜单键)
80本功能允许您点击前导键,然后按顺序按1-3个键子来激活按键或其他量子功能。
81
82* [前导键文档](feature_leader_key.md)
83
84## LED
85发光二极管,键盘上最常用的指示灯装置。
86
87## Make
88用于编译所有源文件的软件包。可以使用`make`命令和其他参数来编译你的固件。
89
90## Matrix(矩阵)
91一种由列和行组成的接线模式,使单片机能够用较少的引脚检测按键。矩阵通常包含二极管,以达到全键无冲。
92
93## Macro(宏)
94本功能可以在敲击单个键后发送多个按键事件(hid报告)。
95
96* [宏文档](feature_macros.md)
97
98## MCU(单片机、微控制单元)
99微控制单元,键盘的处理器。
100
101## Modifier(修改键、修饰键、功能键)
102按住该键将会改变其他键的功能,修饰键包括 Ctrl, Alt, 和 Shift。
103
104## Mousekeys(鼠标键)
105本功能在您敲击键盘时会控制鼠标光标。
106
107* [鼠标键文档](feature_mouse_keys.md)
108
109## N-Key Rollover (NKRO、全键无冲)
110一种术语,适用于能够同时报告任意数量按键的键盘。
111
112## Oneshot Modifier(粘滞键)
113一种能让你的功能键一直保持按下,直到你按下其他键的功能。它叫做粘滞键或叫做粘连键,该功能由软件实现而非机械结构。
114
115## ProMicro
116一种低成本AVR开发板。这种板子很容易在购物网站找到(价格不到20RMB),但是据说刷写pro micro有点令人抓狂。
117
118## Pull Request(拉请求、PR)
119向QMK请求提交代码。我们鼓励所有用户提交你们自己的键盘的代码。
120
121## QWERTY
122标准英文键盘,通常也用于其他语言,例如中文。是用键盘前6个字母命名的。
123
124## QWERTZ
125标准Deutsche(德语)键盘布局。使用前6个字母明名。
126
127## Rollover(允许翻转、无冲形式)
128该术语表示在一个键已按下时按下另一个键。形式包括2KRO(双键无冲),6KRO(6键无冲),和NKRO(全键无冲),无冲表示可同时按下而不产生冲突的键的数量。
129
130## Scancode(扫描码)
131HID报告中的一个1字节的数字,表示一个键子。这些数字在下列文档中[HID Usage Tables](https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf)该文档发布于[USB-IF](http://www.usb.org/)。
132
133## Space Cadet键盘的shift键
134一种特使的shift设置,能让你通过敲击左或右shift一次或多次键入不同的括号。
135
136* [Space Cadet键盘文档](feature_space_cadet.md)
137
138## Tap(敲击、单击)
139按下并释放一个键。在某些情况下您需要区分键按下和键抬起,但是单击把两个事件都包括了。
140
141## Tap Dance(多击键)
142本功能允许向同一个键子分配多个键码,并根据按键次数区分。
143
144* [多击键文档](feature_tap_dance.md)
145
146## Teensy
147一种低成本AVR开发板<!--译者吐槽:我怎么感觉成本不低。好吧,我穷。 -->,通常用于手工连线键盘。这个teensy是有点小贵但是halfkay bootloader会让它刷写十分简单,所以也很常用。
148
149## Underlight(背光)
150用于照亮电路板底面的LED的总称。这些LED通常从印刷电路板的底部向键盘所在的表面发光。
151
152## Unicode
153在较大的计算机世界中,Unicode是一组编码方案,用于表示任何语言中的字符。 与qmk相关的是,它意味着使用各种操作系统方案来发送Unicode代码点,而不是扫描码。
154
155* [Unicode文档](feature_unicode.md)
156
157## Unit Testing(单元测试)
158针对qmk的自动运行测试框架。单元测试帮助我们确信我们的更改不会破坏任何东西。
159
160* [单元测试文档](unit_testing.md)
161
162## USB
163通用串行总线,键盘最常见的有线接口。
164
165## USB 主机 (或简易主机)
166USB诸暨市你的电脑,或者你的键盘所插的任何设备。
167
168# 并没有找到你想找到的术语?
169
170[建立一个issue](https://github.com/qmk/qmk_firmware/issues) ,想好你的问题,或许你所问的术语就会添加到这里。创建一个PR帮我们添加需要添加的术语当然坠吼了:)