From 2c162b948f68bde8d17cb5e86d18a8972b5661f2 Mon Sep 17 00:00:00 2001
From: chen <15335560115@163.com>
Date: 星期二, 22 七月 2025 18:18:05 +0800
Subject: [PATCH] 修改传aoa信息逻辑为读取指令发送时并且为自身id才给,取消发送区域显示逻辑,将信号质量改为角度置信度

---
 keil/include/board/board.h |   84 ++++++++++++++++++++++++------------------
 1 files changed, 48 insertions(+), 36 deletions(-)

diff --git a/keil/include/board/board.h b/keil/include/board/board.h
index 9a05dca..eac56aa 100644
--- a/keil/include/board/board.h
+++ b/keil/include/board/board.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019-2023 Beijing Hanwei Innovation Technology Ltd. Co. and
+ * Copyright (c) 2019-2025 Beijing Hanwei Innovation Technology Ltd. Co. and
  * its subsidiaries and affiliates (collectly called MKSEMI).
  *
  * All rights reserved.
@@ -45,12 +45,21 @@
 #include "mk_trace.h"
 #include "mk_gpio.h"
 
+#ifndef TRACE_BAUD_RATE
+#define TRACE_BAUD_RATE (BAUD_921600)
+#endif
+
+#ifndef X38M4_AUTO_TUNE_EN
+#define X38M4_AUTO_TUNE_EN (0)
+#else
+#endif
+
 /*   LGA                CSP
 IO00 - UART1 RX         - UART1 RX
 IO01 - UART1 TX         - UART1 TX (trace port)
 IO02 - Ranging Role     - Ranging Role
 IO03 -                  - ISP_EN
-IO04 -                  - UCI Handshake S->H
+IO04 - Ranging Role     - UCI Handshake S->H | Ranging Role
 IO05 - UART0_TX         - UART0_TX | SPI_MISO
 IO06 - UART0_RX         - UART0_RX | SPI_MOSI
 IO07 - LED              - LED      | SPI_CLK
@@ -73,8 +82,8 @@
 #define BOARD_SW_1 IO_PIN_17
 
 /* Board leds */
-#define BOARD_LED_1 IO_PIN_7
-#define BOARD_LED_2 IO_PIN_8
+#define BOARD_LED_1 IO_PIN_8
+#define BOARD_LED_2 IO_PIN_7
 
 /** UCI handshake pin, from host to slave  */
 #define HOST2SLAVE_HS_GPIO (IO_PIN_17)
@@ -82,16 +91,23 @@
 /** UCI handshake pin, from slave to host */
 #define SLAVE2HOST_HS_GPIO (IO_PIN_4)
 
+/** UWB role selection pin */
+#if (X38M4_AUTO_TUNE_EN == 2)
+#define UWB_ROLE_PIN (IO_PIN_4)
+#else
+#define UWB_ROLE_PIN (IO_PIN_2)
+#endif
+
 #define CALIB_CH9 0
 #define CALIB_CH5 1
 #define CALIB_CH2 2
 #define CALIB_CH_NUM 3
-#define SLEEP_TIMER_NUM 500
+
 #define CALIB_CH(x) (x == 9 ? 0 : (x == 5 ? 1 : 2))
 
 enum BOARD_NVM_ITEM_ID_T
 {
-    BOARD_LOAD_CAP = 1,
+    BOARD_X38M4_LOAD_CAP = 1,
     BOARD_LOCAL_SHORT_ADDR = 2,
     BOARD_PEER_SHORT_ADDR = 3,
     BOARD_RANGING_SESSION_ID = 4,
@@ -104,13 +120,18 @@
     BOARD_PDOA_ANT_SPACE = 11,
     BOARD_PDOA_OFFSETS = 12,
     BOARD_X32K_LOAD_CAP = 13,
+    BOARD_CALIB_X38M4_TEMPERATURE = 14,
+    BOARD_CALIB_X38M4_PPM = 15,
+    BOARD_ANGLE_CORRECTION = 16,
+    BOARD_VDD_CORE_VOL = 17,
+    BOARD_LOOPBACK_TIME = 18,
 };
 
 /* Board parameters */
 struct BOARD_PARAM_T
 {
     uint32_t flag;
-    uint8_t load_cap;
+    uint8_t x38m4_load_cap;
     uint8_t tx_power_fcc[CALIB_CH_NUM]; // [CH9, CH5, CH2]
     uint16_t ranging_session_id;
     uint16_t local_short_addr;
@@ -123,6 +144,12 @@
     uint8_t dev_role;
     uint8_t dev_role_idx;
     uint8_t x32k_load_cap;
+    uint8_t vdd_core_vol;
+    int16_t calib_x38m4_temperature; // degree centigrade
+    int16_t calib_x38m4_ppm;         // unit is 0.01 ppm
+    // [azimuth_correction[8],elevation_correction[8]],azimuth_correction[8]=[k,b,s1,k1,b1,s2,k2,b2],k=gain*0.001,b=offset*0.1,s=angle_threshold*0.1
+    int16_t angle_correction[16];
+    int16_t loopback_time;
 };
 
 #if defined(__cplusplus)
@@ -151,19 +178,13 @@
 void board_debug_console_open(enum TRACE_PORT_T port);
 
 /**
- * @brief Configure debug trace port and baud.
- * @param[in] port      Trace port
- *
- */
-void board_debug_console_open_baud(enum TRACE_PORT_T port,enum UART_BAUD_T baud_rate);
-/**
  * @brief Load default calibration parameters.
  *
  */
 void board_calibration_params_default(void);
 
 /**
- * @brief Load calibration parameters from NVM.
+ * @brief Load calibration parameters.
  *
  */
 void board_calibration_params_load(void);
@@ -187,23 +208,23 @@
 void board_ranging_result_correct(uint16_t *distance, int16_t *azimuth, int16_t *elevation);
 
 /**
+ * @brief Get XTAL 38.4M Frequency offset.
+ * @param[in] p_ppm         pointer of the ppm to be written, unit is 0.01 ppm
+ * @return
+ *         @arg DRV_DEV_UNAVAILABLE     get unavaliable value
+ *         @arg DRV_ERROR               adc_get error id
+ *         @arg DRV_BUSY                adc_get send failed because of ADC is busy
+ *         @arg DEV_OK                  get ppm success
+ */
+int32_t board_x38m4_ppm_get(int32_t *p_ppm);
+
+/**
  * @brief Configure button GPIO.
  * @param[in] irq_handler       button interrupt process handler
  *
  */
 void board_button_init(GPIO_IRQ_HANDLER_T irq_handler);
-/**
- * @brief Configure button GPIO.
- * @param[in] irq_handler 5v input interrupt process handler
- *
- */
-void board_5V_input_init(GPIO_IRQ_HANDLER_T irq_handler);
-/**
- * @brief Configure button GPIO.
- * @param[in] irq_handler accelerate input interrupt process handler
- *
- */
-void board_acceleration_detection_init(GPIO_IRQ_HANDLER_T irq_handler);
+
 /**
  * @brief Configure LED GPIO.
  *
@@ -248,16 +269,7 @@
  *
  */
 void board_restore_from_power_down(void);
-/**
- * @brief Change uart1 gps to debug.
- *
- */
-void uart1_change_from_gps_to_debug(void);
-/**
- * @brief Change uart1 debug to gps.
- *
- */
-void uart1_change_from_debug_to_gps(void);
+
 #if defined(__cplusplus)
 }
 #endif

--
Gitblit v1.9.3