Update multi_button.c

Adjust the order of initializing member variables. "button_id" is not correctly initialized when the first call of  "hal_button_Level".
pull/37/head
zjd190319 3 years ago committed by GitHub
parent 492571c777
commit b40beb9595
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -23,9 +23,9 @@ void button_init(struct Button* handle, uint8_t(*pin_level)(uint8_t), uint8_t ac
memset(handle, 0, sizeof(struct Button));
handle->event = (uint8_t)NONE_PRESS;
handle->hal_button_Level = pin_level;
handle->button_id = button_id;
handle->button_level = handle->hal_button_Level(button_id);
handle->active_level = active_level;
handle->button_id = button_id;
}
/**

Loading…
Cancel
Save