-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from petejohanson/sensors/sensor-keymap-bindings
Add sensor handling to keymaps.
- Loading branch information
Showing
18 changed files
with
409 additions
and
153 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
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
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
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,19 @@ | ||
#include <dt-bindings/zmk/keys.h> | ||
|
||
/ { | ||
behaviors { | ||
inc_dec_kp: behavior_sensor_rotate_key_press { | ||
compatible = "zmk,behavior-sensor-rotate-key-press"; | ||
label = "ENC_KEY_PRESS"; | ||
usage_page = <USAGE_KEYPAD>; | ||
#sensor-binding-cells = <2>; | ||
}; | ||
|
||
inc_dec_cp: behavior_sensor_rotate_consumer_press { | ||
compatible = "zmk,behavior-sensor-rotate-key-press"; | ||
label = "ENC_CONSUMER_PRESS"; | ||
usage_page = <USAGE_CONSUMER>; | ||
#sensor-binding-cells = <2>; | ||
}; | ||
}; | ||
}; |
22 changes: 22 additions & 0 deletions
22
app/dts/bindings/behaviors/zmk,behavior-sensor-rotate-key-press.yaml
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,22 @@ | ||
# Copyright (c) 2020, Pete Johanson | ||
# SPDX-License-Identifier: MIT | ||
|
||
description: Sensor rotate key press/release behavior | ||
|
||
compatible: "zmk,behavior-sensor-rotate-key-press" | ||
|
||
properties: | ||
label: | ||
type: string | ||
required: true | ||
"#sensor-binding-cells": | ||
type: int | ||
required: true | ||
const: 2 | ||
usage_page: | ||
type: int | ||
default: 0 | ||
|
||
sensor-binding-cells: | ||
- param1 | ||
- param2 |
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,9 @@ | ||
description: | | ||
Allows defining the collection of sensors bound in the keymap layers | ||
compatible: "zmk,keymap-sensors" | ||
|
||
properties: | ||
sensors: | ||
type: phandles | ||
required: true |
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
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,19 @@ | ||
/* | ||
* Copyright (c) 2020 Peter Johanson <[email protected]> | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <zephyr.h> | ||
#include <zmk/event-manager.h> | ||
#include <device.h> | ||
|
||
struct sensor_event { | ||
struct zmk_event_header header; | ||
u8_t sensor_number; | ||
struct device *sensor; | ||
}; | ||
|
||
ZMK_EVENT_DECLARE(sensor_event); |
Oops, something went wrong.