码迷,mamicode.com
首页 > 其他好文 > 详细

TDOA 之 基站逻辑代码实现

时间:2019-10-18 09:38:04      阅读:118      评论:0      收藏:0      [点我收藏+]

标签:bre   信息部   logs   sage   html   cas   mes   pre   span   

在前一篇博文里描述了基站的逻辑部分,这里贴出来具体代码实现。https://www.cnblogs.com/tuzhuke/p/11689881.html

1 Sync 信息部分

case S:
            //save seq
            bphero_sync_message[bphero_sync_count].seq_num = msg_f->seqNum;
            //save rx timestamp
            bphero_sync_message[bphero_sync_count].rx_timestamp = get_rx_timestamp_u64();
            //save delayed tx timestamp
            //bphero_sync_message[bphero_sync_count].rx_timestamp = final_msg_get_ts();
            //save shortaddr
            bphero_sync_message[bphero_sync_count].shortaddr = msg_f->sourceAddr[1]<<8|msg_f->sourceAddr[0];

            bphero_sync_count++;
            if(bphero_sync_count == 2)
            {
                //判断连续两次Sync信号是否连续
                if(bphero_sync_message[1].seq_num = bphero_sync_message[0].seq_num + 1)//uint8,255+1 = 0
                {
                    //判断两个sync信号之间知否有Tag信号
                    if(bphero_tag_num>0)
                    {
                        //将收到的SYNC 信号和TAG 信号全部通过串口送出去
                    }
                }
                //只要接收到两个SYNC信号,就要清除目前所有信息
                bphero_tag_num = 0;
                bphero_sync_count=0;

2 TAG信息部分

 case T:
        //save seq
        bphero_tag_message[bphero_tag_num].seq_num = msg_f->seqNum;
        //save rx timestamp
        bphero_tag_message[bphero_tag_num].rx_timestamp = get_rx_timestamp_u64();
        //save delayed tx timestamp
        // bphero_tag_message[bphero_tag_num].rx_timestamp = final_msg_get_ts();
        //save shortaddr
        bphero_tag_message[bphero_tag_num].shortaddr = msg_f->sourceAddr[1]<<8|msg_f->sourceAddr[0];

        bphero_tag_num++;
        if(bphero_tag_num == MAX_TAG_NODE )
        {
            bphero_tag_num = 0;
        }
        break;             

 

TDOA 之 基站逻辑代码实现

标签:bre   信息部   logs   sage   html   cas   mes   pre   span   

原文地址:https://www.cnblogs.com/tuzhuke/p/11696326.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!