zhangbo
2025-03-10 b0b6c44f2adbbbac2711f4531ef552e15a1e8b45
keil/uwb_app.c
@@ -415,49 +415,13 @@
    uint8_t i;
    uint16_t tempid;
    // The following peripherals will be initialized in the uwb_open function
    // phy/mac/aes/lsp/phy timers initialized
    //uwb_open();
////    // Set calibration parameters
//    uwb_calibration_params_set(config.phy_cfg.ch_num);
//    // set advanced parameters
//    struct PHY_ADV_CONFIG_T adv_config = {
//        .thres_fap_detect = 40,
//        .nth_scale_factor = 4,
//        .ranging_performance_mode = 0,
//        .skip_weakest_port_en = 0,
//    };
//    phy_adv_params_configure(&adv_config);
//    // uwb configure
//    uwb_configure(config.phy_work_mode, board_param.tx_power_fcc[CALIB_CH(config.phy_cfg.ch_num)], &config.phy_cfg);
//    ranging_frame_type_set(config.phy_cfg.sts_pkt_cfg);
    // Register rx interrupt callback function
    mac_register_process_handler(tx_int_callback, rx_int_callback);
    receive_flag = 0;
      flag_recsuccess = 0;
//    temp_count3=phy_timer_count_get();
    //gpio_pin_set(SCL_PIN);
   //   time_count_dkjs=phy_timer_count_get();
//      gpio_pin_set(IO_PIN_5);//测试
//      gpio_pin_clr(IO_PIN_5);
    uwb_rxflag=uwb_rx(0, 0, range_timeout_us);//开启接收
//         gpio_pin_clr(IO_PIN_5);
//      gpio_pin_clr(IO_PIN_5);//测试
      #ifdef DEBUG_BOXING
//      gpio_pin_clr(IO_PIN_5);//测试
//      gpio_pin_set(IO_PIN_5);//测试
      #endif
//      #ifdef DEBUG_BOXING
//      gpio_pin_set(IO_PIN_5);//测试
//     #endif
//     #ifdef DEBUG_BOXING
//      gpio_pin_set(IO_PIN_5);//测试
//      #endif
    uwb_rxflag_num1++;
  //  while(mac_is_busy());
  //  temp_count2=phy_timer_count_get();
@@ -551,39 +515,18 @@
            }
                  recev_error_num=0;
//            sleep_timer_start(__MS_TO_32K_CNT(UWB_DELAY_TIME_US));//测试
//            LOG_INFO(TRACE_MODULE_APP,"标签ID:%X,距离: %d 信号强度:%d.\r\n",g_com_map[BIND_DEV_ID],distance,rssi);
       
            }
      //  uwb_rxflag=uwb_rx(0, 0, range_timeout_us);
    }    
      #ifdef DEBUG_BOXING
//      gpio_pin_clr(IO_PIN_5);//测试
//      gpio_pin_set(IO_PIN_5);//测试
      #endif
   
    delay_us(1);
    uwb_rx_force_off(1);
//      gpio_pin_clr(IO_PIN_5);
//      #ifdef DEBUG_BOXING
//      gpio_pin_clr(IO_PIN_5);//测试.
//      #endif
//      if(!flag_recsuccess)
//      {
//         sleep_timer_start(__MS_TO_32K_CNT(UWB_DELAY_TIME_US-3));//测试
//        LOG_INFO(TRACE_MODULE_APP,"测距失败,计数:%d\r\n",recev_error_num);
//        if(recev_error_num++>5)
//        {
//            recev_error_num=0;
//            UWB_work_state=SEARCH_DEV;
//            uwb_searchcount = 0;
//            search_open_flag = 1;
//        }
//         }
//      #ifdef DEBUG_BOXING
//      gpio_pin_clr(IO_PIN_5);//测试
////      gpio_pin_set(IO_PIN_5);//测试
//      #endif
}
int Uwbinit(void)
{