summaryrefslogtreecommitdiffstats
path: root/docs/feature_dip_switch.md
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2021-07-01 08:22:21 -0700
committerGitHub <noreply@github.com>2021-07-01 08:22:21 -0700
commit0bde920817ef458f2ad61a66ce76a2535bbc261b (patch)
tree9c7078bd67547fc44085cec1fbfbc82a47047161 /docs/feature_dip_switch.md
parent8f78be076debfc073741f1bc1ba424f1271191d9 (diff)
Convert Dip Switch callbacks to boolean functions (#13399)
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 15e449c4c4..5e8c19bfa7 100644
--- a/docs/feature_dip_switch.md
+++ b/docs/feature_dip_switch.md
@@ -23,8 +23,9 @@ or
The callback functions can be inserted into your `<keyboard>.c`:
```c
-void dip_switch_update_kb(uint8_t index, bool active) {
- dip_switch_update_user(index, active);
+bool dip_switch_update_kb(uint8_t index, bool active) {
+ if !(dip_switch_update_user(index, active)) { return false; }
+ return true;
}
```
@@ -32,7 +33,7 @@ void dip_switch_update_kb(uint8_t index, bool active) {
or `keymap.c`:
```c
-void dip_switch_update_user(uint8_t index, bool active) {
+bool dip_switch_update_user(uint8_t index, bool active) {
switch (index) {
case 0:
if(active) { audio_on(); } else { audio_off(); }
@@ -57,6 +58,7 @@ void dip_switch_update_user(uint8_t index, bool active) {
}
break;
}
+ return true;
}
```
@@ -64,8 +66,9 @@ Additionally, we support bit mask functions which allow for more complex handlin
```c
-void dip_switch_update_mask_kb(uint32_t state) {
- dip_switch_update_mask_user(state);
+bool dip_switch_update_mask_kb(uint32_t state) {
+ if (!dip_switch_update_mask_user(state)) { return false; }
+ return true;
}
```
@@ -73,7 +76,7 @@ void dip_switch_update_mask_kb(uint32_t state) {
or `keymap.c`:
```c
-void dip_switch_update_mask_user(uint32_t state) {
+bool dip_switch_update_mask_user(uint32_t state) {
if (state & (1UL<<0) && state & (1UL<<1)) {
layer_on(_ADJUST); // C on esc
} else {
@@ -89,6 +92,7 @@ void dip_switch_update_mask_user(uint32_t state) {
} else {
layer_off(_TEST_B);
}
+ return true;
}
```