diff options
author | umi <57262844+umi-umi@users.noreply.github.com> | 2020-04-14 02:25:57 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-13 10:25:57 -0700 |
commit | 355b693e4e0d801ffc374cfc0e7a450f1d490310 (patch) | |
tree | a0f8b79c9d68e0844bae226ba42100aa02e25d10 | |
parent | f514ad550399fcfa23dad3406b391a2788b18c36 (diff) | |
download | qmk_firmware-355b693e4e0d801ffc374cfc0e7a450f1d490310.tar.gz qmk_firmware-355b693e4e0d801ffc374cfc0e7a450f1d490310.zip |
[Docs] Japanese translation of docs/feature_dip_switch.md (#8673)
* add git_dip_switch.md translation
* update based on comment
* update based on comment
-rw-r--r-- | docs/ja/feature_dip_switch.md | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/docs/ja/feature_dip_switch.md b/docs/ja/feature_dip_switch.md new file mode 100644 index 000000000..1403485ca --- /dev/null +++ b/docs/ja/feature_dip_switch.md | |||
@@ -0,0 +1,95 @@ | |||
1 | # DIP スイッチ | ||
2 | |||
3 | <!--- | ||
4 | original document: 0.8.94:docs/feature_dip_switch.md | ||
5 | git diff 0.8.94 HEAD -- docs/feature_dip_switch.md | cat | ||
6 | --> | ||
7 | |||
8 | DIP スイッチは、以下を `rules.mk` に追加することでサポートされます: | ||
9 | |||
10 | DIP_SWITCH_ENABLE = yes | ||
11 | |||
12 | さらに、以下を `config.h` に追加します: | ||
13 | |||
14 | ```c | ||
15 | #define DIP_SWITCH_PINS { B14, A15, A10, B9 } | ||
16 | ``` | ||
17 | |||
18 | ## コールバック | ||
19 | |||
20 | コールバック関数を `<keyboard>.c` に記述することができます: | ||
21 | |||
22 | ```c | ||
23 | void dip_switch_update_kb(uint8_t index, bool active) { | ||
24 | dip_switch_update_user(index, active); | ||
25 | } | ||
26 | ``` | ||
27 | |||
28 | |||
29 | あるいは `keymap.c` に記述することもできます: | ||
30 | |||
31 | ```c | ||
32 | void dip_switch_update_user(uint8_t index, bool active) { | ||
33 | switch (index) { | ||
34 | case 0: | ||
35 | if(active) { audio_on(); } else { audio_off(); } | ||
36 | break; | ||
37 | case 1: | ||
38 | if(active) { clicky_on(); } else { clicky_off(); } | ||
39 | break; | ||
40 | case 2: | ||
41 | if(active) { music_on(); } else { music_off(); } | ||
42 | break; | ||
43 | case 3: | ||
44 | if (active) { | ||
45 | #ifdef AUDIO_ENABLE | ||
46 | PLAY_SONG(plover_song); | ||
47 | #endif | ||
48 | layer_on(_PLOVER); | ||
49 | } else { | ||
50 | #ifdef AUDIO_ENABLE | ||
51 | PLAY_SONG(plover_gb_song); | ||
52 | #endif | ||
53 | layer_off(_PLOVER); | ||
54 | } | ||
55 | break; | ||
56 | } | ||
57 | } | ||
58 | ``` | ||
59 | |||
60 | 更に、より複雑な処理ができるビットマスク関数をサポートします。 | ||
61 | |||
62 | |||
63 | ```c | ||
64 | void dip_switch_update_mask_kb(uint32_t state) { | ||
65 | dip_switch_update_mask_user(state); | ||
66 | } | ||
67 | ``` | ||
68 | |||
69 | |||
70 | あるいは `keymap.c` に記述することもできます: | ||
71 | |||
72 | ```c | ||
73 | void dip_switch_update_mask_user(uint32_t state) { | ||
74 | if (state & (1UL<<0) && state & (1UL<<1)) { | ||
75 | layer_on(_ADJUST); // C on esc | ||
76 | } else { | ||
77 | layer_off(_ADJUST); | ||
78 | } | ||
79 | if (state & (1UL<<0)) { | ||
80 | layer_on(_TEST_A); // A on ESC | ||
81 | } else { | ||
82 | layer_off(_TEST_A); | ||
83 | } | ||
84 | if (state & (1UL<<1)) { | ||
85 | layer_on(_TEST_B); // B on esc | ||
86 | } else { | ||
87 | layer_off(_TEST_B); | ||
88 | } | ||
89 | } | ||
90 | ``` | ||
91 | |||
92 | |||
93 | ## ハードウェア | ||
94 | |||
95 | DIP スイッチの片側は MCU のピンへ直接配線し、もう一方の側はグラウンドに配線する必要があります。機能的に同じであるため、どちら側がどちらに接続されているかは問題にはならないはずです。 | ||