feat(behaviors): Add key position to key events

Extended the virtual key position system from combos so that each sensor
also gets a virtual key position. This allows sensor behaviors to use
the behavior queue API.
This commit is contained in:
Joel Spadin
2022-10-29 23:17:12 -05:00
committed by Pete Johanson
parent 83a151890c
commit e7a6e4016d
6 changed files with 44 additions and 12 deletions

View File

@@ -0,0 +1,20 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#pragma once
#include <zmk/matrix.h>
#include <zmk/sensors.h>
/**
* Gets the virtual key position to use for the sensor with the given index.
*/
#define ZMK_VIRTUAL_KEY_POSITION_SENSOR(index) (ZMK_KEYMAP_LEN + (index))
/**
* Gets the virtual key position to use for the combo with the given index.
*/
#define ZMK_VIRTUAL_KEY_POSITION_COMBO(index) (ZMK_KEYMAP_LEN + ZMK_KEYMAP_SENSORS_LEN + (index))