📄 co_pdo.h
字号:
* PreCondition: none
*
* Input: PDOn, this must be a constant from 1 to 4
*
* Output: UNSIGNED32, CAN id in MCHP format
*
* Side Effects: none
*
* Overview: Get the can identifier used by the RPDO.
*
* Note:
********************************************************************/
#define mRPDOGetCOB(PDOn) uRPDOComm##PDOn##.word
/*********************************************************************
* Function: UNSIGNED8 mRPDOGetLen(PDOn)
*
* PreCondition: none
*
* Input: PDOn, this must be a constant from 1 to 4
*
* Output: UNSIGNED8, the length of the RPDO
*
* Side Effects: none
*
* Overview: Get the length of the RPDO.
*
* Note:
********************************************************************/
#define mRPDOGetLen(PDOn) (_uPDO##PDOn##.RPDO.len)
/*********************************************************************
* Function: BOOL mRPDOGetRTR(PDOn)
*
* PreCondition: none
*
* Input: PDOn, this must be a constant from 1 to 4
*
* Output: BOOL, the RTR bit
*
* Side Effects: none
*
* Overview: Get the status of the RTR for the RPDO.
*
* Note:
********************************************************************/
#define mRPDOGetRTR(PDOn) (_uPDO##PDOn##.RPDO.len & 0x40)
/*********************************************************************
* Function: UNSIGNED8* mRPDOGetRxPtr(PDOn)
*
* PreCondition: none
*
* Input: PDOn, this must be a constant from 1 to 4
*
* Output: UNSIGNED8*, pointer to the buffer
*
* Side Effects: none
*
* Overview: Get the pointer to the RPDO buffer.
*
* Note:
********************************************************************/
#define mRPDOGetRxPtr(PDOn) (_uPDO##PDOn##.RPDO.buf)
/*********************************************************************
* Function: void mRPDOSetRxPtr(PDOn, pRXBUF)
*
* PreCondition: none
*
* Input: PDOn, this must be a constant from 1 to 4
* pRXBUF, pointer to the buffer
*
* Output: none
*
* Side Effects: none
*
* Overview: Set the pointer to the RDPO buffer.
*
* Note:
********************************************************************/
#define mRPDOSetRxPtr(PDOn, pRXBUF) _uPDO##PDOn##.RPDO.buf = pRXBUF
/*********************************************************************
* Function: void mTPDOOpen(PDOn)
*
* PreCondition: none
*
* Input: PDOn, this must be a constant from 1 to 4
*
* Output: none
*
* Side Effects: none
*
* Overview: Open the TPDO.
*
* Note:
********************************************************************/
#define mTPDOOpen(PDOn) COMM_TPDO_##PDOn##_EN = 1
/*********************************************************************
* Function: BOOL mTPDOIsOpen(PDOn)
*
* PreCondition: none
*
* Input: PDOn, this must be a constant from 1 to 4
*
* Output: BOOL, true if the TPDO is open
*
* Side Effects: none
*
* Overview: Query if the TPDO is open.
*
* Note:
********************************************************************/
#define mTPDOIsOpen(PDOn) COMM_TPDO_##PDOn##_EN
/*********************************************************************
* Function: void mTPDOClose(PDOn)
*
* PreCondition: none
*
* Input: PDOn, this must be a constant from 1 to 4
*
* Output: none
*
* Side Effects: none
*
* Overview: Close the PDO.
*
* Note:
********************************************************************/
#define mTPDOClose(PDOn) COMM_TPDO_##PDOn##_EN = 0
/*********************************************************************
* Function: BOOL mTPDOIsPutRdy(PDOn)
*
* PreCondition: none
*
* Input: PDOn, this must be a constant from 1 to 4
*
* Output: BOOL, true if the TPDO buffer is available.
*
* Side Effects: none
*
* Overview: Query if the TPDO is ready to load.
*
* Note:
********************************************************************/
#define mTPDOIsPutRdy(PDOn) (!COMM_PDO_##PDOn##_TF)
/*********************************************************************
* Function: void mTPDOWritten(PDOn)
*
* PreCondition: none
*
* Input: PDOn, this must be a constant from 1 to 4
*
* Output: none
*
* Side Effects: none
*
* Overview: Indicate to the stack that the TPDO has been
* loaded and is ready to send.
*
* Note:
********************************************************************/
#define mTPDOWritten(PDOn) COMM_PDO_##PDOn##_TF = 1
/*********************************************************************
* Function: void mTPDOSetCOB(PDOn, tpdoCOB)
*
* PreCondition: none
*
* Input: PDOn, this must be a constant from 1 to 4
* tpdoCOB, TPDO CAN ID in MCHP format
*
* Output: none
*
* Side Effects: none
*
* Overview: Set the CAN identifier for the TPDO.
*
* Note:
********************************************************************/
#define mTPDOSetCOB(PDOn, tpdoCOB) uTPDOComm##PDOn##.word = tpdoCOB
/*********************************************************************
* Function: UNSIGNEED32 mTPDOGetCOB(PDOn)
*
* PreCondition: none
*
* Input: PDOn, this must be a constant from 1 to 4
*
* Output: UNSIGNEED32, the CAN ID in MCHP format
*
* Side Effects: none
*
* Overview: Get the CAN identifier for the TPDO.
*
* Note:
********************************************************************/
#define mTPDOGetCOB(PDOn) uTPDOComm##PDOn##.word
/*********************************************************************
* Function: void mTPDOSetLen(PDOn, length)
*
* PreCondition: none
*
* Input: PDOn, this must be a constant from 1 to 4
* length, the length of the PDO
*
* Output: none
*
* Side Effects: none
*
* Overview: Set length of the TPDO.
*
* Note:
********************************************************************/
#define mTPDOSetLen(PDOn, length) _uPDO##PDOn##.TPDO.len = length
/*********************************************************************
* Function: void mTPDOSetRTR(PDOn)
*
* PreCondition: none
*
* Input: PDOn, this must be a constant from 1 to 4
*
* Output: none
*
* Side Effects: none
*
* Overview: Set the RTR for this PDO.
*
* Note:
********************************************************************/
#define mTPDOSetRTR(PDOn) _uPDO##PDOn##.TPDO.len |= 0x40
/*********************************************************************
* Function: UNSIGNED8* mTPDOGetTxPtr(PDOn)
*
* PreCondition: none
*
* Input: PDOn, this must be a constant from 1 to 4
*
* Output: UNSIGNED8*, pointer to the TPDO buffer
*
* Side Effects: none
*
* Overview: Get the pointer to the TPDO buffer.
*
* Note:
********************************************************************/
#define mTPDOGetTxPtr(PDOn) (_uPDO##PDOn##.TPDO.buf)
/*********************************************************************
* Function: void mTPDOSetTxPtr(PDOn, PTXBUF)
*
* PreCondition: none
*
* Input: PDOn, this must be a constant from 1 to 4
* PTXBUF, pointer to the TPDO buffer
*
* Output: none
*
* Side Effects: none
*
* Overview: Set the pointer to the TPDO buffer.
*
* Note:
********************************************************************/
#define mTPDOSetTxPtr(PDOn, PTXBUF) _uPDO##PDOn##.TPDO.buf = PTXBUF
#endif //__CO_PDO_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -