zoukankan      html  css  js  c++  java
  • TDOA 之 基站逻辑代码实现

    在前一篇博文里描述了基站的逻辑部分,这里贴出来具体代码实现。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;             
  • 相关阅读:
    字符串匹配——KMP算法(C++)
    数论——Fibonacci数列(C++)
    数据结构——线段树之二(C++)
    数据结构——线段树之一(C++)
    最后的最后
    开始的开始
    10.25模拟 保留道路
    10.25模拟 列车调度
    10.25模拟 三角形
    洛谷 P1093 奖学金
  • 原文地址:https://www.cnblogs.com/tuzhuke/p/11696326.html
Copyright © 2011-2022 走看看