Transmit
The procedure for transmission in a simple network allocates a tsTxDataApp structure and stores the information required for transmission in this structure.
Allocates the
tsTxDataApp
structure as a local variable and clears the entire structure to zero.Copy the data you wish to send into
.auData
(payload).Store the number of stored bytes of the payload in
.u8Len
.Stores
.u32DstAddr
(destination)Stores
.u32SrcAddr
(the address of the sender)Specify other sending options.
call
ToCoNet_bMacTxReq()
.
When the transmission process in TWENET is finished,
cbToCoNet_TxEvent()
is executed.
It is exceptional for a completion event to disappear, but a timeout should be provided to handle exceptions. If the delay or retransmission delay is not set too long in the tsTxDataApp structure, then 100ms is not normally required.
Sample code
The S_OCTET()
S_BE_WORD()
S_BE_DWORD()
macros are 1,2,4-byte storage macros used when uint8 *q
is declared as a pointer to the payload storage area.
最終更新