Follow

The Assignment looks odd because "pstmsg->event" has already been set by the calling function "i2c_interrupt_entry" ... And "pstmsg->event" isn't used after "i2c_transferbytes" returns to "i2c_interrupt_entry" 🤔

github.com/bouffalolab/bl_iot_

We have created an issue for this...
github.com/bouffalolab/bl_iot_

@lupyuen as a longtime professional C programmer this is obviously the error you describe, not just because the variable isn't used later, but also because the if-test can't possibly do what is intended with the = that is there.

The code is trying to handle write interrupts if the msg is a write, and read interrupts if the msg is a read. With the mistake, it enters the "write" block for both read and write interrupts on a M_WRITE postmsg, and enters the "read" block for both read and write interrupts on a M_READ postmsg.

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.