-
Notifications
You must be signed in to change notification settings - Fork 809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Splitting BLE and BT Classic dependencies #332
Splitting BLE and BT Classic dependencies #332
Conversation
I know nothing about Bluetooth myself, but doing a couple of @peterharperuk Interestingly, |
It was a fairly last minute change to split pico_btstack_ble and pico_btstack_classic. I think we need some test code to check we don't break it again. |
@peterharperuk I really appreciate the work you've done here. For the changes that you requested at picow_bt_example_common.c, Please check this file. I believe that all changes are necessary. Please remove |
Similarly, some of the examples can be built for BLE only. Put back the packet_handler
I'll push a change that addresses my issues if that's ok? |
You didn't even wait my answer.. Please let me explain before going any further. I made two projects, one with your modifications and one with mine. Please check the code. If I do with yours I got these errors. /prj/src/picow_bt_example_common.c: In function 'packet_handler':
/prj/src/picow_bt_example_common.c:48:58: error: 'HCI_STATE_WORKING' undeclared (first use in this function)
48 | if (btstack_event_state_get_state(packet) != HCI_STATE_WORKING) return;
| ^~~~~~~~~~~~~~~~~
/prj/src/picow_bt_example_common.c:48:58: note: each undeclared identifier is reported only once for each function it appears in
/prj/src/picow_bt_example_common.c:49:13: warning: implicit declaration of function 'gap_local_bd_addr' [-Wimplicit-function-declaration]
49 | gap_local_bd_addr(local_addr);
| ^~~~~~~~~~~~~~~~~
[ 14%] Building C object CMakeFiles/PicoBTSPP.dir/Users/wizard/pico-sdk/src/rp2_common/pico_platform/platform.c.obj
/prj/src/picow_bt_example_common.c: In function 'picow_bt_example_init':
/prj/src/picow_bt_example_common.c:78:5: error: 'hci_event_callback_registration' undeclared (first use in this function); did you mean 'btstack_context_callback_registration_t'?
78 | hci_event_callback_registration.callback = &packet_handler;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| btstack_context_callback_registration_t
/prj/src/picow_bt_example_common.c:79:5: warning: implicit declaration of function 'hci_add_event_handler' [-Wimplicit-function-declaration]
79 | hci_add_event_handler(&hci_event_callback_registration);
| ^~~~~~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/PicoBTSPP.dir/src/picow_bt_example_common.c.obj] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/PicoBTSPP.dir/all] Error 2
make: *** [all] Error 2 |
I think they are just issues with the include files? Try adding #include "btstack.h" |
All these files, picow_bt_example_common.c, picow_bt_example_common.h, btstack_config.h taken from this repo. It should work without "btstack.h". But I hear you; even if I add #include "btstack.h," I still get this error. That's why I added ifdef. Could you please check the code and see yourself. /prj/src/picow_bt_example_common.c: In function 'picow_bt_example_init':
/prj/src/picow_bt_example_common.c:80:5: error: 'hci_event_callback_registration' undeclared (first use in this function); did you mean 'btstack_context_callback_registration_t'?
80 | hci_event_callback_registration.callback = &packet_handler;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| btstack_context_callback_registration_t
/prj/src/picow_bt_example_common.c:80:5: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [CMakeFiles/PicoBTSPP.dir/src/picow_bt_example_common.c.obj] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/PicoBTSPP.dir/all] Error 2
make: *** [all] Error 2 |
Try this |
I see, I missed but one thing, #include "btstack.h" was missing at pico_w/bt/picow_bt_example_common.c If we remove I agree with you. I wish you had said that beforehand. |
When only using BT Classic, we don't need to add
pico_btstack_ble
, but the current release doesn't let us do that. I got various compile errors.In my test application, when I add,
pico_btstack_ble
binary(uf2) size is 833KB.After this modifications, and removing
pico_btstack_ble
from config, binary(uf2) size reduce to 748KB.I think 85KB (833 -748) is a huge difference for applications that only need BT Classic. If you want me to create an issue or change anything, please let me know.