summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Martínez <58857054+elpekenin@users.noreply.github.com>2023-02-10 11:39:35 +0100
committerGitHub <noreply@github.com>2023-02-10 02:39:35 -0800
commit95671148a4f451cd98b98e5d2b8d559ad12eb24d (patch)
tree8817ffe14c8b9d9be0b7b955505266a9d1930a91
parent50cd320616aa4850ebcd876b3462f449ec55c51b (diff)
[Docs] Change defines to enums in examples (#19793)
-rw-r--r--docs/ja/keymap.md8
-rw-r--r--docs/keymap.md8
-rw-r--r--docs/zh-cn/keymap.md8
3 files changed, 15 insertions, 9 deletions
diff --git a/docs/ja/keymap.md b/docs/ja/keymap.md
index 7614e52433..a1181206e1 100644
--- a/docs/ja/keymap.md
+++ b/docs/ja/keymap.md
@@ -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` 定義は各レイヤーを参照しやすくします。
diff --git a/docs/keymap.md b/docs/keymap.md
index 66e9db1a7f..f9d45b3267 100644
--- a/docs/keymap.md
+++ b/docs/keymap.md
@@ -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.
diff --git a/docs/zh-cn/keymap.md b/docs/zh-cn/keymap.md
index b4433ed49f..9bee61f938 100644
--- a/docs/zh-cn/keymap.md
+++ b/docs/zh-cn/keymap.md
@@ -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` 便于我们在代码中引用这些层。