pynrf24
pynrf24 copied to clipboard
whatHappened clears status before reading status
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
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.