zhyinch
2020-10-27 50531ade5283888860eac91e0778363a9fba676d
Src/decadriver/deca_device.c
@@ -153,9 +153,10 @@
#define VBAT_ADDRESS   (0x08)
#define VTEMP_ADDRESS  (0x09)
#define XTRIM_ADDRESS  (0x1E)
uint8_t module_power;
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;
@@ -177,7 +178,14 @@
    }
    _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
    dwt_write32bitreg(TX_POWER_ID, 0x1f1f1f1f);
      if(module_power>36)
      {
         power_temp =(module_power-36);
      }else{
         power_temp = ((6-(module_power/6))<<5)|(module_power%6);
      }
   power_input= power_temp<<24|power_temp<<16|power_temp<<8|power_temp;
   dwt_write32bitreg(TX_POWER_ID, power_input);
    // Configure the CPLL lock detect
    dwt_writetodevice(EXT_SYNC_ID, EC_CTRL_OFFSET, 1, &plllockdetect); 
    // Read OTP revision number
@@ -2124,7 +2132,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()
 *