refactor(core): Extra position state change data struct.

* Separate header and data struct for the event.
* Remove duplicate struct in split code.
This commit is contained in:
Pete Johanson
2021-01-17 16:36:01 -05:00
parent 95acbd8859
commit 003db892ad
6 changed files with 31 additions and 34 deletions

View File

@@ -249,7 +249,8 @@ int zmk_keymap_sensor_triggered(uint8_t sensor_number, const struct device *sens
int keymap_listener(const struct zmk_event_header *eh) {
if (is_position_state_changed(eh)) {
const struct position_state_changed *ev = cast_position_state_changed(eh);
return zmk_keymap_position_state_changed(ev->position, ev->state, ev->timestamp);
return zmk_keymap_position_state_changed(ev->data.position, ev->data.state,
ev->data.timestamp);
#if ZMK_KEYMAP_HAS_SENSORS
} else if (is_sensor_event(eh)) {
const struct sensor_event *ev = cast_sensor_event(eh);