From adfa1b5443e0a7ccaa973d69aac59ffbf8607d2f Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Wed, 22 Jul 2020 02:13:52 -0400 Subject: Initial work on sensor bindings. --- app/include/zmk/events/sensor-event.h | 19 +++++++++++++++++++ app/include/zmk/sensors.h | 11 +++++++++++ 2 files changed, 30 insertions(+) create mode 100644 app/include/zmk/events/sensor-event.h create mode 100644 app/include/zmk/sensors.h (limited to 'app/include') diff --git a/app/include/zmk/events/sensor-event.h b/app/include/zmk/events/sensor-event.h new file mode 100644 index 0000000..9bff0a9 --- /dev/null +++ b/app/include/zmk/events/sensor-event.h @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2020 Peter Johanson + * + * SPDX-License-Identifier: MIT + */ + +#pragma once + +#include +#include +#include + +struct sensor_event { + struct zmk_event_header header; + u8_t sensor_number; + struct sensor_value value; +}; + +ZMK_EVENT_DECLARE(sensor_event); \ No newline at end of file diff --git a/app/include/zmk/sensors.h b/app/include/zmk/sensors.h new file mode 100644 index 0000000..adb8ac5 --- /dev/null +++ b/app/include/zmk/sensors.h @@ -0,0 +1,11 @@ +/* + * Copyright (c) 2020 Peter Johanson + * + * SPDX-License-Identifier: MIT + */ + +#pragma once + +#define ZMK_KEYMAP_SENSORS_NODE DT_INST(0, zmk_keymap_sensors) +#define ZMK_KEYMAP_SENSORS_LEN DT_PROP_LEN(ZMK_KEYMAP_SENSORS_NODE, sensors) +#define ZMK_KEYMAP_SENSORS_BY_IDX(idx) DT_PHANDLE_BY_IDX(ZMK_KEYMAP_SENSORS_NODE, sensors, idx) \ No newline at end of file -- cgit v1.2.3