DW1000 Anchor模式初始化

  • void dwt_seteui(uint8 *eui64)
/*! ------------------------------------------------------------------------------------------------------------------
* @fn dwt_seteui()
*
*  @brief This is used to set the EUI 64-bit (long) address
*
* input parameters
* @param eui64 - this is the pointer to a buffer that contains the 64bit address
*
* output parameters
*
* no return value
*/
void dwt_seteui(uint8 *eui64)
{
  dwt_writetodevice(EUI_64_ID, 0x0, 8, eui64);
}
  • void dwt_setpanid(uint16 panID)
/*! ------------------------------------------------------------------------------------------------------------------
* @fn dwt_setpanid()
*
*  @brief This is used to set the PAN ID and 16-bit (short) address
*
*
* input parameters
* @param panID - this is the PAN ID
*
* output parameters
*
* no return value
*/
void dwt_setpanid(uint16 panID)
{
  // PAN ID is high 16 bits of register
  dwt_write16bitoffsetreg(PANADR_ID, 2, panID) ;     // set the value
}
  • void dwt_setaddress16(uint16 shortAddress)
/*! ------------------------------------------------------------------------------------------------------------------
* @fn dwt_setaddress16()
*
*  @brief This is used to set 16-bit (short) address
*
*
* input parameters
* @param shortAddress - this sets the 16 bit short address
*
* output parameters
*
* no return value
*/
void dwt_setaddress16(uint16 shortAddress)
{
  // short address into low 16 bits
  dwt_write16bitoffsetreg(PANADR_ID, 0, shortAddress) ;     // set the value
}
  • void dwt_configuresleep(uint16 mode, uint8 wake)
/*! ------------------------------------------------------------------------------------------------------------------
* @fn dwt_configuresleep()
*
*  @brief configures the device for both DEEP_SLEEP and SLEEP modes, and on-wake mode
*  I.e. before entering the sleep, the device should be programmed for TX or RX, then upon "waking up" the TX/RX settings
*  will be preserved and the device can immediately perform the desired action TX/RX
*
* NOTE: e.g. MP :- Tag operation - after deep sleep, the device needs to just load the TX buffer and send the frame
*
*
*      mode: the array and LDE code (OTP/ROM) and LDO tune, and set sleep persist
*      DWT_LOADUCODE    0x800 - load ucode from OTP
*      DWT_PRESRV_SLEEP 0x100 - preserve sleep
*      DWT_LOADOPSET    0x080 - load operating parameter set on wakeup
*      DWT_CONFIG       0x040 - download the AON array into the HIF (configuration download)
*      DWT_LOADEUI      0x008
*      DWT_GOTORX       0x002
*      DWT_TANDV        0x001
*
*      wake: wake up parameters
*      DWT_XTAL_EN      0x10 - keep XTAL running during sleep
*      DWT_WAKE_SLPCNT  0x8 - wake up after sleep count
*      DWT_WAKE_CS      0x4 - wake up on chip select
*      DWT_WAKE_WK      0x2 - wake up on WAKEUP PIN
*      DWT_SLP_EN       0x1 - enable sleep/deep sleep functionality
*
* input parameters
* @param mode - config on-wake parameters
* @param wake - config wake up parameters
*
* output parameters
*
* no return value
*/
void dwt_configuresleep(uint16 mode, uint8 wake)
{
  uint8 buf[1];
  
  dwt_write16bitoffsetreg(AON_ID, AON_WCFG_OFFSET, mode);
  
  buf[0] = wake;
  
  dwt_writetodevice(AON_ID, AON_CFG0_OFFSET, 1, buf);
  
}
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容