KW40z "heart rate sensor" BLE problem

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

KW40z "heart rate sensor" BLE problem

跳至解决方案
911 次查看
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 解答
715 次查看
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

在原帖中查看解决方案

2 回复数
716 次查看
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

715 次查看
chaosmagin
Contributor I

Hi Daniel,

It works perfectly.

Thanks for your help!

Smagin