E:原子资料探索者F4探索者F4 资料盘(A盘)4,程序源码3,扩展例程4,UCOS扩展例程例11-1 UCOSIII消息传递 例程中
#define DATAMSG_Q_NUM 4
void tmr1_callback(void *p_tmr,void *p_arg)
{
u8 *pbuf;
static u8 msg_num;
OS_ERR err;
pbuf = mymalloc(SRAMIN,10);
if(pbuf)
{
msg_num++;
sprintf((char*)pbuf,"ALIENTEKoo %d",msg_num);
OSQPost((OS_Q* )&DATA_Msg,
(void* )pbuf,
(OS_MSG_SIZE)10,
(OS_OPT )OS_OPT_POST_FIFO,
(OS_ERR* )&err);
if(err != OS_ERR_NONE)
{
myfree(SRAMIN,pbuf);
OSTmrStop(&tmr1,OS_OPT_TMR_NONE,0,&err);
tmr1sta = !tmr1sta;
LCD_ShowString(10,150,100,16,16,"TMR1 STOP! ");
}
}
}
定时器回调函数msg_num的最大值为什么是DATAMSG_Q_NUM的2倍才post完成??? |