pynrf24 icon indicating copy to clipboard operation
pynrf24 copied to clipboard

whatHappened clears status before reading status

Open AidanHolmes opened this issue 8 years ago • 1 comments

The initial call to self.write_register(NRF24.STATUS, NRF24.RX_DR | NRF24.TX_DS | NRF24.MAX_RT) clears the status flags so whatHappened never returns that anything happened for RX_DR, TX_DS or MAX_RT

AidanHolmes avatar Jan 16 '17 21:01 AidanHolmes

It sure doesn't work now, but since the STATUS register is shifted out immediately every time any command (including a 'write register' command) is executed, the best way to grab the status in this case (and, judging by the comments, what was originally intended) would be to catch the output of the call to spi.xfer2 in write_register. Because of this behavior of the device, write_register should probably return the STATUS register's contents whenever it's called anyway, so this seems like a perfectly reasonable change. I'll see if I can put together a pull request implementing this soon.

diodelass avatar May 30 '17 04:05 diodelass