diff options
-rw-r--r-- | docs/custom_quantum_functions.md | 2 | ||||
-rw-r--r-- | docs/how_keyboards_work.md | 4 | ||||
-rw-r--r-- | docs/zh-cn/_summary.md | 66 | ||||
-rw-r--r-- | docs/zh-cn/custom_quantum_functions.md | 490 | ||||
-rw-r--r-- | docs/zh-cn/faq_general.md | 19 | ||||
-rw-r--r-- | docs/zh-cn/reference_glossary.md | 170 |
6 files changed, 715 insertions, 36 deletions
diff --git a/docs/custom_quantum_functions.md b/docs/custom_quantum_functions.md index 6287b95309..7be82c650f 100644 --- a/docs/custom_quantum_functions.md +++ b/docs/custom_quantum_functions.md @@ -267,7 +267,7 @@ You should use this function if you need custom matrix scanning code. It can als If the board supports it, it can be "idled", by stopping a number of functions. A good example of this is RGB lights or backlights. This can save on power consumption, or may be better behavior for your keyboard. -This is controlled by two functions: `suspend_power_down_*` and `suspend_wakeup_init_*`, which are called when the system is board is idled and when it wakes up, respectively. +This is controlled by two functions: `suspend_power_down_*` and `suspend_wakeup_init_*`, which are called when the system board is idled and when it wakes up, respectively. ### Example suspend_power_down_user() and suspend_wakeup_init_user() Implementation diff --git a/docs/how_keyboards_work.md b/docs/how_keyboards_work.md index 0772f055d6..5697a21872 100644 --- a/docs/how_keyboards_work.md +++ b/docs/how_keyboards_work.md @@ -63,10 +63,10 @@ You may wonder why a keyboard layout containing all of Unicode is not devised th ## How to (Maybe) Enter Unicode Characters -You can have the firmware send *sequences of keys* to use the [software Unicode Input Method](https://en.wikipedia.org/wiki/Unicode_input#Hexadecimal_code_input) of the target operating system, thus effectively entering characters independently of the layout defined in the OS. +You can have the firmware send *sequences of keys* to use the [software Unicode Input Method](https://en.wikipedia.org/wiki/Unicode_input#Hexadecimal_input) of the target operating system, thus effectively entering characters independently of the layout defined in the OS. Yet, it does come with multiple disadvantages: - - Tied to a specific OS a a time (need recompilation when changing OS); + - Tied to a specific OS at a time (need recompilation when changing OS); - Within a given OS, does not work in all software; - Limited to a subset of Unicode on some systems. diff --git a/docs/zh-cn/_summary.md b/docs/zh-cn/_summary.md index df25a3ccd1..b0d9f1c068 100644 --- a/docs/zh-cn/_summary.md +++ b/docs/zh-cn/_summary.md @@ -7,27 +7,27 @@ * [学习资源](newbs_learn_more_resources.md) * [QMK基础](README.md) - * [QMK 简介](getting_started_introduction.md) - * [贡献 QMK](contributing.md) + * [QMK简介](getting_started_introduction.md) + * [向QMK贡献](contributing.md) * [如何使用Github](getting_started_github.md) * [获得帮助](getting_started_getting_help.md) * [问题解答](faq.md) * [一般问题](faq_general.md) - * [构建/编译QMK](faq_build.md) - * [调试/故障排除 QMK](faq_debug.md) - * [键盘布局](faq_keymap.md) + * [构建/编译](faq_build.md) + * [调试/故障排除](faq_debug.md) + * [键盘映射](faq_keymap.md) * 详细指南 * [安装构建工具](getting_started_build_tools.md) - * [流浪者指南](getting_started_vagrant.md) + * [vagrant指南](getting_started_vagrant.md) * [构建/编译指令](getting_started_make_guide.md) * [刷新固件](flashing.md) * [定制功能](custom_quantum_functions.md) - * [布局概述](keymap.md) + * [映射概述](keymap.md) * [硬件](hardware.md) - * [AVR 处理器](hardware_avr.md) + * [AVR处理器](hardware_avr.md) * [驱动](hardware_drivers.md) * 参考 @@ -35,8 +35,8 @@ * [配置选项](config_options.md) * [键码](keycodes.md) * [记录最佳实践](documentation_best_practices.md) - * [文档指南](documentation_templates.md) - * [词汇表](reference_glossary.md) + * [文档模板](documentation_templates.md) + * [术语表](reference_glossary.md) * [单元测试](unit_testing.md) * [有用的功能](ref_functions.md) * [配置器支持](reference_configurator_support.md) @@ -44,35 +44,35 @@ * [特性](features.md) * [基本键码](keycodes_basic.md) - * [US ANSI 控制键](keycodes_us_ansi_shifted.md) + * [US ANSI控制码](keycodes_us_ansi_shifted.md) * [量子键码](quantum_keycodes.md) * [高级键码](feature_advanced_keycodes.md) * [音频](feature_audio.md) - * [自动控制](feature_auto_shift.md) + * [自动shift](feature_auto_shift.md) * [背光](feature_backlight.md) * [蓝牙](feature_bluetooth.md) - * [Bootmagic](feature_bootmagic.md) + * [热改键](feature_bootmagic.md) * [组合](feature_combo) * [命令](feature_command.md) * [动态宏指令](feature_dynamic_macros.md) * [编码器](feature_encoders.md) - * [Grave Escape](feature_grave_esc.md) - * [键锁](feature_key_lock.md) - * [层](feature_layouts.md) - * [引导键](feature_leader_key.md) - * [LED 阵列](feature_led_matrix.md) + * [重音号Esc复合键](feature_grave_esc.md) + * [自锁键](feature_key_lock.md) + * [布局](feature_layouts.md) + * [前导键](feature_leader_key.md) + * [LED阵列](feature_led_matrix.md) * [宏指令](feature_macros.md) * [鼠标键](feature_mouse_keys.md) * [一键功能](feature_advanced_keycodes.md#one-shot-keys) * [指针设备](feature_pointing_device.md) - * [PS/2 鼠标](feature_ps2_mouse.md) - * [RGB 光](feature_rgblight.md) - * [RGB 矩阵](feature_rgb_matrix.md) + * [PS/2鼠标](feature_ps2_mouse.md) + * [RGB灯光](feature_rgblight.md) + * [RGB矩阵](feature_rgb_matrix.md) * [空格候补换挡](feature_space_cadet_shift.md) * [空格候补换挡回车](feature_space_cadet_shift_enter.md) * [速录机](feature_stenography.md) * [换手](feature_swap_hands.md) - * [踢踏舞](feature_tap_dance.md) + * [多击键](feature_tap_dance.md) * [终端](feature_terminal.md) * [热敏打印机](feature_thermal_printer.md) * [Unicode](feature_unicode.md) @@ -80,16 +80,16 @@ * [速度键](feature_velocikey.md) * 针对制造者和定制者 - * [飞线指南](hand_wire.md) - * [ISP 刷新指南](isp_flashing_guide.md) - * [ARM 调试指南](arm_debugging.md) - * [I2C 驱动](i2c_driver.md) - * [GPIO 控制器](internals_gpio_control.md) - * [Proton C 转换](proton_c_conversion.md) + * [手工连线指南](hand_wire.md) + * [ISP刷新指南](isp_flashing_guide.md) + * [ARM调试指南](arm_debugging.md) + * [I2C驱动](i2c_driver.md) + * [GPIO控制器](internals_gpio_control.md) + * [Proton C转换](proton_c_conversion.md) * 深入了解 * [键盘如何工作](how_keyboards_work.md) - * [理解 QMK](understanding_qmk.md) + * [理解QMK](understanding_qmk.md) * 其他话题 * [使用Eclipse开发QMK](other_eclipse.md) @@ -99,8 +99,8 @@ * QMK 内构 (正在编写) * [定义](internals_defines.md) * [输入回调寄存器](internals_input_callback_reg.md) - * [Midi 设备](internals_midi_device.md) - * [Midi 设备设置过程](internals_midi_device_setup_process.md) - * [Midi 工具库](internals_midi_util.md) + * [Midi设备](internals_midi_device.md) + * [Midi设备设置过程](internals_midi_device_setup_process.md) + * [Midi工具库](internals_midi_util.md) * [发送函数](internals_send_functions.md) - * [Sysex 工具](internals_sysex_tools.md) + * [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 0000000000..42ceba9cac --- /dev/null +++ b/docs/zh-cn/custom_quantum_functions.md @@ -0,0 +1,490 @@ +# ��ζ�������̵Ĺ��� + +���ںܶ�����˵���ƻ����̿ɲ�ֻ������ĵ��Է����㰴���Ǹ�����ô����϶���ʵ�ֱȼ����ͺ�����ӵĹ��ܡ�QMK��������ע�����Ĺ���, ���ǹ���, ���⣬�������Զ�������ڲ�ͬ����µ���Ϊ�� + +��ҳ���ٶ��κ������QMK֪ʶ�����Ķ�[����QMK](understanding_qmk.md)�����ڸ������IJ���������ⷢ����ʲô�� + +## A Word on Core vs ���� vs ���� + +���ǰ�qmk��֯��һ����νṹ�� + +* Core (`_quantum`) + * Keyboard/Revision (`_kb`) + * Keymap (`_user`) + +����������ÿһ�������������ڶ����ϼ�һ��`_kb()`�� `_user()` ���� �����ڼ���/����ʹ��`_kb()`�����ڲ��ֲ�ʹ��`_user()`���� + +�ڼ���/���㶨�庯��ʱ��`_kb()`��ִ���κδ���ǰ�ȵ���`_user()`�DZ�Ҫ�ģ���Ȼ���ֲ㺯���Ͳ�Ҫ�����á� +<!-- �������⣺�����Ǿ䷭��IJ�̫��--> +# �Զ������ + +��ĿǰΪֹ������������Ǹ������м������Ϊ���µļ��롣�Ӵ���Ƕ�������Щ�����������ơ� + +## ����һ���¼��� + +���������һ������ö�ٳ���ȫ����Ҳ���Ǹ�����������ֲ�����Ψһ��ֵ��QMKû��ֱ������������ֵ��С�������ṩ��һ��`SAFE_RANGE`�ꡣ�������ö��ʱ��`SAFE_RANGE`����֤��ȡ����Ψһ�ļ���ֵ�� + + +����ö��������������ӡ������ӵ�`keymap.c`�Ļ�����ڲ���������`FOO`��`BAR`�ˡ� + +```c +enum my_keycodes { + FOO = SAFE_RANGE, + BAR +}; +``` + +## Ϊ�������Ϊ��� + +���㸲��һ���Ѵ��ڰ�������Ϊʱ���������Ϊ�����¼�ʱ����Ҫ��`process_record_kb()`��`process_record_user()`���������������ڼ���������ʵ���¼�������ǰ��QMK���á����������������`true`��QMK�����������ķ�ʽ�������롣�������Ժܷ������չ����Ĺ��ܶ������滻���������������`false` QMK������������������Ȼ���ͼ���̧���ǰ����¼�����������ˡ� + +��ij�������»��ͷ�ʱ���������ᱻ���á� + +### process_record_user()`����ʾ��ʵ�� + +����������������¡��Զ�����һ������`FOO`�ļ������Ϊ�����������ڰ��»س�ʱ���������� + +```c +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case FOO: + if (record->event.pressed) { + // ����ʱ��Щʲô + } else { + // �ͷ�ʱ��Щʲô + } + return false; // �����˼������н�һ������ + case KC_ENTER: + // �����»س�ʱ�������� + if (record->event.pressed) { + PLAY_NOTE_ARRAY(tone_qwerty); + } + return true; // ��QMK�����س�����/�ͷ��¼� + default: + return true; // ���������������� + } +} +``` + +### `process_record_*` �����ĵ� + +* ����/��: `bool process_record_kb(uint16_t keycode, keyrecord_t *record)` +* ����: `bool process_record_user(uint16_t keycode, keyrecord_t *record)` + +`keycode(����)`�������ڲ����϶���ģ�����`MO(1)`, `KC_L`, �ȵȡ� ��Ҫ�� `switch...case` ����������Щ�¼��� + +`record`��������ʵ�ʰ�������Ϣ�� + +```c +keyrecord_t record { + keyevent_t event { + keypos_t key { + uint8_t col + uint8_t row + } + bool pressed + uint16_t time + } +} +``` + +# LED���� + +qmk�ṩ�˶�ȡHID�淶������5��LED�ķ�����: + +* `USB_LED_NUM_LOCK` +* `USB_LED_CAPS_LOCK` +* `USB_LED_SCROLL_LOCK` +* `USB_LED_COMPOSE` +* `USB_LED_KANA` + +�����������Ӧ������LED״̬��λ��λ�� +�����ַ������Ի������LED״̬�� + +* ͨ��ִ�� `led_set_user()` +* ͨ������ `host_keyboard_leds()` + +## `led_set_user()` + +��5��LED���κ�һ����״̬��Ҫ�ı�ʱ���˺����������á��˺���ͨ����������LED������ +ʹ��`IS_LED_ON(usb_led, led_name)`��`IS_LED_OFF(usb_led, led_name)`�������������LED״̬�� + +!> `host_keyboard_leds()`���ܻ���`led_set_user()`������ǰ������ֵ�� + +### `led_set_user()`����ʾ��ʵ�� + +```c +void led_set_user(uint8_t usb_led) { + if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) { + writePinLow(B0); + } else { + writePinHigh(B0); + } + if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { + writePinLow(B1); + } else { + writePinHigh(B1); + } + if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) { + writePinLow(B2); + } else { + writePinHigh(B2); + } + if (IS_LED_ON(usb_led, USB_LED_COMPOSE)) { + writePinLow(B3); + } else { + writePinHigh(B3); + } + if (IS_LED_ON(usb_led, USB_LED_KANA)) { + writePinLow(B4); + } else { + writePinHigh(B4); + } +} +``` + +### `led_set_*`�����ĵ� + +* ����/��: `void led_set_kb(uint8_t usb_led)` +* ����: `void led_set_user(uint8_t usb_led)` + +## `host_keyboard_leds()` + +������������᷵������յ���LED״̬�����������`led_set_*`֮���ȡLED״̬ʱ�����ã�������[`matrix_scan_user()`](#����ɨ�����). +Ϊ�˱�ݣ��������`IS_HOST_LED_ON(led_name)`��`IS_HOST_LED_OFF(led_name)` �꣬����ֱ�ӵ��úͼ��`host_keyboard_leds()`�� + +## ��������LED״̬ + +һЩ����ʵ����Ϊ��������LED��״̬�ṩ�˷���ķ����� + +### Ergodox Boards + +Ergodoxʵ�����ṩ`ergodox_right_led_1`/`2`/`3_on`/`off()`����ÿ��LED�����, Ҳ������ `ergodox_right_led_on`/`off(uint8_t led)` ��������ر����ǡ� + +���⣬������ʹ��`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)`�� + +Ergodox boards ͬʱ������������ȼ���`LED_BRIGHTNESS_LO`��������ȼ���`LED_BRIGHTNESS_HI`(Ĭ�����). + +# ���̳�ʼ������ + +���̳�ʼ�������м������衣�������Ǹ�����ȡ��������Ҫ��ʲô�� + +��������Ҫ��ʼ��������������˳���г��� + +* `keyboard_pre_init_*` - ���ڴ����������������ǰ���С���������Щ��Ҫ��ǰ���е�Ӳ����ʼ���� +* `matrix_init_*` - �ڹ̼����������м䱻���á���ʱӲ���ѳ�ʼ����������δ��ʼ���� +* `keyboard_post_init_*` - �ڹ̼�������������á����������£���ġ����ƻ������붼���Է������ + +!> ���ڴ��������˵`keyboard_post_init_user`������Ҫ���õĺ���������, ��ʱ���������RGB�Ʒ��⡣ + +## ����Ԥ��ʼ������ + +����뼫�����У���������USB��ʼ��ǰ���С� + +����֮�þ���ͱ���ʼ���ˡ� + +���ڴ�����û���˵,���ò�������Ϊ����Ҫ����������Ӳ���ij�ʼ���� + +���������Ӳ����ʼ���Ļ����������ٺò�����(�����ʼ��LED����һ���). + +### `keyboard_pre_init_user()`����ʾ��ʵ�� + +�������ڼ��̼����趨 B0, B1, B2, B3, �� B4 ��LED���š� + +```c +void keyboard_pre_init_user(void) { + // ���ü���Ԥ��ʼ������ + + // ����LED����Ϊ���ģʽ + setPinOutput(B0); + setPinOutput(B1); + setPinOutput(B2); + setPinOutput(B3); + setPinOutput(B4); +} +``` + +### `keyboard_pre_init_*` �����ĵ� + +* ����/��: `void keyboard_pre_init_kb(void)` +* ����: `void keyboard_pre_init_user(void)` + +## �����ʼ������ + +�⽫���ھ����ʼ��ʱ�����ã���ijЩӲ�����úú���һЩ���ܱ���ʼ��ǰ�� + +���������������ط����õ��Ķ�����ʱ�������ã�����Ӳ���أ�Ҳ����������������λ�á� + + +### `matrix_init_*`�����ĵ� + +* ����/��: `void matrix_init_kb(void)` +* ����: `void matrix_init_user(void)` + + +## ���̺��ʼ������ + +���Ǽ��̳�ʼ�������е����һ����������������ijЩ���ԣ��������ã���Ϊ��ʱӦ�ö����ǽ��г�ʼ���� + + +### `keyboard_post_init_user()`ʾ��ʵ�� + +��ʾ�������г�ʼ����ɺ����У�����RGB�ơ� + +```c +void keyboard_post_init_user(void) { + // ���ú��ʼ������ + rgblight_enable_noeeprom(); // ʹ��Rgb������������ + rgblight_sethsv_noeeprom(180, 255, 255); // ����ɫ���õ�����ɫ(��ɫ)������ + rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING + 3); // ���ÿ��ٺ���ģʽ������ +} +``` + +### `keyboard_post_init_*` �����ĵ� + +* ����/��: `void keyboard_post_init_kb(void)` +* ����: `void keyboard_post_init_user(void)` + +# ����ɨ����� + +���ܵĻ���Ҫ��`process_record_*()`�Զ�����̣������ַ�ʽ���ӵ��¼��У���ȷ�����벻��Լ��̲������������Ӱ�졣Ȼ�����ڼ���������£��б�Ҫ���о���ɨ�衣����Щ������Ҫ�ر�ע���������ܣ���Ϊ��ÿ�����ٱ�����10�Ρ� + +### `matrix_scan_*`ʾ��ʵ�� + +������ӱ�����ʡ���ˡ���hook����һ�������ܼ������е�����֮ǰ����Ӧ���㹻�˽�qmk���ڲ��ṹ���Ա���û��ʾ��������±�д���������Ҫ��������[����һ��issue](https://github.com/qmk/qmk_firmware/issues/new)��[��Discord�������ǽ���](https://discord.gg/Uq7gcHh). + +### `matrix_scan_*` �����ĵ� + +* ����/��: `void matrix_scan_kb(void)` +* ����: `void matrix_scan_user(void)` + +�ú�����ÿ�ξ���ɨ��ʱ�����ã��������MCU��������������ͬ��������д����Ҫ��������Ϊ�������кܶ�Ρ� + +������Զ������ɨ�����ʱ�õ������������Ҳ���������Զ���״̬���(����LED�ƻ�����Ļ)�������������û���������Ҳ�붨�����еĹ��ܡ� + + +# ���� ����/���� ���� + +�������֧�־Ϳ���ͨ��ֹͣһ��Ʊ�������ﵽ"����"��RGB�ƺͱ�����Ǻܺõ����ӡ�����Խ�Լ�ܺģ�Ҳ����������̷�ζ���ѡ� + +��������������: `suspend_power_down_*`��`suspend_wakeup_init_*`, �ֱ���ϵͳ����кͻ���ʱ���á� + + +### suspend_power_down_user()��suspend_wakeup_init_user()ʾ��ʵ�� + + +```c +void suspend_power_down_user(void) { + rgb_matrix_set_suspend_state(true); +} + +void suspend_wakeup_init_user(void) { + rgb_matrix_set_suspend_state(false); +} +``` + +### ���� ����/���� �����ĵ� + +* ����/��: `void suspend_power_down_kb(void)` ��`void suspend_wakeup_init_user(void)` +* ����: `void suspend_power_down_kb(void)` �� `void suspend_wakeup_init_user(void)` + +# ��ı���� + +ÿ����ı���������д��롣����ڲ�ָʾ���Զ���㴦�������á� + +### `layer_state_set_*` ʾ��ʵ�� + +����ʹ����Planck����ʾ����������� [RGB�����](feature_rgblight.md)ʹ֮����Ӧ + +```c +uint32_t layer_state_set_user(uint32_t state) { + switch (biton32(state)) { + case _RAISE: + rgblight_setrgb (0x00, 0x00, 0xFF); + break; + case _LOWER: + rgblight_setrgb (0xFF, 0x00, 0x00); + break; + case _PLOVER: + rgblight_setrgb (0x00, 0xFF, 0x00); + break; + case _ADJUST: + rgblight_setrgb (0x7A, 0x00, 0xFF); + break; + default: // for any other layers, or the default layer + rgblight_setrgb (0x00, 0xFF, 0xFF); + break; + } + return state; +} +``` +### `layer_state_set_*` �����ĵ� + +* ����/��: `uint32_t layer_state_set_kb(uint32_t state)` +* ����: `uint32_t layer_state_set_user(uint32_t state)` + + +��`״̬`�ǻ���bitmask, ���[���ָ���](keymap.md#���ֵIJ�״̬) + + +# ���籣������ (EEPROM) + +�����������ó��ڵı����ڼ����С���Щ���ñ����������ص�EEPROM����粻����ʧ�� ���ÿ�����`eeconfig_read_kb`��`eeconfig_read_user`��ȡ��������`eeconfig_update_kb`��`eeconfig_update_user`д�롣�������ϣ���ܹ��л��Ĺ��ܺ�����(�����л�RGB��ָʾ�����⣬�������`eeconfig_init_kb`��`eeconfig_init_user`������EEPROMĬ��ֵ�� + +��ӵIJ��ֿ����ǣ��кܶ������ͨ��EEPROM�洢�ͷ������ݣ����Ҳ�û�������ַ����ǡ�������ȷ���ġ���ÿ������ֻ��һ��˫��(���ֽ�)�ռ䡣 + +��סEEPROM����д�������ġ�����д�������ܸߣ����Dz�����ֻ������д��EEPROM�С������д��Ƶ�������MCU���������̡� + +* �����������������ӣ���ô������ϣ������ʹ��������ԣ���Ϊ���൱���ӡ� + +### ʾ��ʵ�� + +��������������������ã����Ҷ�д������ʹ�����û����֡�����һ�����ӵĺ������кܶ�����Ҫ����ʵ���ϣ���ʹ���˺ܶ����������������� + + +�����keymap.c�ļ��У������´�������������: +```c +typedef union { + uint32_t raw; + struct { + bool rgb_layer_change :1; + }; +} user_config_t; + +user_config_t user_config; +``` + +���ϴ��뽨����һ���ṹ�壬�ýṹ����Դ洢���ò�������д��EEPROM�������㽫���趨���������Ϊ�ڽṹ������Ȼ���塣Ҫ��ס`bool` (����)ֵʹ��1λ, `uint8_t`ʹ��8λ, `uint16_t`ʹ��16λ������Ի�ϴ���ʹ�ã�����˳��Ǵ����ܻ������鷳����Ϊ�ǻ�ı�д��д����ֵ�� + + `layer_state_set_*`������ʹ����`rgb_layer_change`��ʹ����`keyboard_post_init_user`��`process_record_user`������һ�С� + +����Ҫʹ��`keyboard_post_init_user����Ҫ����`eeconfig_read_user()`�������ոմ����Ľṹ�塣Ȼ������������ʹ������ṹ���������IJ����еĹ��ܡ����������� +```c +void keyboard_post_init_user(void) { + // ���ò��ּ���ľ����ʼ�� + + // ��EEPROM���û����� + user_config.raw = eeconfig_read_user(); + + // ��ʹ�ܣ�����Ĭ�ϲ� + if (user_config.rgb_layer_change) { + rgblight_enable_noeeprom(); + rgblight_sethsv_noeeprom_cyan(); + rgblight_mode_noeeprom(1); + } +} +``` +���Ϻ������ڶ�EEPROM���ú�����ʹ�ø�����������Ĭ�ϲ�RGB��ɫ��"raw"��ֵ�Ǵ����������"union"�����Ľṹ����ת�����ġ� + +```c +uint32_t layer_state_set_user(uint32_t state) { + switch (biton32(state)) { + case _RAISE: + if (user_config.rgb_layer_change) { rgblight_sethsv_noeeprom_magenta(); rgblight_mode_noeeprom(1); } + break; + case _LOWER: + if (user_config.rgb_layer_change) { rgblight_sethsv_noeeprom_red(); rgblight_mode_noeeprom(1); } + break; + case _PLOVER: + if (user_config.rgb_layer_change) { rgblight_sethsv_noeeprom_green(); rgblight_mode_noeeprom(1); } + break; + case _ADJUST: + if (user_config.rgb_layer_change) { rgblight_sethsv_noeeprom_white(); rgblight_mode_noeeprom(1); } + break; + default: // ����������Ĭ�ϲ� + if (user_config.rgb_layer_change) { rgblight_sethsv_noeeprom_cyan(); rgblight_mode_noeeprom(1); } + break; + } + return state; +} +``` +��������ֵʹ��ʱ��ı�RGB����ơ������������ֵ, Ϊ`process_record_user`����һ���¼������`RGB_LYR`������Ҫȷ�������ʹ��������RGB���룬ʹ�������ʾ������رգ��뽫������Ϊ�� +```c + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case FOO: + if (record->event.pressed) { + // ����ʱ����ʲô + } else { + // �ͷ�ʱ����ʲô + } + return false; // �����˼��Ľ�һ������ + case KC_ENTER: + // �ڰ��»س�ʱ�������� + if (record->event.pressed) { + PLAY_NOTE_ARRAY(tone_qwerty); + } + return true; // ��QMK�����س�����/�ͷ��¼� + case RGB_LYR: // ������underglow��Ϊ��ָʾ��������ʹ�á� + if (record->event.pressed) { + user_config.rgb_layer_change ^= 1; // �л�״̬ + eeconfig_update_user(user_config.raw); // ��EEPROMд����״̬ + if (user_config.rgb_layer_change) { // �����״̬��ʹ�� + layer_state_set(layer_state); // ��ô���̸��²���ɫ + } + } + return false; break; + case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // �������е�RGB���� (see quantum_keycodes.h, L400 ���Բο�) + if (record->event.pressed) { //����ʧ�ܲ�ָʾ��������ı����������Ҫ�������� + if (user_config.rgb_layer_change) { // ����ʹ��ʱ + user_config.rgb_layer_change = false; // ʧ�ܣ�Ȼ�� + eeconfig_update_user(user_config.raw); // ��EEPROMд������ + } + } + return true; break; + default: + return true; // ������������ + } +} +``` +�����Ҫ����`eeconfig_init_user`���������Ե�EEPROM����ʱ������ָ��Ĭ��ֵ, �����Զ����������ǿ������EEPROM������`EEP_RST`�����[Bootmagic](feature_bootmagic.md)���������磬���Ҫ��Ĭ�����������RGB��ָʾ��������Ĭ��ֵ + +```c +void eeconfig_init_user(void) { // EEPROM�������� + user_config.raw = 0; + user_config.rgb_layer_change = true; // ������ҪĬ��ʹ�� + eeconfig_update_user(user_config.raw); // ��EEPROMд��Ĭ��ֵ + + // use the non noeeprom versions, ��Ҫ��EEPROMд����Щֵ + rgblight_enable(); // Ĭ��ʹ��RGB + rgblight_sethsv_cyan(); // Ĭ��������ɫ + rgblight_mode(1); // Ĭ�����ó��� +} +``` + +Ȼ��������ˡ�RGB��ָʾ����������������ʱ������������û�һֱ���棬��������¼��̡������ʹ������RGB���룬��ָʾ��ʧ�ܣ��������������������ˡ� + +### 'EECONFIG' �����ĵ� + +* ����/��: `void eeconfig_init_kb(void)`, `uint32_t eeconfig_read_kb(void)`��`void eeconfig_update_kb(uint32_t val)` +* ����: `void eeconfig_init_user(void)`, `uint32_t eeconfig_read_user(void)`��`void eeconfig_update_user(uint32_t val)` + +`val` ������д��EEPROM��ֵ��`eeconfig_read_*`�������EEPROM����һ��32λ(˫��)��ֵ�� + +# �Զ������-�����ٽ�ֵ(TAPPING_TERM) +Ĭ�������,����-�����ٽ�ֵ��ȫ��ͳһ�ģ����Ҳ���ͨ�����������á����ڴ�����û���˵��ܺá���������Щ����£�����`LT`����˵������ʱ��˫���ܼ�����������������Ϊ��Щ���������ļ������װ�ס��Ϊ�˲���ÿ�����Զ�����룬�����ܿ���Ϊÿ��������`TAPPING_TERM`�� + +��ʹ��������ܵĻ�, Ҫ����`config.h`����`#define TAPPING_TERM_PER_KEY`�� + + +## `get_tapping_term`ʾ��ʵ�� + +��Ҫ�Ļ��ڼ����`TAPPING TERM`,��Ҫ��`keymap.c`�ļ��������´���: + +```c +uint16_t get_tapping_term(uint16_t keycode) { + switch (keycode) { + case SFT_T(KC_SPC): + return TAPPING_TERM + 1250; + case LT(1, KC_GRV): + return 130; + default: + return TAPPING_TERM; + } +} +``` + +### `get_tapping_term` �����ĵ� + +������ƪ����������,�������Ҫquantum�����̼���ĺ�����ֻҪ�û����������ɡ� diff --git a/docs/zh-cn/faq_general.md b/docs/zh-cn/faq_general.md new file mode 100644 index 0000000000..4949acb8c9 --- /dev/null +++ b/docs/zh-cn/faq_general.md @@ -0,0 +1,19 @@ +# �������� + +## QMK��ʲô? + +[QMK](https://github.com/qmk), �����ӻ�е����(Quantum Mechanical Keyboard)����д����һȺ��Դ������Ϊ���Ƽ��̿����Ĺ��ߡ����Ǵ�[QMK�̼�](https://github.com/qmk/qmk_firmware)��ʼ������[TMK](https://github.com/tmk/tmk_keyboard)��ħ�ķֲ档 + +### Ϊʲô������(Quantum)? + +<!-- ���� �����²ۣ��ĵ����߾�ȻҲ��֪��Ϊɶ������ --> + +## QMK��TMK��ʲô����? + +TMK�����[Jun Wako](https://github.com/tmk)��ƺ�ִ�С�QMKʼ��[Jack Humbert](https://github.com/jackhumbert)ΪPlanck���̴�����TMK�ֲ档һ��ʱ���Jack�ķֲ�ͺ�TMK��ȥ��Զ�ˣ�������2015�꣬Jack��������QMK�� + +�Ӽ����۵�������QMK��TMK����һЩ�¹��ܶ��ɵġ�������QMK��չ�˿��õļ��룬ʹ�����ܽ�һ���ḻ���� `S()`, `LCTL()`, �� `MO()`��ȫ�������[����](keycodes.md). + +�ӹ��̵�������������TMK�Լ�ά�������йٷ�֧�ֵļ��̣�ֻ�к�Сһ��������֧�֡���������ά���Ѵ��ڷֲ��Ϊ�������̴����ķֲ档Ĭ��֧�ֺ��ٵļ��룬�����û�ͨ�����������˷������֡�QMK����ͨ�����й����ֿ�������ֺͼ��̣����ǻ�������з�����������PR����ͼ���ı�֤������ά����ͬʱQMKС��Ҳ���ڱ�Ҫʱ��������� + +�����ַ����������ŵ��ȱ�㣬���Ҵ�����������ʱ��TMK��QMK֮������������ diff --git a/docs/zh-cn/reference_glossary.md b/docs/zh-cn/reference_glossary.md new file mode 100644 index 0000000000..7b9adcc2a7 --- /dev/null +++ b/docs/zh-cn/reference_glossary.md @@ -0,0 +1,170 @@ +# QMK术语表 + +## ARM +多家公司生产的32位单片机系列,例如Atmel, Cypress, Kinetis, NXP, ST, 和 TI等公司。 + +## AVR +[Atmel](http://www.microchip.com/)公司的单片机系列。 AVR是TMK的初始支持平台。 + +## AZERTY +Français (法国)标准键盘布局。用键盘的前六个字母命名。 + +## Backlight(背光) +键盘上照明的通称。背光通常是一组LED灯,通过键帽或者按轴发光,但也不总是这样。 + +## Bluetooth(蓝牙) +一种短距离点对点无线协议。许多多无线键盘使用此协议。 + +## Bootloader(引导加载程序) +一种写到你单片机的保护区的特殊的程序,该程序可以使单片机升级自己的固件,通常是通过USB来升级。 + +## Bootmagic(热改键) +允许各种键盘行为动态变化的功能,如交换或禁用常用键。 + +## C +一种适用于系统代码的低级编程语言。大多数qmk代码是用C编写的。 + +## Colemak +一种流行的键盘布局。 + +## Compile(编译) +把人可读的代码转换成你的单片机可以运行的机器代码的过程。 + +## Dvorak +一个由August Dvorak博士在20世纪30年代创建的布局。Dvorak简化键盘(Dvorak Simplified Keyboard)的缩写。 + +## Dynamic Macro(动态宏) +一种记录在键盘上的宏,当键盘拔出或计算机重新启动时,宏将丢失。 + +* [动态宏文档](feature_dynamic_macros.md) + +## Eclipse +是一种受C语言开发者追捧的集成开发环境(IDE)。 + +* [Eclipse安装说明](eclipse.md) + +## Firmware(固件) +用来控制单片机的软件。 + +## FLIP +爱特梅尔(Atmel)提供的AVR器件刷写软件。我们一般推荐 [QMK刷写工具](https://github.com/qmk/qmk_flasher),但是对于一些高级用例,需要FLIP。 + +## git +命令行版本控制软件 + +## GitHub +负责大多数QMK项目的网站。它是Git、问题跟踪和其他帮助我们运行qmk的功能的集成平台。 + +## ISP(在系统编程) +在系统编程(In-system programming), 使用外部硬件和JTAG管脚对AVR芯片进行编程的一种方法。 + +## hid_listen +从键盘接收调试消息的接口。 您可以使用[QMK Flasher](https://github.com/qmk/qmk_flasher)或[PJRC's hid_listen](https://www.pjrc.com/teensy/hid_listen.html)查看这些消息 + +## Keycode(键码) +表示特定键的2字节数据。`0x00`-`0xFF`用于[基本键码](keycodes_basic.md)而`0x100`-`0xFFFF`用于[量子键码](quantum_keycodes.md). + +## Key Down +一个键按下尚未抬起时触发的事件。 + +## Key Up +一个键抬起时触发的事件。 + +## Keymap(键映射) +映射到物理键盘布局的一组键码,在按键和按键释放时进行处理。有时翻译为布局,意为软件上表示的布局,即映射。 + +## Layer(层) +为了让一个键实现多个功能的抽象结构。最高活动层有限。 + +## Leader Key(前导键、设置菜单键) +本功能允许您点击前导键,然后按顺序按1-3个键子来激活按键或其他量子功能。 + +* [前导键文档](feature_leader_key.md) + +## LED +发光二极管,键盘上最常用的指示灯装置。 + +## Make +用于编译所有源文件的软件包。可以使用`make`命令和其他参数来编译你的固件。 + +## Matrix(矩阵) +一种由列和行组成的接线模式,使单片机能够用较少的引脚检测按键。矩阵通常包含二极管,以达到全键无冲。 + +## Macro(宏) +本功能可以在敲击单个键后发送多个按键事件(hid报告)。 + +* [宏文档](feature_macros.md) + +## MCU(单片机、微控制单元) +微控制单元,键盘的处理器。 + +## Modifier(修改键、修饰键、功能键) +按住该键将会改变其他键的功能,修饰键包括 Ctrl, Alt, 和 Shift。 + +## Mousekeys(鼠标键) +本功能在您敲击键盘时会控制鼠标光标。 + +* [鼠标键文档](feature_mouse_keys.md) + +## N-Key Rollover (NKRO、全键无冲) +一种术语,适用于能够同时报告任意数量按键的键盘。 + +## Oneshot Modifier(粘滞键) +一种能让你的功能键一直保持按下,直到你按下其他键的功能。它叫做粘滞键或叫做粘连键,该功能由软件实现而非机械结构。 + +## ProMicro +一种低成本AVR开发板。这种板子很容易在购物网站找到(价格不到20RMB),但是据说刷写pro micro有点令人抓狂。 + +## Pull Request(拉请求、PR) +向QMK请求提交代码。我们鼓励所有用户提交你们自己的键盘的代码。 + +## QWERTY +标准英文键盘,通常也用于其他语言,例如中文。是用键盘前6个字母命名的。 + +## QWERTZ +标准Deutsche(德语)键盘布局。使用前6个字母明名。 + +## Rollover(允许翻转、无冲形式) +该术语表示在一个键已按下时按下另一个键。形式包括2KRO(双键无冲),6KRO(6键无冲),和NKRO(全键无冲),无冲表示可同时按下而不产生冲突的键的数量。 + +## Scancode(扫描码) +HID报告中的一个1字节的数字,表示一个键子。这些数字在下列文档中[HID Usage Tables](https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf)该文档发布于[USB-IF](http://www.usb.org/)。 + +## Space Cadet键盘的shift键 +一种特使的shift设置,能让你通过敲击左或右shift一次或多次键入不同的括号。 + +* [Space Cadet键盘文档](feature_space_cadet.md) + +## Tap(敲击、单击) +按下并释放一个键。在某些情况下您需要区分键按下和键抬起,但是单击把两个事件都包括了。 + +## Tap Dance(多击键) +本功能允许向同一个键子分配多个键码,并根据按键次数区分。 + +* [多击键文档](feature_tap_dance.md) + +## Teensy +一种低成本AVR开发板<!--译者吐槽:我怎么感觉成本不低。好吧,我穷。 -->,通常用于手工连线键盘。这个teensy是有点小贵但是halfkay bootloader会让它刷写十分简单,所以也很常用。 + +## Underlight(背光) +用于照亮电路板底面的LED的总称。这些LED通常从印刷电路板的底部向键盘所在的表面发光。 + +## Unicode +在较大的计算机世界中,Unicode是一组编码方案,用于表示任何语言中的字符。 与qmk相关的是,它意味着使用各种操作系统方案来发送Unicode代码点,而不是扫描码。 + +* [Unicode文档](feature_unicode.md) + +## Unit Testing(单元测试) +针对qmk的自动运行测试框架。单元测试帮助我们确信我们的更改不会破坏任何东西。 + +* [单元测试文档](unit_testing.md) + +## USB +通用串行总线,键盘最常见的有线接口。 + +## USB 主机 (或简易主机) +USB诸暨市你的电脑,或者你的键盘所插的任何设备。 + +# 并没有找到你想找到的术语? + +[建立一个issue](https://github.com/qmk/qmk_firmware/issues) ,想好你的问题,或许你所问的术语就会添加到这里。创建一个PR帮我们添加需要添加的术语当然坠吼了:) |