硬件:STEVAL-IDB011V开发板 软件:开启两个虚拟定时器,一个定时读取外设 一个定时关闭广播 sensorTimerHandle.callback = SensorUpdateTimeoutCB;
ret = HAL_VTIMER_StartTimerMs(&sensorTimerHandle, acceleration_update_rate);
if (ret != BLE_STATUS_SUCCESS) {
PRINTF("HAL_VTIMER_StartTimerMs() failed; 0x%02x\r\n", ret);
return ret;
} else {
sensorTimer_expired = FALSE;
}
broadcastTimerHandle.callback = broadcastUpdateTimeoutCB;
ret = HAL_VTIMER_StartTimerMs(&broadcastTimerHandle, broadcast_update_rate);
if (ret != BLE_STATUS_SUCCESS) {
PRINTF("HAL_VTIMER_StartTimerMs() failed; 0x%02x\r\n", ret);
return ret;
} else {
broadcastTimer_expired = FALSE;
} while循环使用HAL_PWR_MNGR_Request(POWER_SAVE_LEVEL_STOP_WITH_TIMER , wakeupIO, &stopLevel); 休眠状态 当static uint16_t acceleration_update_rate = 4000; static uint16_t broadcast_update_rate = 1000; 循环时间设置为这样可以正常关闭广播切虚拟时间正常唤醒 当static uint16_t acceleration_update_rate = 2000; static uint16_t broadcast_update_rate = 1000; 循环时间设置为这样可以正常关闭广播切但是 虚拟时间无法唤醒
|