-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moving BT control stuff to a dtsi to be included in multiple keymaps.
- Loading branch information
Showing
3 changed files
with
78 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright (c) 2024 Allister MacLeod | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
// Devicetree include for sharing miscellaneous utility code between | ||
// my various ZMK keymaps. Other .dtsi files in this directory have | ||
// more specific themes: | ||
// - glam-multigraph.dtsi is about character-sequence macros | ||
|
||
// NOTE: Assumptions! | ||
// This dtsi assumes that you will be including it from a file where | ||
// there is a #define for the KEEBCTL layer number. This is needed so | ||
// that the Bluetooth macros can toggle the keyboard control layer | ||
// off after doing their thing. | ||
// This dtsi must be included after the #define KEEBCTL line. | ||
|
||
/ { | ||
|
||
macros { | ||
// Select a specific Bluetooth profile and then toggle the | ||
// keyboard control layer; this is intended to deactivate that layer | ||
// when activated from within it. | ||
btsel: bluetooth_select_and_toggle { | ||
compatible = "zmk,behavior-macro-one-param"; | ||
#binding-cells = <1>; | ||
bindings | ||
= <¯o_param_1to2> | ||
, <&bt BT_SEL MACRO_PLACEHOLDER> | ||
, <¯o_pause_for_release> | ||
, <&tog KEEBCTL> | ||
; | ||
}; | ||
// Clear a specific Bluetooth profile, relying on the &btsel macro to | ||
// toggle the layer. | ||
btclr: bluetooth_clear_and_toggle { | ||
compatible = "zmk,behavior-macro-one-param"; | ||
#binding-cells = <1>; | ||
bindings | ||
= <¯o_param_1to1> | ||
, <&btsel MACRO_PLACEHOLDER> | ||
, <&bt BT_CLR> | ||
; | ||
}; | ||
// Clear the current Bluetooth profile and toggle the keyboard | ||
// control layer. | ||
btcc: bluetooth_clear_current_and_toggle { | ||
compatible = "zmk,behavior-macro"; | ||
#binding-cells = <0>; | ||
bindings = <&bt BT_CLR>, <&tog KEEBCTL>; | ||
}; | ||
// Clear all Bluetooth profiles and toggle the keyboard control | ||
// layer. | ||
btclall: bluetooth_clear_all_and_toggle { | ||
compatible = "zmk,behavior-macro"; | ||
#binding-cells = <0>; | ||
bindings = <&bt BT_CLR_ALL>, <&tog KEEBCTL>; | ||
}; | ||
}; | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters