Conversation
The value was shifted the wrong way causing it to be always zero and limiting the subaddr to 1 byte.
The interrupt is always masked when it is disabled and it is unmasked when it is enabled. For this reason there is no point in having both functions. This patch simplifies passing arguments to the interrupt management functions by leveraging the fact that enable bits are shifted by constant offset from enable bits. This not only shortens the code but also removes unneeded additional read/write to the register.
Wrong number of bytes was subtracted from the msg_buf_remaining in case of messages longer than 4. This caused the msg_buf_remaining to be always 0 after reading 4 bytes. With this change, reading more than 4 bytes works (I was able to test this only with 6 bytes read so far).
Similarly to the change in bl808_fill_tx_fifo, we can use min_t to remove code duplication for those two cases.
This value is never bigger than 4 so u16 is not needed and it might be confusing why it was chosen.
Current code, in case of multiple messages would start sending the next message in TXF interrupt. This is not correct as when we get TXF interrupt, the fifo may not yet be drained by the controller. The new message should be sent from END interrupt instead. With this fix, the multi-message sending works. This can be checked using something like this on SSD1306: i2ctransfer -y 0 w16@0x3c 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a 0xb 0xc 0xd 0xe 0xf 0x10 w4@0x3c 0x21 0x22 0x23 0x24 Without this patch, the first message consisting of 16 bytes would be cut somewhere around 0xc. With this patch, it is working fine.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some additional fixes for some specific cases. This time I was able to test this code myself :)