| | |
| | | int8_t tag_delaytime; |
| | | extern uint16_t sync_timer; |
| | | u16 tmp_time; |
| | | extern float dw_vbat; |
| | | void Tag_App(void)//å鿍¡å¼(TAGæ ç¾) |
| | | { |
| | | uint32_t frame_len; |
| | | uint32_t final_tx_time; |
| | | u32 start_poll; |
| | | u8 i,getsync_flag=0; |
| | | u8 bat_percent; |
| | | //LED0_ON; |
| | | dwt_forcetrxoff(); |
| | | g_Resttimer=0; |
| | | dwt_setrxaftertxdelay(POLL_TX_TO_RESP_RX_DLY_UUS); //设置åéåå¼å¯æ¥æ¶ï¼å¹¶è®¾å®å»¶è¿æ¶é´ |
| | | dwt_setrxtimeout(RESP_RX_TIMEOUT_UUS); |
| | | tag_succ_times = 0; |
| | | tx_poll_msg[BATTARY_IDX] = Get_Battary(); |
| | | bat_percent=(dw_vbat-2.8)/0.5*100; |
| | | if(bat_percent>100) |
| | | bat_percent=100; |
| | | tx_poll_msg[BATTARY_IDX] = bat_percent;//Get_Battary(); |
| | | tx_poll_msg[BUTTON_IDX] = !READ_KEY0; |
| | | tx_poll_msg[SEQUENCE_IDX] = frame_seq_nb++; |
| | | GPIO_WriteBit(GPIOA, GPIO_Pin_9, Bit_RESET); |
| | |
| | | memcpy(&usart_send[7],&rx_buffer[ANCHOR_ID_IDX],2); |
| | | |
| | | memcpy(&usart_send[9],&hex_dist2,4); |
| | | usart_send[13] = battary; |
| | | usart_send[13] = bat_percent; |
| | | usart_send[14] = button; |
| | | checksum = Checksum_u16(&usart_send[2],17); |
| | | memcpy(&usart_send[19],&checksum,2); |