Skip to content

Commit

Permalink
[Docs] Change defines to enums in examples (#19793)
Browse files Browse the repository at this point in the history
  • Loading branch information
elpekenin authored Feb 10, 2023
1 parent 50cd320 commit 9567114
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
8 changes: 5 additions & 3 deletions docs/ja/keymap.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` 定義は各レイヤーを参照しやすくします。

Expand Down
8 changes: 5 additions & 3 deletions docs/keymap.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
8 changes: 5 additions & 3 deletions docs/zh-cn/keymap.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` 便于我们在代码中引用这些层。

Expand Down

0 comments on commit 9567114

Please sign in to comment.