微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 无线和射频 > TI Zigbee设计交流 > 对zlight-router一段code无法理解

对zlight-router一段code无法理解

时间:10-02 整理:3721RD 点击:

灯作为服务器,接受命令,使用zclGeneral_HdlInSpecificCommands处理相关命令,找到了我的命令

#ifdef ZCL_LEVEL_CTRL
    case ZCL_CLUSTER_ID_GEN_LEVEL_CONTROL:
      stat = zclGeneral_ProcessInLevelControl( pInMsg, pCBs );
      break;
#endif

问题就是在zclGeneral_ProcessInLevelControl( pInMsg, pCBs );函数里

问题一:下面代码的pData[1]是指什么。pData是一个指针,pData 只是定义了uint8                 *pData

          cmd.moveMode = pInMsg->pData[0];
          cmd.rate = pInMsg->pData[1];
问题二:在回调函数zclLevel_StepCB里有个函数是

  hwLight_ApplyUpdate( &zclLevel_CurrentLevel,
                       &zclLevel_CurrentLevel_256,
                       &zclLevel_StepLevel_256,
                       &zclLevel_LevelRemainingTime,
                       LEVEL_MIN, LEVEL_MAX, FALSE );

这函数具体是什么功能呢?

1,这个指的是rate,API函数里面是有说明的

/*********************************************************************
* @fn zclGeneral_SendLevelControlMoveRequest
*
* @brief Call to send out a Level Control Request. You can also use
* the appropriate macro.
*
* @param srcEP - Sending application's endpoint
* @param dstAddr - where you want the message to go
* @param cmd - one of the following:
* COMMAND_LEVEL_MOVE or
* COMMAND_LEVEL_MOVE_WITH_ON_OFF
* @param moveMode - LEVEL_MOVE_UP or
* LEVEL_MOVE_DOWN
* @param rate - number of steps to take per second
*
* @return ZStatus_t
*/
ZStatus_t zclGeneral_SendLevelControlMoveRequest( uint8 srcEP, afAddrType_t *dstAddr,
uint8 cmd, uint8 moveMode, uint8 rate,
uint8 disableDefaultRsp, uint8 seqNum )
{
uint8 buf[2];

buf[0] = moveMode;
buf[1] = rate;

return zcl_SendCommand( srcEP, dstAddr, ZCL_CLUSTER_ID_GEN_LEVEL_CONTROL,
cmd, TRUE, ZCL_FRAME_CLIENT_SERVER_DIR,
disableDefaultRsp, 0, seqNum, 2, buf );
}

2,计算处理PWM的输出,

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top