This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

adding libraries

How do you know what libraries to add when you decide to use an API function call? The documentation does not show that.

Parents
  • There is actually only one API and that's Nordic BLE stack aka Soft Device (functions have sd_ in their name). In case you use it then simply include ble.h from folder corresponding to your Soft Device type (e.g. components\softdevice\s132\headers\ble.h) and you are done. Then all the rest in SDK are rather stand-alone modules (or libraries if you want). There you either know what lib you want to use and how (and then you first find the functions in their header files and then logically include that header file in your project to be able to call that function).

    In case that this doesn't answer your problem then please be more specific, e.g. give us an example what are you doing and where you doubt what headers should be included and what source C files should be compiled.

Reply
  • There is actually only one API and that's Nordic BLE stack aka Soft Device (functions have sd_ in their name). In case you use it then simply include ble.h from folder corresponding to your Soft Device type (e.g. components\softdevice\s132\headers\ble.h) and you are done. Then all the rest in SDK are rather stand-alone modules (or libraries if you want). There you either know what lib you want to use and how (and then you first find the functions in their header files and then logically include that header file in your project to be able to call that function).

    In case that this doesn't answer your problem then please be more specific, e.g. give us an example what are you doing and where you doubt what headers should be included and what source C files should be compiled.

Children
  • I have actually asked this question in another thread at the same time. I was trying to follow "Bluetooth low energy Advertising, a beginner's tutorial" which is written for SDK11 which failed because I am using SDK14.1. Superpak told me to instead use the ble_app_blinky example. Now, I am trying to use this example with the same tutorial. However, when I try to add a suggested piece of code and build, I get an error complaining about missing declaration for sd_gap_address_set() and missing definition for BLE_GAP_ADDR_CYCLE_MODE_AUTO. Superpak suggested to add the peer_manager library (which unlike what you are saying is not a softdevice library). I included peer_manager.h to main.c and included peer_manager.c under a new folder in the project but I am still getting the same error. I tried to understand this function call from the documentation but found nothing about how to prepare for using it.

  • No, peer_manager is simply SDK module (library if you want) which is exactly what I wrote. It might have further dependencies and that's OK, just open SDK with some decent file manager and look for examples (C files) where it is used. Once you learn from these examples and their makefiles just include the same chain of header and C files for compilation and linking.

    And most importantly all SDK modules are in standard architecture of latest Nordic SDKs managed by single file in your project which is called sdk_config.h. Learn how to use this key element on Infocenter. I actually do believe that setting proper defines in your custom config overload should fix your project immediately (or at least that's the idea).

Related