refactor(sensors): Sensor event channel data, resolution tweaks.

* Refactor sensor events to include channel data,
  necessary for prop split encoders, and avoiding duplicate calls,
  to fetch channel data twice, etc.
* More consistent behavior driver API.
* Allow setting triggers per resolution at the behavior level optionally.
This commit is contained in:
Peter Johanson
2021-09-01 03:49:18 +00:00
committed by Pete Johanson
parent dcf5e75fa6
commit 2244bd3d81
12 changed files with 258 additions and 83 deletions

View File

@@ -6,12 +6,21 @@
#pragma once
#include <zephyr/kernel.h>
#include <zephyr/drivers/sensor.h>
#include <zmk/event_manager.h>
#include <zephyr/device.h>
#include <zmk/sensors.h>
#include <device.h>
// TODO: Move to Kconfig when we need more than one channel
#define ZMK_SENSOR_EVENT_MAX_CHANNELS 1
struct zmk_sensor_event {
uint8_t sensor_number;
const struct device *sensor;
uint8_t sensor_position;
size_t channel_data_size;
struct zmk_sensor_channel_data channel_data[ZMK_SENSOR_EVENT_MAX_CHANNELS];
int64_t timestamp;
};