Implement receiver error

This commit is contained in:
Andrew Kay
2020-03-25 19:51:46 -05:00
parent 849810153b
commit c79f484f79
3 changed files with 17 additions and 2 deletions

View File

@@ -229,9 +229,22 @@ static int /* ssize_t */ CoaxTransceiver::receive(uint16_t *buffer, size_t buffe
NOP;
}
uint16_t count = rxBufferCount;
rxState = RX_STATE_DISABLED;
return rxBufferCount;
if (count < 0) {
return count;
}
// Check for receiver errors.
for (int index = 0; index < count; index++) {
if (buffer[index] & 0x8000) {
return ERROR_RX_RECEIVER;
}
}
return count;
}
static void CoaxTransceiver::rxActiveInterrupt() {

View File

@@ -19,6 +19,7 @@
#define ERROR_TX_RECEIVER_ACTIVE -1
#define ERROR_RX_TIMEOUT -2
#define ERROR_RX_OVERFLOW -3
#define ERROR_RX_RECEIVER -4
class CoaxTransceiver {
public: