Merge fix for static payloads
This commit is contained in:
commit
4542464e0b
24
RF24.cpp
24
RF24.cpp
|
@ -111,16 +111,11 @@ uint8_t RF24::write_payload(const void* buf, uint8_t len)
|
||||||
csn(LOW);
|
csn(LOW);
|
||||||
status = SPI.transfer( W_TX_PAYLOAD );
|
status = SPI.transfer( W_TX_PAYLOAD );
|
||||||
uint8_t data_len = min(len,payload_size);
|
uint8_t data_len = min(len,payload_size);
|
||||||
|
uint8_t blank_len = payload_size - data_len;
|
||||||
while ( data_len-- )
|
while ( data_len-- )
|
||||||
SPI.transfer(*current++);
|
SPI.transfer(*current++);
|
||||||
|
while ( blank_len-- )
|
||||||
// This does not seem to be needed. Keeping it here in case
|
SPI.transfer(0);
|
||||||
// removing it does cause problems for static payloads
|
|
||||||
//
|
|
||||||
// Send blanks out to the chip to finish off the payload
|
|
||||||
//uint8_t blank_len = payload_size - data_len;
|
|
||||||
//while ( blank_len-- )
|
|
||||||
// SPI.transfer(0);
|
|
||||||
|
|
||||||
csn(HIGH);
|
csn(HIGH);
|
||||||
|
|
||||||
|
@ -137,18 +132,11 @@ uint8_t RF24::read_payload(void* buf, uint8_t len)
|
||||||
csn(LOW);
|
csn(LOW);
|
||||||
status = SPI.transfer( R_RX_PAYLOAD );
|
status = SPI.transfer( R_RX_PAYLOAD );
|
||||||
uint8_t data_len = min(len,payload_size);
|
uint8_t data_len = min(len,payload_size);
|
||||||
|
uint8_t blank_len = payload_size - data_len;
|
||||||
while ( data_len-- )
|
while ( data_len-- )
|
||||||
*current++ = SPI.transfer(0xff);
|
*current++ = SPI.transfer(0xff);
|
||||||
|
while ( blank_len-- )
|
||||||
// This does not seem to be needed. Keeping it here in case
|
SPI.transfer(0xff);
|
||||||
// removing it does cause problems for static payloads
|
|
||||||
//
|
|
||||||
// Read the remaining payload off the chip, even though we will
|
|
||||||
// throw it away.
|
|
||||||
//uint8_t blank_len = payload_size - data_len;
|
|
||||||
//while ( blank_len-- )
|
|
||||||
// SPI.transfer(0xff);
|
|
||||||
|
|
||||||
csn(HIGH);
|
csn(HIGH);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
|
|
Loading…
Reference in New Issue