[Mod] Updated examples to use buffered SPI (#776)
This commit is contained in:
parent
a01b02fae2
commit
f4f11a35d3
2 changed files with 9 additions and 5 deletions
|
@ -285,7 +285,7 @@ class EspHal : public RadioLibHal {
|
|||
// repeats clock div, mode and bit order configuration
|
||||
}
|
||||
|
||||
uint8_t spiTransfer(uint8_t b) {
|
||||
uint8_t spiTransferByte(uint8_t b) {
|
||||
this->spi->mosi_dlen.usr_mosi_dbitlen = 7;
|
||||
this->spi->miso_dlen.usr_miso_dbitlen = 7;
|
||||
this->spi->data_buf[0] = b;
|
||||
|
@ -294,6 +294,12 @@ class EspHal : public RadioLibHal {
|
|||
return(this->spi->data_buf[0] & 0xFF);
|
||||
}
|
||||
|
||||
void spiTransfer(uint8_t* out, size_t len, uint8_t* in) {
|
||||
for(size_t i = 0; i < len; i++) {
|
||||
in[i] = this->spiTransferByte(out[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void spiEndTransaction() {
|
||||
// nothing needs to be done here
|
||||
}
|
||||
|
|
|
@ -128,10 +128,8 @@ class PiHal : public RadioLibHal {
|
|||
|
||||
void spiBeginTransaction() {}
|
||||
|
||||
uint8_t spiTransfer(uint8_t b) {
|
||||
char ret;
|
||||
spiXfer(_spiHandle, (char*)&b, &ret, 1);
|
||||
return(ret);
|
||||
void spiTransfer(uint8_t* out, size_t len, uint8_t* in) {
|
||||
spiXfer(_spiHandle, (char*)out, in, len);
|
||||
}
|
||||
|
||||
void spiEndTransaction() {}
|
||||
|
|
Loading…
Add table
Reference in a new issue