KW40z "heart rate sensor" BLE problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

KW40z "heart rate sensor" BLE problem

Jump to solution
859 Views
chaosmagin
Contributor I

Hello!!

I am programming board KW40Z and implementing some sample code.
In the "heart rate sensor" example, I need to press button SW4 to turn on the bluetooth.

Can anyone advise what to do in the code to turn on the bluetooth as the power is on?

Thank you very much!

1 Solution
663 Views
danielkresta
NXP Employee
NXP Employee

Hello Chao,

you will need to use the function BleApp_Start from the app.c in the example project. This function is called from the BleApp_HandleKeys callback by default and you can use it whenever you need it.

If you want to start advertising at the beginning of the application, I would advise to put the function to the BleApp_GenericCallback in the gInitializationComplete_c event type case, so the code would look like this:

void BleApp_GenericCallback (gapGenericEvent_t* pGenericEvent)
{
    switch (pGenericEvent->eventType)
    {
        case gInitializationComplete_c:   
        {
            BleApp_Config();
            BleApp_Start();
        }
        break; 

        /* ... */
    }
}

Hope this helps,
Daniel

View solution in original post

2 Replies
664 Views
danielkresta
NXP Employee
NXP Employee

Hello Chao,

you will need to use the function BleApp_Start from the app.c in the example project. This function is called from the BleApp_HandleKeys callback by default and you can use it whenever you need it.

If you want to start advertising at the beginning of the application, I would advise to put the function to the BleApp_GenericCallback in the gInitializationComplete_c event type case, so the code would look like this:

void BleApp_GenericCallback (gapGenericEvent_t* pGenericEvent)
{
    switch (pGenericEvent->eventType)
    {
        case gInitializationComplete_c:   
        {
            BleApp_Config();
            BleApp_Start();
        }
        break; 

        /* ... */
    }
}

Hope this helps,
Daniel

663 Views
chaosmagin
Contributor I

Hi Daniel,

It works perfectly.

Thanks for your help!

Smagin