Commit d8b2512e authored by maniacbug's avatar maniacbug

Allow opening pipe 0 for reading. Useful if it's on a different subnet from others

parent 4f6c4c90
...@@ -489,16 +489,16 @@ void RF24::openWritingPipe(uint64_t value) ...@@ -489,16 +489,16 @@ void RF24::openWritingPipe(uint64_t value)
void RF24::openReadingPipe(uint8_t child, uint64_t value) void RF24::openReadingPipe(uint8_t child, uint64_t value)
{ {
const uint8_t child_pipe[] = { const uint8_t child_pipe[] = {
RX_ADDR_P1, RX_ADDR_P2, RX_ADDR_P3, RX_ADDR_P4, RX_ADDR_P5 }; RX_ADDR_P0, RX_ADDR_P1, RX_ADDR_P2, RX_ADDR_P3, RX_ADDR_P4, RX_ADDR_P5 };
const uint8_t child_payload_size[] = { const uint8_t child_payload_size[] = {
RX_PW_P1, RX_PW_P2, RX_PW_P3, RX_PW_P4, RX_PW_P5 }; RX_PW_P0, RX_PW_P1, RX_PW_P2, RX_PW_P3, RX_PW_P4, RX_PW_P5 };
const uint8_t child_pipe_enable[] = { const uint8_t child_pipe_enable[] = {
ERX_P1, ERX_P2, ERX_P3, ERX_P4, ERX_P5 }; ERX_P0, ERX_P1, ERX_P2, ERX_P3, ERX_P4, ERX_P5 };
if (--child < 5) if (child < 5)
{ {
// For pipes 2-5, only write the LSB // For pipes 2-5, only write the LSB
if ( !child ) if ( child < 2 )
write_register(child_pipe[child], reinterpret_cast<uint8_t*>(&value), 5); write_register(child_pipe[child], reinterpret_cast<uint8_t*>(&value), 5);
else else
write_register(child_pipe[child], reinterpret_cast<uint8_t*>(&value), 1); write_register(child_pipe[child], reinterpret_cast<uint8_t*>(&value), 1);
......
...@@ -307,7 +307,7 @@ public: ...@@ -307,7 +307,7 @@ public:
* *
* @see openWritingPipe * @see openWritingPipe
* *
* @warning all 5 reading pipes should share the first 32 bits. * @warning Pipes 1-5 should share the first 32 bits.
* Only the least significant byte should be unique, e.g. * Only the least significant byte should be unique, e.g.
* *
* @code * @code
...@@ -315,9 +315,9 @@ public: ...@@ -315,9 +315,9 @@ public:
* openReadingPipe(2,0xF0F0F0F066); * openReadingPipe(2,0xF0F0F0F066);
* @endcode * @endcode
* *
* @todo Enforce the restriction that all pipes must share the top 32 bits * @todo Enforce the restriction that pipes 1-5 must share the top 32 bits
* *
* @param number Which pipe# to open, 1-5. * @param number Which pipe# to open, 0-5.
* @param address The 40-bit address of the pipe to open. * @param address The 40-bit address of the pipe to open.
*/ */
void openReadingPipe(uint8_t number, uint64_t address); void openReadingPipe(uint8_t number, uint64_t address);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment