Calling BLE functions from outside main

HI,

We are working with nRF52832 chip for a custom product with OLED (ss1306) , external flash chip and QRcode sensor in it.

Successfully integrated the code which works as expected by properly configuring sdkconfig.h and related files.

But now our main.c is bulky and we are trying to separate the code to different functional blocks and managed to create custom components and code works fine.

Now we are converting the BLE functions as a separate block as we use ble_nus_data_send() functions in other blocks also.

but now we are able to send and receive nus data from the custom made ble function source code( same functions as different .c file), but these functions is not sending data when it is called in other .c files.

Application in a glance

QR code datas are scanned and the scanned data is saved in the external flash

We receive certain commands from BLE and we need to send responses accordingly.

On scanning QR codes , for some codes BLE data transfer is needed.

We are using SES v5.42a

SDK version 17.0.2.

Is it a good approach to change BLE functionalities from main.c ? Or is there any alternative methods to meet the requirement ?

Any help would be appreciated

thanks & regards

  • Hi,

    That was a mistake from the application code writen by me.

     ble_nus_t *p_m_nus3;
     p_m_nus3 = get_nus_instance();

     length=sizeof(RecvBuff);
     ResponseCode=ble_nus_data_send(p_m_nus3, RecvBuff, &length, m_conn_handle);
                   
    Now code works as expected , i can send BLE data using ble_nus_data_send() function from main.c as well as process.c

    Thanx Vidar for the support so far.

    Now i just started learning about nrfconnect sdk as we need to port the code to get maximum available options in development.

    Further support is anticipated. Thanks once again

    thanks & regards

Related