mirror of
https://github.com/espressif/openthread.git
synced 2026-07-28 06:37:46 +00:00
[radio] add field to radio packet enable/disable CCA (#2344)
Defining `OPENTHREAD_CONFIG_DISABLE_CCA_ON_LAST_ATTEMPT` to use this feature.
This commit is contained in:
committed by
Jonathan Hui
parent
e22cca3ffe
commit
b8049dfaab
@@ -107,6 +107,7 @@ typedef struct otRadioFrame
|
||||
bool mSecurityValid: 1; ///< Security Enabled flag is set and frame passes security checks.
|
||||
bool mDidTX: 1; ///< Set to true if this frame sent from the radio. Ignored by radio driver.
|
||||
bool mIsARetx: 1; ///< Set to true if this frame is a retransmission. Should be ignored by radio driver.
|
||||
bool mIsCcaEnabled: 1; ///< Set to true if CCA must be enabled for this packet. False otherwise.
|
||||
|
||||
/**
|
||||
* The timestamp when the frame was received (milliseconds).
|
||||
|
||||
@@ -868,6 +868,19 @@ void Mac::HandleBeginTransmit(void)
|
||||
Frame &sendFrame(*mTxFrame);
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
#if OPENTHREAD_CONFIG_DISABLE_CCA_ON_LAST_ATTEMPT
|
||||
|
||||
// Disable CCA for the last attempt
|
||||
if (mTransmitAttempts == (sendFrame.GetMaxTxAttempts() - 1))
|
||||
{
|
||||
sendFrame.mIsCcaEnabled = false;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
sendFrame.mIsCcaEnabled = true;
|
||||
}
|
||||
|
||||
if (mCsmaAttempts == 0 && mTransmitAttempts == 0)
|
||||
{
|
||||
sendFrame.SetPower(mMaxTransmitPower);
|
||||
|
||||
@@ -1008,4 +1008,14 @@
|
||||
#define OPENTHREAD_CONFIG_ENABLE_DYNAMIC_MPL_INTERVAL 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_DISABLE_CCA_ON_LAST_ATTEMPT
|
||||
*
|
||||
* Define as 1 to disable CCA on the last transmit attempt
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_DISABLE_CCA_ON_LAST_ATTEMPT
|
||||
#define OPENTHREAD_CONFIG_DISABLE_CCA_ON_LAST_ATTEMPT 0
|
||||
#endif
|
||||
|
||||
#endif // OPENTHREAD_CORE_DEFAULT_CONFIG_H_
|
||||
|
||||
Reference in New Issue
Block a user