📄 sppsend.c
字号:
/*****************************************************************************
* *
* ********** *
* ************ *
* *** *** *
* *** +++ *** *
* *** + + *** *
* *** + CHIPCON CC1010 *
* *** + + *** CUL - spp *
* *** +++ *** *
* *** *** *
* *********** *
* ********* *
* *
*****************************************************************************
* *
*****************************************************************************
* Author: JOL *
*****************************************************************************
* Revision history: *
* *
* $Log: sppSend.c,v $
* Revision 1.2 2002/11/21 10:50:11 tos
* Cosmetic change: corrected inconsistent header text.
*
* Revision 1.1 2002/10/14 12:27:34 tos
* Initial version in CVS.
*
* *
****************************************************************************/
#include <chipcon/sppInternal.h>
//----------------------------------------------------------------------------
// byte sppSend (SPP_TX_INFO xdata *pTXInfo)
//
// Description:
// If the transceiver is ready (in idle mode), the transmit section will
// be powered up and the RF interrupt enabled. The RF ISR will then
// transmit the packet (pTXInfo) and receive the ack (if requested). If
// requested (sppSettings.txAttempts = n), the packet will be re-
// transmitted (n-1) times, until the ack is received. When finished the
// transmit section will be powered down.
//
// This function will return immediately and the application can
// continue while the ISR transmits the packet. When finished,
// sppStatus() will return IDLE_MODE. During the transmission it will
// return TX_MODE or TXACK_MODE.
//
// After the transmission: Use pTXInfo->status to find out what happened:
// SPP_TX_ACK_INVALID = Something was received, but not the ack
// SPP_TX_ACK_TIMEOUT = No response
// SPP_TX_FINISHED
//
// sppSettings.txAckTimeout gives the ack timeout in msecs.
//
// Arguments:
// SPP_TX_INFO xdata *pTXInfo
// An SPP_TX_INFO struct must be prepared before the transmission,
// including the following values:
// destination (SPP_BROADCAST or 1-255)
// flags (SPP_ACK_REQ | SPP_ENCRYPTED_DATA)
// dataLen (Length of *pDataBuffer, 0-255)
// pDataBuffer (pointer to the transmission data buffer)
//
// Return value:
// byte
// SPP_TX_STARTED if OK
// SPP_BUSY if not ready
//----------------------------------------------------------------------------
byte sppSend (SPP_TX_INFO xdata *pTXInfo) {
// Begin transmission only if we're in the idle state
INT_GLOBAL_ENABLE (INT_OFF);
if (sppIntData.mode == SPP_IDLE_MODE) {
// Initialize the fsm
sppRFStateFunc = TX_START;
sppIntData.mode = SPP_TX_MODE;
sppIntData.pTXI = pTXInfo;
sppIntData.usedTxAttempts = 0;
INT_GLOBAL_ENABLE (INT_ON);
// Enable transceiver interrupt and enter the FSM
INT_SETFLAG (INUM_RF, INT_CLR);
INT_PRIORITY (INUM_RF, INT_HIGH);
INT_ENABLE (INUM_RF, INT_ON);
// Start TX
SPP_POWER_UP_TX();
return SPP_TX_STARTED;
} else {
INT_GLOBAL_ENABLE (INT_ON);
return SPP_BUSY;
}
} // sppSend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -