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!
已解决! 转到解答。
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
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