how to set multiple key with key api??

JacksonLv
Posts: 7
Joined: Thu Aug 10, 2017 11:06 am

how to set multiple key with key api??

Postby JacksonLv » Fri Jan 26, 2018 4:55 pm

Now I can set one key with the api in key.c doc and I want to set multiple key with the api.
I do it as below :
[static struct keys_param button_param[2];
static struct single_key_param *light_button_single;
static struct single_key_param *mist_button_single;

PIN_FUNC_SELECT(LIGHT_BUTTON_IO_MUX, LIGHT_BUTTON_IO_FUNC);
PIN_FUNC_SELECT(MIST_BUTTON_IO_MUX, MIST_BUTTON_IO_FUNC);

light_button_single = key_init_single( LIGHT_BUTTON_IO_NUM, LIGHT_BUTTON_IO_MUX,
LIGHT_BUTTON_IO_FUNC,
&Light_Button_LongPress_Handler,
&Light_Button_ShortPress_Handler );
button_param[0].key_num = 1;
button_param[0].single_key = &light_button_single;

mist_button_single = key_init_single( MIST_BUTTON_IO_NUM, MIST_BUTTON_IO_MUX,
MIST_BUTTON_IO_FUNC,
&Mist_Button_LongPress_Handler,
&Mist_Button_ShortPress_Handler );
button_param[1].key_num = 2;
button_param[1].single_key = &mist_button_single;

key_init( button_param );
PIN_PULLUP_EN(LIGHT_BUTTON_IO_MUX);
PIN_PULLUP_EN(MIST_BUTTON_IO_MUX);
][/code]

but I only can control one key,just don't know why.

Who is online

Users browsing this forum: No registered users and 10 guests