BLE的循环程序
if ( events & KFD_ACCEL_READ_EVT )
{
// if device is not in a connection, pressing the right key should toggle
// advertising on and off
if( gapProfileState != GAPROLE_CONNECTED )
{
uint8 current_adv_enabled_status;
uint8 new_adv_enabled_status;
//Find the current GAP advertisement status
GAPRole_GetParameter( GAPROLE_ADVERT_ENABLED, ¤t_adv_enabled_status );
if( current_adv_enabled_status == FALSE )
{
new_adv_enabled_status = TRUE;
}
else
{
new_adv_enabled_status = FALSE;
}
//change the GAP advertisement status to opposite of current status
GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &new_adv_enabled_status );
}
osal_start_timerEx( keyfobapp_TaskID, KFD_ACCEL_READ_EVT, 5000 );
return (events ^ KFD_ACCEL_READ_EVT);
}
目的:CC2541 蓝牙 广播状态与关广播后进入PM2 两个状态相互切换5S一次
现象:广播开启一次后一直处于PM2状态
问题:怎么修改?
原来是在其他地方有句osal_stop_timerEx( keyfobapp_TaskID, KFD_ACCEL_READ_EVT); 没看到