Browse Source

fix(test): off by one error with kscan processing

xmkb
Cody McGinnis 4 years ago
parent
commit
5b21f15a0a
  1. 3
      app/src/kscan_mock.c

3
app/src/kscan_mock.c

@ -72,12 +72,13 @@ static int kscan_mock_configure(struct device *dev, kscan_callback_t callback)
struct kscan_mock_data *data = \ struct kscan_mock_data *data = \
CONTAINER_OF(work, struct kscan_mock_data, work); \ CONTAINER_OF(work, struct kscan_mock_data, work); \
const struct kscan_mock_config_##n *cfg = data->dev->config_info; \ const struct kscan_mock_config_##n *cfg = data->dev->config_info; \
u32_t ev = cfg->events[data->event_index++]; \ u32_t ev = cfg->events[data->event_index]; \
LOG_DBG("ev %u row %d column %d state %d\n", ev, \ LOG_DBG("ev %u row %d column %d state %d\n", ev, \
ZMK_MOCK_ROW(ev), ZMK_MOCK_COL(ev), ZMK_MOCK_IS_PRESS(ev)); \ ZMK_MOCK_ROW(ev), ZMK_MOCK_COL(ev), ZMK_MOCK_IS_PRESS(ev)); \
data->callback(data->dev, \ data->callback(data->dev, \
ZMK_MOCK_ROW(ev), ZMK_MOCK_COL(ev), ZMK_MOCK_IS_PRESS(ev)); \ ZMK_MOCK_ROW(ev), ZMK_MOCK_COL(ev), ZMK_MOCK_IS_PRESS(ev)); \
kscan_mock_schedule_next_event_##n(data->dev); \ kscan_mock_schedule_next_event_##n(data->dev); \
data->event_index++; \
} \ } \
static int kscan_mock_init_##n(struct device *dev) \ static int kscan_mock_init_##n(struct device *dev) \
{ \ { \

Loading…
Cancel
Save