aboutsummaryrefslogtreecommitdiff
path: root/docs/feature_dip_switch.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/feature_dip_switch.md')
-rw-r--r--docs/feature_dip_switch.md16
1 files changed, 10 insertions, 6 deletions
diff --git a/docs/feature_dip_switch.md b/docs/feature_dip_switch.md
index 15e449c4c..5e8c19bfa 100644
--- a/docs/feature_dip_switch.md
+++ b/docs/feature_dip_switch.md
@@ -23,8 +23,9 @@ or
23The callback functions can be inserted into your `<keyboard>.c`: 23The callback functions can be inserted into your `<keyboard>.c`:
24 24
25```c 25```c
26void dip_switch_update_kb(uint8_t index, bool active) { 26bool dip_switch_update_kb(uint8_t index, bool active) {
27 dip_switch_update_user(index, active); 27 if !(dip_switch_update_user(index, active)) { return false; }
28 return true;
28} 29}
29``` 30```
30 31
@@ -32,7 +33,7 @@ void dip_switch_update_kb(uint8_t index, bool active) {
32or `keymap.c`: 33or `keymap.c`:
33 34
34```c 35```c
35void dip_switch_update_user(uint8_t index, bool active) { 36bool dip_switch_update_user(uint8_t index, bool active) {
36 switch (index) { 37 switch (index) {
37 case 0: 38 case 0:
38 if(active) { audio_on(); } else { audio_off(); } 39 if(active) { audio_on(); } else { audio_off(); }
@@ -57,6 +58,7 @@ void dip_switch_update_user(uint8_t index, bool active) {
57 } 58 }
58 break; 59 break;
59 } 60 }
61 return true;
60} 62}
61``` 63```
62 64
@@ -64,8 +66,9 @@ Additionally, we support bit mask functions which allow for more complex handlin
64 66
65 67
66```c 68```c
67void dip_switch_update_mask_kb(uint32_t state) { 69bool dip_switch_update_mask_kb(uint32_t state) {
68 dip_switch_update_mask_user(state); 70 if (!dip_switch_update_mask_user(state)) { return false; }
71 return true;
69} 72}
70``` 73```
71 74
@@ -73,7 +76,7 @@ void dip_switch_update_mask_kb(uint32_t state) {
73or `keymap.c`: 76or `keymap.c`:
74 77
75```c 78```c
76void dip_switch_update_mask_user(uint32_t state) { 79bool dip_switch_update_mask_user(uint32_t state) {
77 if (state & (1UL<<0) && state & (1UL<<1)) { 80 if (state & (1UL<<0) && state & (1UL<<1)) {
78 layer_on(_ADJUST); // C on esc 81 layer_on(_ADJUST); // C on esc
79 } else { 82 } else {
@@ -89,6 +92,7 @@ void dip_switch_update_mask_user(uint32_t state) {
89 } else { 92 } else {
90 layer_off(_TEST_B); 93 layer_off(_TEST_B);
91 } 94 }
95 return true;
92} 96}
93``` 97```
94 98