Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RF24::write( #3

Closed
mas2227 opened this issue Dec 31, 2011 · 1 comment
Closed

RF24::write( #3

mas2227 opened this issue Dec 31, 2011 · 1 comment

Comments

@mas2227
Copy link

mas2227 commented Dec 31, 2011

R24.cpp R24::write() the line:
status = read_register(OBSERVE_TX,&observe_tx,1);
should be:
status = read_register(STATUS);
because your registry status bits gert used on the status:
while( ! ( status & ( _BV(TX_DS) | _BV(MAX_RT) ) ) && ( millis() - sent_at < timeout ) );
RF24::whatHappened():
uint8_t status = write_register(STATUS,_BV(RX_DR) | _BV(TX_DS) | _BV(MAX_RT) );
should be:
uint8_t status = read_register(STATUS);
and reset after:
// Report to the user what happened
tx_ok = status & _BV(TX_DS);
tx_fail = status & _BV(MAX_RT);
rx_ready = status & _BV(RX_DR);
status = write_register(STATUS, _BV(TX_DS) | _BV(MAX_RT) );
return;

Michael Spohnholtz

ps great work,just stated learning arduino and r24 has been a great learning project! thanks! You live in my part of the woods, i live in lynnwood wa... small world.

@maniacbug
Copy link
Owner

Thanks for writing. No, the code is correct.

Have another look at the documentation for read_register(uint8_t,uint8_t*,uint8_t). It's at http://maniacbug.github.com/RF24/classRF24.html#a56bfead61e647d838cbb5e49def9b6d9

"Returns: Current value of status register."

Glad you found it helpful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants