| | |
| | | uint8_t flag_sleeptimer,flag_secondtask,secondtask_count; |
| | | uint8_t lora_wg_up=0; |
| | | extern uint8_t lora_tx_flag; |
| | | uint32_t maintime; |
| | | static void sleep_timer_callback(void *dev, uint32_t time) |
| | | { |
| | | maintime++; |
| | | g_start_send_flag=1; |
| | | // #ifdef DEBUG_BOXING |
| | | //// gpio_pin_clr(IO_PIN_5);//测试 |
| | |
| | | no_rx_flag=0; |
| | | tx_flag=rf_get_transmit_flag(); |
| | | recv_flag=rf_get_recv_flag(); |
| | | if(recv_flag == RADIO_FLAG_RXDONE) |
| | | if(recv_flag == RADIO_FLAG_RXDONE) |
| | | { |
| | | rf_set_recv_flag(RADIO_FLAG_IDLE); |
| | | |
| | | memcpy(RX_Buffer,RxDoneParams.Payload,RxDoneParams.Size); |
| | | BufferSize=RxDoneParams.Size; |
| | | lora_huanxing_count++; |
| | | if(RX_Buffer[MSG_TYPE_IDX]==LORA_MSGTYPE_RANGEPOLL) |
| | | { |
| | | |
| | | // time_flag_lorarx=phy_timer_count_get(); |
| | | uwb_open(); |
| | | gpio_pin_clr(IO_PIN_5);//测试 |
| | | UwbRange(); |
| | | |
| | | uwb_ceju_count++; |
| | | } |
| | | // if(RX_Buffer[0]==0x04,RX_Buffer[1]=='O',RX_Buffer[2]=='N',RX_Buffer[3]=='G') |
| | | // { |
| | | // gpio_pin_set(IO_PIN_5);//测试 |
| | | //// time_flag_lorarx=phy_timer_count_get(); |
| | | // uwb_open(); |
| | | // gpio_pin_clr(IO_PIN_5); |
| | | // UwbRange(); |
| | | // |
| | | // uwb_ceju_count++; |
| | | // //rf_enter_continous_rx(); //重新进入接收模式 |
| | | // //LORA_REV_uwb_up=1; |
| | | // } |
| | | if(RX_Buffer[MSG_TYPE_IDX]==LORA_MSGTYPE_WGRESPTAG) |
| | | { |
| | | checksum1=Checksum_u16(RX_Buffer,BufferSize-2); |
| | |
| | | rf_set_default_para(DEFAULT_WG_SET_FREQ,DEFAULT_WG_SET_SF); |
| | | //IC2_Init(); |
| | | IO_control_init(); |
| | | //移位寄存器实验 |
| | | // BT_LED_QF_state(0); |
| | | // LORA_LED_QG_state(0); |
| | | // UWB_LED_QH_state(0); |
| | | // RED_LED_QD_state(0); |
| | | // GREEN_LED_QE_state(0); |
| | | |
| | | |
| | | |
| | | |
| | | // QA_ON(); |
| | | // SRCLK_0; |
| | | // SER_0; |
| | | // RCLK_0; |
| | | // |
| | | |
| | | // air780_led_off(); |
| | | // motor_power_on(); |
| | | // uwb_led_off(); |
| | |
| | | //rf_enter_single_timeout_rx(500); |
| | | //rf_enter_single_rx(); |
| | | // sleep_time_count=xtal_38m4_off_time(); |
| | | Uwbinit(); |
| | | Uwb_init(); |
| | | OpenUWB(); |
| | | |
| | | |
| | | // if((rf_single_tx_data(TXBuffer,10,0))!= OK) |
| | |
| | | // sleep_timer_start(__MS_TO_32K_CNT(500)); |
| | | while (1) |
| | | { |
| | | gpio_pin_clr(IO_PIN_9); |
| | | Lora_Tx_Poll(); |
| | | |
| | | // gpio_pin_clr(IO_PIN_9); |
| | | // Lora_Tx_Poll(); |
| | | uwb_app_poll(); |
| | | // UwbRange(); |
| | | |
| | | // if(flag_TCP_reconnectting||IfTCPConnected()) |