unsigned char A110x2500Radio::receiverOn(uint8_t *dataField, uint8_t length, uint16_t timeout) { if (!busy()) { // Bring the radio out of a low power state. _wakeup(); // Set the receive buffer. Radio._dataStream.length = 0; Radio._dataStream.address = 0; Radio._dataStream.dataField = dataField; // Listen for a data stream. CC1101Idle(&gPhyInfo.cc1101); CC1101FlushRxFifo(&gPhyInfo.cc1101); CC1101ReceiverOn(&gPhyInfo.cc1101); // Listen for at most the timeout period or until a message is received. while (timeout-- > 0) { delay(1); if (gDataReceived) { gDataReceived = false; return Radio._dataStream.length; } } } return 0; // No data stream received }
void A110x2500Radio::transmit(uint8_t address, uint8_t *dataField, uint8_t length) { if (!busy()) { // Bring the radio out of a low power state. _wakeup(); // Set the transmit buffer. Radio._dataStream.length = 0; Radio._dataStream.address = 0; Radio._dataStream.dataField = dataField; // Build and transmit a data stream. CC1101Idle(&gPhyInfo.cc1101); buildDataStream(address, Radio._dataStream.dataField, length); CC1101Transmit(&gPhyInfo.cc1101); gDataTransmitting = true; } }