Updated the LoRa library by implementing a read(uint8_t *, size_t) function to read multiple bytes at once

This commit is contained in:
anschrammh 2025-11-05 23:55:05 +01:00
parent cae484fb53
commit d3cabc4e73
2 changed files with 17 additions and 0 deletions

View File

@ -347,6 +347,22 @@ int LoRaClass::read()
return readRegister(REG_FIFO);
}
int LoRaClass::read(uint8_t *buffer, size_t len)
{
if(!buffer) return 0;
size_t nbread = 0;
while(nbread < len && available())
{
int c = read();
if(c == -1) break;
buffer[nbread++] = c;
}
return nbread;
}
int LoRaClass::peek()
{
if (!available()) {

View File

@ -54,6 +54,7 @@ public:
// from Stream
virtual int available();
virtual int read();
virtual int read(uint8_t *buffer, size_t len);
virtual int peek();
virtual void flush();