CC2640 的软件定时器问题Util_constructClock
时间:10-02
整理:3721RD
点击:
Util_constructClock(&periodicClock,SimpleBLEPeripheral_clockHandler,50, 150, false, SBP_PERIODIC_EVT); 我设置了定时器,第一次50周期,第二次150周期。 然后Util_startClock(&periodicClock); 启动了定时器 if (events & SBP_PERIODIC_EVT) { events &= ~SBP_PERIODIC_EVT; // Perform periodic application task SimpleBLEPeripheral_performPeriodicTask(); // led 流水灯 if(TEST_LED_MODE_ALL_BLINK == my_led_mode) { static int count = 0; HalLedSet(HAL_LED_1 | HAL_LED_2 | HAL_LED_3 | HAL_LED_4, HAL_LED_MODE_TOGGLE); if(++count > 20) { HalLedSet(HAL_LED_1 | HAL_LED_2 | HAL_LED_3 | HAL_LED_4, HAL_LED_MODE_OFF); my_led_mode = TEST_LED_MODE_ALL_FLOW; } } else if(TEST_LED_MODE_ALL_FLOW == my_led_mode) { static uint8 i = 0; static int count = 0; uint8 ledshow[] = {HAL_LED_1, HAL_LED_1, HAL_LED_2, HAL_LED_2, HAL_LED_3, HAL_LED_3, HAL_LED_4, HAL_LED_4, HAL_LED_3, HAL_LED_3, HAL_LED_2, HAL_LED_2}; HalLedSet(ledshow[i], HAL_LED_MODE_TOGGLE); i++; i %= (sizeof(ledshow)); if(++count > ((sizeof(ledshow))*5)) { HalLedSet(HAL_LED_1 | HAL_LED_2 | HAL_LED_3 | HAL_LED_4, HAL_LED_MODE_OFF); my_led_mode = TEST_LED_MODE_KEY_CTRL; } } } =========第一次定时器到了执行了上面的灯的花样变化========== 问题来了,第一次转型完成,为何不执行第二次啊,感觉定时器关了好像
jucai,
你找代码里面,Util_stopClock(&periodicClock);
把这些都注销掉试试?