From f41e89f0825b39b4b98b8a82e9e8fd5c655de55d Mon Sep 17 00:00:00 2001
From: WXK <287788329@qq.com>
Date: 星期四, 14 九月 2023 15:07:43 +0800
Subject: [PATCH] 版本v2.70,加入防撞代码,uwb  4G

---
 Src/decadriver/deca_device.c |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/Src/decadriver/deca_device.c b/Src/decadriver/deca_device.c
index 9cadd8b..3208299 100644
--- a/Src/decadriver/deca_device.c
+++ b/Src/decadriver/deca_device.c
@@ -154,9 +154,10 @@
 #define VTEMP_ADDRESS  (0x09)
 #define XTRIM_ADDRESS  (0x1E)
 uint8_t module_power;
+uint32_t power_temp,power_input;
 int dwt_initialise(uint16_t config)
 {
-		uint32_t power_temp,power_input;
+		
     uint8_t plllockdetect = EC_CTRL_PLLLCK;
     uint16_t otp_addr = 0;
     uint32_t ldo_tune = 0;
@@ -178,6 +179,7 @@
     }
 
     _dwt_enableclocks(FORCE_SYS_XTI); // NOTE: set system clock to XTI - this is necessary to make sure the values read by _dwt_otpread are reliable
+	 dw1000local.deviceID =  dwt_readdevid() ;
 		if(module_power>36)
 		{
 			power_temp =(module_power-36);
@@ -186,6 +188,7 @@
 		}
 	power_input= power_temp<<24|power_temp<<16|power_temp<<8|power_temp;
 	dwt_write32bitreg(TX_POWER_ID, power_input);
+		dw1000local.deviceID =  dwt_readdevid() ;
     // Configure the CPLL lock detect
     dwt_writetodevice(EXT_SYNC_ID, EC_CTRL_OFFSET, 1, &plllockdetect); 
     // Read OTP revision number
@@ -193,6 +196,7 @@
     dw1000local.otprev = (otp_addr >> 8) & 0xff;			// OTP revision is next byte
     // Load LDO tune from OTP and kick it if there is a value actually programmed.
     ldo_tune = _dwt_otpread(LDOTUNE_ADDRESS);
+		dw1000local.deviceID =  dwt_readdevid() ;
     if((ldo_tune & 0xFF) != 0)
     {
         uint8_t ldok = OTP_SF_LDO_KICK;
@@ -2132,7 +2136,19 @@
     dw1000local.sysCFGreg |= SYS_CFG_AUTOACK;
     dwt_write32bitreg(SYS_CFG_ID, dw1000local.sysCFGreg) ;
 }
-
+void dwt_enableautorxeanble(uint8_t enable)
+{
+    // Set auto ACK reply delay
+    
+    // Enable auto ACK
+	if(enable)
+	{
+    dw1000local.sysCFGreg |= SYS_CFG_RXAUTR;
+	}else{
+		dw1000local.sysCFGreg&=0xDFFFFFFF;
+	}
+    dwt_write32bitreg(SYS_CFG_ID, dw1000local.sysCFGreg) ;
+}
 /*! ------------------------------------------------------------------------------------------------------------------
  * @fn dwt_setdblrxbuffmode()
  *

--
Gitblit v1.9.3