From 0bde920817ef458f2ad61a66ce76a2535bbc261b Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Thu, 1 Jul 2021 08:22:21 -0700 Subject: Convert Dip Switch callbacks to boolean functions (#13399) --- docs/feature_dip_switch.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'docs/feature_dip_switch.md') 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 `.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; } ``` -- cgit v1.2.3 From d972919204a5f1cb96d4e16c765d7028a423888a Mon Sep 17 00:00:00 2001 From: Dasky <32983009+daskygit@users.noreply.github.com> Date: Sat, 24 Jul 2021 18:44:31 +0100 Subject: [Docs] Fix typo in dip switch example (#13688) --- docs/feature_dip_switch.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/feature_dip_switch.md') diff --git a/docs/feature_dip_switch.md b/docs/feature_dip_switch.md index 5e8c19bfa7..43a6a3faf7 100644 --- a/docs/feature_dip_switch.md +++ b/docs/feature_dip_switch.md @@ -24,7 +24,7 @@ The callback functions can be inserted into your `.c`: ```c bool dip_switch_update_kb(uint8_t index, bool active) { - if !(dip_switch_update_user(index, active)) { return false; } + if (!dip_switch_update_user(index, active)) { return false; } return true; } ``` -- cgit v1.2.3 From 9d1c98c891bb8e1e98dc618e0693a7efff23a22e Mon Sep 17 00:00:00 2001 From: XScorpion2 Date: Thu, 19 Aug 2021 12:39:15 -0500 Subject: Added right vs left specific pin assignments for dip switch (#13074) * Added right vs left specific pin assignments for dip switch * Update feature_dip_switch.md * Ran formatting tools --- docs/feature_dip_switch.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'docs/feature_dip_switch.md') diff --git a/docs/feature_dip_switch.md b/docs/feature_dip_switch.md index 43a6a3faf7..6fbe91657d 100644 --- a/docs/feature_dip_switch.md +++ b/docs/feature_dip_switch.md @@ -9,6 +9,8 @@ and this to your `config.h`: ```c // Connects each switch in the dip switch to the GPIO pin of the MCU #define DIP_SWITCH_PINS { B14, A15, A10, B9 } +// For split keyboards, you can separately define the right side pins +#define DIP_SWITCH_PINS_RIGHT { ... } ``` or @@ -96,7 +98,6 @@ bool dip_switch_update_mask_user(uint32_t state) { } ``` - ## Hardware ### Connects each switch in the dip switch to the GPIO pin of the MCU -- cgit v1.2.3