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.
how to set multiple key with key api??
Who is online
Users browsing this forum: No registered users and 325 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.