I am using the example code of simple peer to peer to monitor the RSSI value recieved from a CC2510DK-MINI device and then when this device falls below a certain RSSI value I will then send a warning signal to the user. Preferably a buzzer connected to a port on the device. There is also a need for the transmitter to only transmit every 2 seconds. So with this there are two alterations I need to consider. My first question is where would the delay need to be inserted to make sure a signal is only sent every 2 seconds.
/* delay longer and longer -- then start over */ delay = (delay+1) & 0x03; /* put the sequence ID in the message */ msg[1] = ++sTxTid; SMPL_Send(sLinkID1, msg, sizeof(msg)); } }
Would it be sufficient to insert the delay in the line just before the SMPL_Send function shown above?
The other question is how would I be able to read the RSSI value interpret it and compare it against a predetermined threshold in the LinkListen program? Would it need to be placed into the below if statement function?
if (sSemaphore) { *(msg+1) = ++tid; SMPL_Send(sLinkID2, msg, 2); /* Reset semaphore. This is not properly protected and there is a race * here. In theory we could miss a message. Good enough for a demo, though. */ sSemaphore = 0; }
Any help would be greatly appreciated
MH