8000 nrf52: i2c: fixup buffer usage by twilfredo · Pull Request #3747 · tock/tock · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

nrf52: i2c: fixup buffer usage #3747

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 27, 2023
Merged

Conversation

twilfredo
Copy link
Contributor

Pull Request Overview

An events_rxstarted is when the master has written data, which corresponds to the buf buffer. In contrast, the slave_read_buf is set for a read_send(), from which the master reads data out of.

Additionally make sure we restore the buffer after use.

Discovered when testing: tock/libtock-rs#523

Testing Strategy

Using an I2C master<->slave setup between two Particle Boron boards.

tock/libtock-rs#523

TODO or Help Wanted

N/A

Documentation Updated

  • Updated the relevant files in /docs, or no updates are required.

Formatting

  • Ran make prepush.

@github-actions github-actions bot added the nrf Change pertains to the nRF5x family of MCUs. label Nov 22, 2023
@twilfredo
Copy link
Contributor Author

@alistair23

@bradjc
Copy link
Contributor
bradjc commented Nov 22, 2023

I see the issue, but isn't the fix to change the rxstarted interrupt to txstarted, and add a new check for the rxstarted interrupt with client.write_expected()?

Also, I think it would be simpler to just use self.XXbuf.is_some() in the check.

@twilfredo
Copy link
Contributor Author

I see the issue, but isn't the fix to change the rxstarted interrupt to txstarted, and add a new check for the rxstarted interrupt with client.write_expected()?

Also, I think it would be simpler to just use self.XXbuf.is_some() in the check.

yeah good point, this was a lazy fix. I'll add those changes.

@twilfredo twilfredo force-pushed the wilfred/fixup-nrf52-i2c branch from 155144e to 638d00f Compare November 22, 2023 20:42
@twilfredo
Copy link
Contributor Author
twilfredo commented Nov 22, 2023

@bradjc pushed a new change that now checks for buffer availability in both the rx/tx cases and respectively invokes the x_expected() if xBuf.is_none().

Did some basic testing with the samples in tock/libtock-rs#523 . seems to be ok :)

An `events_rxstarted` is when the master has written data, which
corresponds to the `buf` buffer. In contrast, the `slave_read_buf` is
set for a read_send(), from which the master reads data out of.

Additionally make sure we restore the buffer after use.

Signed-off-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>
@twilfredo twilfredo force-pushed the wilfred/fixup-nrf52-i2c branch from 638d00f to d2a2f5d Compare November 22, 2023 20:50
@bradjc bradjc added this pull request to the merge queue Nov 27, 2023
Merged via the queue into tock:master with commit d2b44c3 Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4925 nrf Change pertains to the nRF5x family of MCUs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0