input: longpress, keymap: use an explicit callback name
Use an explicit callback name so that multiple instances of this do not result in a: redefinition of '_input_callback__longpress_cb' error. This used to work when it was using unique generated wrappers, but now it needs an index in the callback name. Use it in one of the API tests as well, just in case. Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
This commit is contained in:
parent
6d1b880fdc
commit
61129d8fd2
3 changed files with 7 additions and 5 deletions
|
@ -99,8 +99,8 @@ static int keymap_init(const struct device *dev)
|
||||||
KEYMAP_ENTRY_CODE(DT_PROP_BY_IDX(node_id, prop, idx)),
|
KEYMAP_ENTRY_CODE(DT_PROP_BY_IDX(node_id, prop, idx)),
|
||||||
|
|
||||||
#define INPUT_KEYMAP_DEFINE(inst) \
|
#define INPUT_KEYMAP_DEFINE(inst) \
|
||||||
INPUT_CALLBACK_DEFINE(DEVICE_DT_GET(DT_INST_PARENT(inst)), keymap_cb, \
|
INPUT_CALLBACK_DEFINE_NAMED(DEVICE_DT_GET(DT_INST_PARENT(inst)), keymap_cb, \
|
||||||
(void *)DEVICE_DT_INST_GET(inst)); \
|
(void *)DEVICE_DT_INST_GET(inst), keymap_cb_##inst); \
|
||||||
\
|
\
|
||||||
DT_INST_FOREACH_PROP_ELEM(inst, keymap, KEYMAP_ENTRY_VALIDATE) \
|
DT_INST_FOREACH_PROP_ELEM(inst, keymap, KEYMAP_ENTRY_VALIDATE) \
|
||||||
\
|
\
|
||||||
|
|
|
@ -109,8 +109,9 @@ static int longpress_init(const struct device *dev)
|
||||||
!DT_INST_NODE_HAS_PROP(inst, short_codes)); \
|
!DT_INST_NODE_HAS_PROP(inst, short_codes)); \
|
||||||
BUILD_ASSERT(DT_INST_PROP_LEN(inst, input_codes) == DT_INST_PROP_LEN(inst, long_codes)); \
|
BUILD_ASSERT(DT_INST_PROP_LEN(inst, input_codes) == DT_INST_PROP_LEN(inst, long_codes)); \
|
||||||
\
|
\
|
||||||
INPUT_CALLBACK_DEFINE(DEVICE_DT_GET_OR_NULL(DT_INST_PHANDLE(inst, input)), \
|
INPUT_CALLBACK_DEFINE_NAMED(DEVICE_DT_GET_OR_NULL(DT_INST_PHANDLE(inst, input)), \
|
||||||
longpress_cb, (void *)DEVICE_DT_INST_GET(inst)); \
|
longpress_cb, (void *)DEVICE_DT_INST_GET(inst), \
|
||||||
|
longpress_cb_##inst); \
|
||||||
\
|
\
|
||||||
static const uint16_t longpress_input_codes_##inst[] = DT_INST_PROP(inst, input_codes); \
|
static const uint16_t longpress_input_codes_##inst[] = DT_INST_PROP(inst, input_codes); \
|
||||||
\
|
\
|
||||||
|
|
|
@ -42,7 +42,8 @@ static void input_cb_unfiltered(struct input_event *evt, void *user_data)
|
||||||
k_sem_give(&cb_done);
|
k_sem_give(&cb_done);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
INPUT_CALLBACK_DEFINE(NULL, input_cb_unfiltered, NULL);
|
INPUT_CALLBACK_DEFINE_NAMED(NULL, input_cb_unfiltered, NULL,
|
||||||
|
input_cb_unfiltered_custom_name);
|
||||||
|
|
||||||
ZTEST(input_api, test_sequence_thread)
|
ZTEST(input_api, test_sequence_thread)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue