Fast read implementation

This commit is contained in:
Pawel Spychalski
2017-12-06 14:02:08 +01:00
parent 51b7d696af
commit 37e55a0f47
3 changed files with 9 additions and 4 deletions

View File

@@ -238,15 +238,19 @@ int LoRaClass::available()
return (readRegister(REG_RX_NB_BYTES) - _packetIndex);
}
int LoRaClass::fastRead() {
_packetIndex++;
return readRegister(REG_FIFO);
}
int LoRaClass::read()
{
if (!available()) {
return -1;
}
_packetIndex++;
return readRegister(REG_FIFO);
return fastRead();
}
void LoRaClass::onReceive(void(*callback)(int))