UM0893
5.4.2
ISR callbacks for packet reception
Each time a packet is received, the ST_RadioReceiveIsrCallback(packet,
ackFramePendingSet, time, errors, rssi) callback is automatically called by the library.
The pseudocode below gives an example of a simple implementation of the
ST_RadioReceiveIsrCallback() callback:
/* buffer where storing the received packet */
uint8_t rxPacket[128];
/* flag for checking that there's a packet being processed */
boolean packetReceived = FALSE;
void ST_RadioReceiveIsrCallback(uint8_t *packet,
{
/* note this is executed from interrupt context */
uint8_t i;
/* Copy the packet to a buffer that can be accessed from the main loop.
Don't do the copy if there is already a packet there being processed
(packetReceived
if(packetReceived == FALSE) {
for(i=0; i<=packet[0]; i++) {
}
packetReceived = TRUE;
}
}
The rxpacket[] will be processed depending on the application target (see pseudocode
below for an example):
void main(void)
{
...
...
while(1) {
}
/* The packet has been processed, so free the single entry
queue up */
packetReceived = FALSE;
}
}
}
Designing an application using the SimpleMAC Library APIs
= TRUE) */
rxPacket[i] = packet[i];
/* print out any packets that were received */
if(packetReceived == TRUE) {
for(i=0; i<=rxPacket[0]; i++) {
<print rxPacket[i]>;
Doc ID 16995 Rev 10
boolean ackFramePendingSet,
uint32_t time,
uint16_t errors,
int8_t rssi)
47/54
Need help?
Do you have a question about the SimpleMAC STM32W108 Series and is the answer not in the manual?
Questions and answers