Refactor matrix transform, positions pervasively

* Do mapping to positions right in kscan handler, and then
  surface positions throughout the API.
This commit is contained in:
Pete Johanson
2020-06-20 17:54:52 -04:00
parent d65629b9a0
commit 7e659851c8
10 changed files with 95 additions and 51 deletions

View File

@@ -17,22 +17,22 @@
static const struct zmk_behavior_binding bindings[] =
{ UTIL_LISTIFY(BINDING_COUNT, BINDING_GEN, 0) };
int zmk_events_position_pressed(u32_t row, u32_t column)
int zmk_events_position_pressed(u32_t position)
{
for (int i = 0; i < BINDING_COUNT; i++) {
const struct zmk_behavior_binding *b = &bindings[i];
struct device *dev = device_get_binding(b->behavior_dev);
behavior_position_pressed(dev, row, column);
behavior_position_pressed(dev, position, 0);
}
return 0;
};
int zmk_events_position_released(u32_t row, u32_t column)
int zmk_events_position_released(u32_t position)
{
for (int i = 0; i < BINDING_COUNT; i++) {
const struct zmk_behavior_binding *b = &bindings[i];
struct device *dev = device_get_binding(b->behavior_dev);
behavior_position_released(dev, row, column);
behavior_position_released(dev, position, 0);
}
return 0;
}