Fixed a bug when pipe 0 was NOT being used for writing.
This commit is contained in:
parent
5344c5fe8c
commit
cc7e0a2f19
8
RF24.cpp
8
RF24.cpp
|
@ -247,8 +247,9 @@ void RF24::print_address_register(prog_char* name, uint8_t reg, uint8_t qty)
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
RF24::RF24(uint8_t _cepin, uint8_t _cspin):
|
RF24::RF24(uint8_t _cepin, uint8_t _cspin):
|
||||||
ce_pin(_cepin), csn_pin(_cspin), wide_band(true), p_variant(false), payload_size(32),
|
ce_pin(_cepin), csn_pin(_cspin), wide_band(true), p_variant(false),
|
||||||
ack_payload_available(false), dynamic_payloads_enabled(false)
|
payload_size(32), ack_payload_available(false), dynamic_payloads_enabled(false),
|
||||||
|
pipe0_reading_address(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,7 +382,8 @@ void RF24::startListening(void)
|
||||||
write_register(CONFIG, read_register(CONFIG) | _BV(PWR_UP) | _BV(PRIM_RX));
|
write_register(CONFIG, read_register(CONFIG) | _BV(PWR_UP) | _BV(PRIM_RX));
|
||||||
write_register(STATUS, _BV(RX_DR) | _BV(TX_DS) | _BV(MAX_RT) );
|
write_register(STATUS, _BV(RX_DR) | _BV(TX_DS) | _BV(MAX_RT) );
|
||||||
|
|
||||||
// Restore the pipe0 adddress
|
// Restore the pipe0 adddress, if exists
|
||||||
|
if (pipe0_reading_address)
|
||||||
write_register(RX_ADDR_P0, reinterpret_cast<const uint8_t*>(&pipe0_reading_address), 5);
|
write_register(RX_ADDR_P0, reinterpret_cast<const uint8_t*>(&pipe0_reading_address), 5);
|
||||||
|
|
||||||
// Flush buffers
|
// Flush buffers
|
||||||
|
|
Loading…
Reference in New Issue