From f8013e4f432b323dfc3e3725a62858e73176742a Mon Sep 17 00:00:00 2001
From: zhangbo <zhangbo@qq.com>
Date: 星期五, 01 十一月 2024 15:16:32 +0800
Subject: [PATCH] 更换了新的sdk,测试了实际的uwb测距

---
 keil/include/components/uwb/inc/lib_fira.h |   53 ++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 42 insertions(+), 11 deletions(-)

diff --git a/keil/include/components/uwb/inc/lib_fira.h b/keil/include/components/uwb/inc/lib_fira.h
index 6537aad..9c7cf35 100644
--- a/keil/include/components/uwb/inc/lib_fira.h
+++ b/keil/include/components/uwb/inc/lib_fira.h
@@ -63,6 +63,11 @@
 #define SLOT_REPORT 2
 #define SLOT_RESULT 3
 
+#define RESPONSE_SLOT_IDX(x, n) (2 + (x))
+#define FINAL_SLOT_IDX(x, n) (2 + (n))
+#define REPORT_SLOT_IDX(x, n) (3 + (n))
+#define RESULT_SLOT_IDX(x, n) (4 + (n) + (x))
+
 /** STS config definition */
 enum FIRA_STS_CFG_T
 {
@@ -155,10 +160,10 @@
     uint32_t phy_sts_index;
     uint32_t tof;
 
-    uint32_t uwb_period_prefetch_time;
     uint32_t uwb_evt_prefetch_time;
     uint32_t uwb_rx_open_in_advance;
     uint32_t uwb_rx_window;
+    uint32_t uwb_period_prefetch_time;
     uint32_t uwb_rx_open_in_advance_wakeup;
     uint32_t uwb_rx_window_wakeup;
 
@@ -173,8 +178,9 @@
     uint8_t responder_slot_idx[4];
     uint32_t responder_response_flag;
     uint16_t result_flag; // responder_idx || status (1: update, 2: complete)
-    uint8_t rcm_flag;
-    uint8_t repeat;
+    uint16_t repeat;      // audio
+    uint16_t controller_addr;
+    uint16_t initiator_addr;
     uint16_t slots_per_block;
     uint8_t count;
     uint8_t count_last;
@@ -272,10 +278,9 @@
 void ranging_peer_addr_set(uint16_t short_addr);
 
 /**
- * @brief Get initiator short address.
- * @return short address of initiator
+ * @brief Clear responder list.
  */
-uint16_t ranging_initiator_addr_get(void);
+void ranging_responder_list_clr(void);
 
 /**
  * @brief Add responder device into responder device list for one-to-many case.
@@ -283,11 +288,6 @@
  * @return 1: successful, 0: fail
  */
 uint8_t ranging_responder_addr_add(uint16_t addr);
-
-/**
- * @brief Clear responder list.
- */
-void ranging_responder_list_clr(void);
 
 /**
  * @brief Dynamic Update of Multicast List for Controlees
@@ -306,12 +306,43 @@
 uint16_t ranging_responder_addr_get(uint8_t idx);
 
 /**
+ * @brief Get responder index.
+ * @param[in] addr             Responder device address
+ * @return index of responder
+ */
+uint8_t ranging_responder_idx_get(uint16_t addr);
+
+/**
  * @brief Get responder devices number.
  * @return number of responder
  */
 uint8_t ranging_responder_num_get(void);
 
 /**
+ * @brief Set initiator short address.
+ * @param[in] short_addr          Device short address
+ */
+void ranging_initiator_addr_set(uint16_t short_addr);
+
+/**
+ * @brief Get initiator short address.
+ * @return short address of initiator
+ */
+uint16_t ranging_initiator_addr_get(void);
+
+/**
+ * @brief Set controller short address.
+ * @param[in] short_addr          Device short address
+ */
+void ranging_controller_addr_set(uint16_t short_addr);
+
+/**
+ * @brief Get controller short address.
+ * @return short address of controller
+ */
+uint16_t ranging_controller_addr_get(void);
+
+/**
  * @brief Update ranging slot index, based on this informantion to generate STS or encryted packet every slot.
  * @param[in] slot_idx              Slot index
  */

--
Gitblit v1.9.3