example: fix build

This commit is contained in:
Matthias Ringwald 2021-11-16 11:09:15 +01:00
parent 9f0b00b154
commit 441a7ef1e8
2 changed files with 13 additions and 7 deletions

View File

@ -98,6 +98,7 @@ const uint8_t hid_descriptor_mouse_boot_mode[] = {
};
static btstack_packet_callback_registration_t hci_event_callback_registration;
static btstack_packet_callback_registration_t l2cap_event_callback_registration;
static btstack_packet_callback_registration_t sm_event_callback_registration;
static uint8_t battery = 100;
static hci_con_handle_t con_handle = HCI_CON_HANDLE_INVALID;
@ -119,10 +120,8 @@ const uint8_t adv_data_len = sizeof(adv_data);
static void hog_mouse_setup(void){
// setup l2cap and register for connection parameter updates
// setup l2cap and
l2cap_init();
l2cap_register_packet_handler(&packet_handler);
// setup le device db
le_device_db_init();
@ -159,6 +158,10 @@ static void hog_mouse_setup(void){
hci_event_callback_registration.callback = &packet_handler;
hci_add_event_handler(&hci_event_callback_registration);
// register for connection parameter updates
l2cap_event_callback_registration.callback = &packet_handler;
l2cap_add_event_handler(&l2cap_event_callback_registration);
sm_event_callback_registration.callback = &packet_handler;
sm_add_event_handler(&sm_event_callback_registration);

View File

@ -73,7 +73,8 @@ const uint8_t adv_data[] = {
};
const uint8_t adv_data_len = sizeof(adv_data);
static btstack_packet_callback_registration_t event_callback_registration;
static btstack_packet_callback_registration_t hci_event_callback_registration;
static btstack_packet_callback_registration_t l2cap_event_callback_registration;
static btstack_packet_callback_registration_t sm_event_callback_registration;
// support for multiple clients
@ -117,14 +118,16 @@ static void le_data_channel_setup(void){
att_server_init(profile_data, NULL, NULL);
// register for HCI events
event_callback_registration.callback = &packet_handler;
hci_add_event_handler(&event_callback_registration);
hci_event_callback_registration.callback = &packet_handler;
hci_add_event_handler(&hci_event_callback_registration);
// register for SM events
sm_event_callback_registration.callback = &sm_packet_handler;
sm_add_event_handler(&sm_event_callback_registration);
l2cap_register_packet_handler(&packet_handler);
// register for L2CAP events
l2cap_event_callback_registration.callback = &packet_handler;
l2cap_add_event_handler(&sm_event_callback_registration);
// le data channel setup
l2cap_le_register_service(&packet_handler, TSPX_le_psm, LEVEL_0);