| | |
| | | #include "dw_app.h" |
| | | #include "ADC.h" |
| | | #include "stm32f10x_it.h" |
| | | #define TDFILTER |
| | | enum enumtagstate |
| | | { |
| | |
| | | u8 exsistbase_list[MAX_NEARBASE_NUM],report_num,get_newbase=0,uwbrec_userdata[20],uwbrec_userdatalen; |
| | | u16 temp_sync_timer1,temp_sync_timer2; |
| | | extern u8 usartrec_userdatalen,heartbeat_timer; |
| | | void NearPoll(void) |
| | | void NearPoll(void) |
| | | { |
| | | static u8 mainbase_lost_count=0,flag_finalsend,flag_rxon; |
| | | uint32_t temp1,temp2,dw_systime; |
| | |
| | | memcpy(&tmp_time,&rx_buffer[ANCTIMEUS],2); |
| | | |
| | | |
| | | if(g_com_map[DEV_ROLE]!=0) |
| | | { |
| | | sync_timer=temp_sync_timer1; |
| | | //// memcpy(&tagslotpos,&rx_buffer[TAGSLOTPOS],2); |
| | | // if(g_com_map[DEV_ROLE]!=0) |
| | | // { |
| | | // sync_timer=temp_sync_timer1; |
| | | ////// memcpy(&tagslotpos,&rx_buffer[TAGSLOTPOS],2); |
| | | //// |
| | | // |
| | | |
| | | tmp_time=tmp_time+650; |
| | | if(tmp_time>999) |
| | | { |
| | | tmp_time-=999; |
| | | sync_timer++; |
| | | if(sync_timer>=1000) |
| | | {sync_timer=0;} |
| | | } |
| | | TIM3->CNT=tmp_time; |
| | | } |
| | | // tmp_time=tmp_time+650; |
| | | // if(tmp_time>999) |
| | | // { |
| | | // tmp_time-=999; |
| | | // sync_timer++; |
| | | // if(sync_timer>=1000) |
| | | // {sync_timer=0;} |
| | | // } |
| | | // TIM3->CNT=tmp_time; |
| | | // } |
| | | current_slotnum=temp_sync_timer1/g_com_map[COM_INTERVAL]; |
| | | // if(tagslotpos>max_slotpos) |
| | | // tagslotpos=tagslotpos%(max_slotpos+1); |
| | |
| | | // temp_adc=Get_ADC_Value(); |
| | | // random_value=random_value|((temp_adc&0x01)<<i); |
| | | // } |
| | | pollsendtimer+=time32_incr%11; |
| | | tagslotpos=GetRandomSlotPos(rec_tagpos_binary|tagpos_binary); |
| | | tyncpoll_time = (tagslotpos--%max_slotpos)*slottime; |
| | | tag_state=NEARPOLL; |
| | | tag_state=NEARPOLL; |
| | | } |
| | | // tyncpoll_time=0; |
| | | next_nearbase_num=0; |