jpbarraca/pynrf24 — pull request #5 by Angus71 (2014-03-30 19:56:54+00:00)
Title: Update nrf24.py

Hi jpbarraca,

When using your code for setting up two BeagleBone Black's to talk to each other via nRF24L01+ modules I found some problem I wanted to share with you for a review.

To actually use the provided code I had to make some changes (See below).
Without the modification in write_payload I wasn't able to setup any communication between two BeagleBoard Nodes. When the size of the data to be send does not match the actual payload size (As in the provided examples).
Also the problem I found in write may lead to problems, if the communication isn't okay, as it bails out always via timeout.
The API of read was extended to actually be able to specify the "size" of the buffer (Which isn't needed in python, but it might be needed. If buf_len is set to -1 the complete "payload" is copied into "buf".

Fixed problem with write_payload
- buf extended instead of txbuffer

Fixed problem in write
- status is now filled with actual status and not OBSERVE_TX

Added buf_len parameter to read_payload
- If set as -1 the complete payload will be put into buf
- read_payload will now return read bytes count

Removed \r\n in print_status