feat(split): Make locality work nested behavior invocations

Co-authored-by: Tokazio <tokazio@hotmail.com>
This commit is contained in:
Cem Aksoylar
2023-01-17 19:05:04 +01:00
committed by Pete Johanson
parent 11f600d9e5
commit 9e36ebd525
13 changed files with 146 additions and 105 deletions

View File

@@ -26,6 +26,7 @@ struct zmk_behavior_binding_event {
int layer;
uint32_t position;
int64_t timestamp;
uint8_t source;
};
/**
@@ -42,6 +43,19 @@ struct zmk_behavior_binding_event {
*/
const struct device *zmk_behavior_get_binding(const char *name);
/**
* @brief Invoke a behavior given its binding and invoking event details.
*
* @param src_binding Behavior binding to invoke.
* @param event The binding event struct containing details of the event that invoked it.
* @param pressed Whether the binding is pressed or released.
*
* @retval 0 If successful.
* @retval Negative errno code if failure.
*/
int zmk_behavior_invoke_binding(const struct zmk_behavior_binding *src_binding,
struct zmk_behavior_binding_event event, bool pressed);
/**
* @brief Get a local ID for a behavior from its @p name field.
*

View File

@@ -10,5 +10,5 @@
#include <stdint.h>
#include <zmk/behavior.h>
int zmk_behavior_queue_add(uint32_t position, const struct zmk_behavior_binding behavior,
bool press, uint32_t wait);
int zmk_behavior_queue_add(uint32_t position, uint8_t source,
const struct zmk_behavior_binding behavior, bool press, uint32_t wait);

View File

@@ -20,6 +20,7 @@ struct sensor_event {
struct zmk_split_run_behavior_data {
uint8_t position;
uint8_t source;
uint8_t state;
uint32_t param1;
uint32_t param2;