【问题描述】函数
最开始contiki OS运行正常,rtimer定时打印出消息。后面修改代码,将s_stRTimer.func = temp_func;改成了s_stRTimer.func = NULL;以后,ui
【问题处理】spa
将.func属性赋为有效函数;code
void test_StartTimer(uint16_t wMs) { uint16_t wCount; s_stRTimer.func = temp_func; /* Conver millisecond to Hz of rtimer */ wCount = (uint32_t)wMs * RTIMER_ARCH_SECOND / 1000; HAL_UART_Transmit(&huart2, "rtimer set\r\n", strlen("rtimer set\r\n"), 50); /* Set rtimer as well as start it! */ rtimer_set(&s_stRTimer, RTIMER_NOW() + wCount, 0, s_stRTimer.func, NULL); return; } void temp_func() { HAL_UART_Transmit(&huart2, "xxx\r\n", strlen("xxx\r\n"), 10); }
【小结】it
据此推断:使用Contiki OS之rtimer时,不能将struct rtimer s_stRTimer的.func属性设置为NULL。class