The STARTRX task is moved out of recv_byte, so the nRF no longer
sends a repeated start condition before receiving each byte. My BMP180
wasn't happy about the previous behaviour.
The RXDREADY event is cleared and all shorts are set before
triggering either STARTRX or RESUME. I believe there were some
possible race conditions before.
Only send an explicit stop condition if nothing was received,
otherwise the shorts will take care of it.
One downside is that there are some redundant RESUME calls.
It doesn't seem to cause any problems and I'm not sure it's worth
the extra complication in the code to avoid it.
This makes a few changes to the TWI logic:
STARTRX
task is moved out ofrecv_byte
, so the nRF no longer sends a repeated start condition before receiving each byte. My BMP180 wasn't happy about the previous behaviour.RXDREADY
event is cleared and all shorts are set before triggering eitherSTARTRX
orRESUME
. I believe there were some possible race conditions before.One downside is that there are some redundant
RESUME
calls. It doesn't seem to cause any problems and I'm not sure it's worth the extra complication in the code to avoid it.