EFR32 Mighty Gecko 1 Software Documentation  efr32mg1-doc-5.1.2
ezradio_auto_ack_plugin.c
Go to the documentation of this file.
1 /***************************************************************************/
33 #include <stddef.h>
34 #include "em_device.h"
35 
36 #include "ezradio_cmd.h"
37 #include "ezradio_prop.h"
38 #include "ezradio_api_lib.h"
39 #include "ezradio_api_lib_add.h"
40 #include "ezradio_plugin_manager.h"
41 
42 #if defined(EZRADIO_PLUGIN_AUTO_ACK) && defined(EZRADIO_PLUGIN_TRANSMIT) && defined(EZRADIO_PLUGIN_RECEIVE)
43 
44 /**************************************************************************/
54 {
55  autoAckHandle->ackMode = ezradiodrvAutoAckImmediate;
56 }
57 
58 /**************************************************************************/
68 {
69  autoAckHandle->ackMode = ezradiodrvAutoAckDisabled;
70 }
71 
72 /**************************************************************************/
84 {
85  autoAckHandle->ackMode = ezradiodrvAutoAckSkipOne;
86 }
87 
89 // Note: These are internal routines used by ezradio plugin manager.
90 
91 /**************************************************************************/
101 Ecode_t ezradioHandleAutoAckPlugin( EZRADIODRV_Handle_t radioHandle, EZRADIODRV_ReplyHandle_t radioReplyHandle )
102 {
103  //Silent warning.
104  (void)radioReplyHandle;
105 
106  if ( radioHandle == NULL )
107  {
109  }
110 
111  if ( radioHandle->autoAck.userCallback != NULL )
112  {
113  radioHandle->autoAck.userCallback( radioHandle, ECODE_EMDRV_EZRADIODRV_OK );
114  }
115 
116  /* Set packet type back to normal */
118 
120 }
121 
122 /**************************************************************************/
133 Ecode_t ezradioTransmitAutoAck(EZRADIODRV_Handle_t radioHandle)
134 {
135  if ( radioHandle == NULL )
136  {
138  }
139 
140  /* Set packet type to auto ack */
142 
143  /* Start default or smart transmission depending on the auto ack packet mode configuration */
144  if (radioHandle->autoAck.pktMode == ezradiodrvAutoAckPktDefault)
145  {
146  ezradioStartTransmitDefault( radioHandle, radioHandle->autoAck.pktBuf );
147  }
148  else
149  {
150  ezradioStartTransmitSmart( radioHandle, radioHandle->autoAck.lenConfig, radioHandle->autoAck.pktBuf );
151  }
152 
154 }
155 
157 
158 #endif //#if defined( EZRADIO_PLUGIN_AUTO_ACK ) && defined( EZRADIO_PLUGIN_TRANSMIT ) && defined( EZRADIO_PLUGIN_RECEIVE )
EZRADIODRV_PacketTxHandle_t packetTx
Packet transmission plug-in handler.
Ecode_t ezradioStartTransmitDefault(EZRADIODRV_Handle_t radioHandle, uint8_t *pioRadioPacket)
Start a default transmission using the packet information previously set to radioHandle. Depending on the information in the radioHandle parameter the function decides which transmission function has to be called.
EZRADIODRV_AutoAckPacketMode_t pktMode
Packet mode for aut ack.
#define ECODE_EMDRV_EZRADIODRV_OK
Success return value.
EZRADIODRV_Callback_t userCallback
User callback.
Auto acknowledge packet type.
This file contains the common API library of the EZRadio and EZRadioPRO families. ...
This file contains the plug-in manager for the EZRadio and EZRadioPRO chip families.
CMSIS Cortex-M Peripheral Access Layer for Silicon Laboratories microcontroller devices.
Acknowledge transmission is skipped for one cycle, eg. not to transmit ACK if ACK is received...
Ecode_t ezradioStartTransmitSmart(EZRADIODRV_Handle_t radioHandle, EZRADIODRV_PacketLengthConfig_t pktLengthConf, uint8_t *pioRadioPacket)
Start a smart transmission. Depending on the information in the pktLengthConf parameter the function ...
EZRADIODRV_AutoAckHandle_t autoAck
Auto-acknowledge plug-in handler.
Auto acknowledge uses the same transmission configuration as the actual configuration.
uint32_t Ecode_t
Typedef for API function error code return values.
Definition: ecode.h:51
Auto acknowledge transmission disabled.
void ezradioEnableAutoAck(EZRADIODRV_AutoAckHandle_t *autoAckHandle)
Enables auto acknowledge sending feature.
#define ECODE_EMDRV_EZRADIODRV_ILLEGAL_HANDLE
Illegal SPI handle.
Immediate acknowledge transmission.
EzRadio auto acknowledge plug-in instance initialization and handler structure.
EZRADIODRV_TransmitPacketType_t pktType
Packet type.
void ezradioSkipAutoAck(EZRADIODRV_AutoAckHandle_t *autoAckHandle)
Configures auto acknowledge sending feature so that there will be no acknowledge transmitted to the n...
EZRADIODRV_AutoAckMode_t ackMode
Auto ack mode.
void ezradioDisableAutoAck(EZRADIODRV_AutoAckHandle_t *autoAckHandle)
Disables auto acknowledge sending feature.
ezradio_cmd_reply_t * EZRADIODRV_ReplyHandle_t
EZradio reply union handle.
EZRADIODRV_PacketLengthConfig_t lenConfig
Pakcet length config for auto ack.
uint8_t * pktBuf
Pointer to the buffer that holds the auto ack packet.