~ruther/qmk_firmware

95671148a4f451cd98b98e5d2b8d559ad12eb24d — Pablo Martínez 2 years ago 50cd320
[Docs] Change defines to enums in examples (#19793)

3 files changed, 15 insertions(+), 9 deletions(-)

M docs/ja/keymap.md
M docs/keymap.md
M docs/zh-cn/keymap.md
M docs/ja/keymap.md => docs/ja/keymap.md +5 -3
@@ 121,9 121,11 @@ TMK の歴史的経緯から、キーマップに保存されたアクション
    // STUFF あるいは他の名前のレイヤーを持つことができます。
    // レイヤー名は全て同じ長さである必要はなく、
    // また名前を完全に省略して単に数字を使うことができます。
    #define _BL 0
    #define _FL 1
    #define _CL 2
    enum layer_names {
        _BL,
        _FL,
        _CL,
    };

これらはキーマップとカスタム関数を作成するときに使うことができる便利な定義です。`GRAVE_MODS` 定義は後でカスタム関数で使われ、その下の `_BL`、`_FL`、`_CL` 定義は各レイヤーを参照しやすくします。


M docs/keymap.md => docs/keymap.md +5 -3
@@ 117,9 117,11 @@ At the top of the file you'll find this:
    // Layer names don't all need to be of the same
    // length, and you can also skip them entirely
    // and just use numbers.
    #define _BL 0
    #define _FL 1
    #define _CL 2
    enum layer_names {
        _BL,
        _FL,
        _CL,
    };

These are some handy definitions we can use when building our keymap and our custom function. The `GRAVE_MODS` definition will be used later in our custom function, and the following `_BL`, `_FL`, and `_CL` defines make it easier to refer to each of our layers.


M docs/zh-cn/keymap.md => docs/zh-cn/keymap.md +5 -3
@@ 143,9 143,11 @@ QMK键映射定义在C源文件中,其数据结构上是一个容纳了数组
    // and just use numbers.
    // 译:每一层为了便于识别可以起一个名字,下划线没有实际意义 - 叫STUFF之类的也行的,
    // 译:层名不需要都一样长,甚至不定义这些直接用层号也是可以的
    #define _BL 0
    #define _FL 1
    #define _CL 2
    enum layer_names {
        _BL,
        _FL,
        _CL,
    };

以上是一些便于编写键映射及自定义函数时可用的预定义,`GRAVE_MODS` 后续会用在自定义函数中,之后的 `_BL`, `_FL` 及 `_CL` 便于我们在代码中引用这些层。