Skip to content
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

Added support for 16 bit bus for I2CMasterBus #3812

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Cristian243342
Copy link
Contributor

Pull Request Overview

This pull request adds support for 16 bit bus for I2CMasterBus.

Testing Strategy

This pull request is untested.

TODO or Help Wanted

This pull request still needs testing.

Documentation Updated

  • No updates are required.

Formatting

  • Ran make prepush.

@@ -301,7 +301,21 @@ impl<'a, I: I2CDevice> Bus<'a> for I2CMasterBus<'a, I> {
}
}
}),

BusWidth::Bits16LE => self
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add all the variants here? The code should be straight forward.

Comment on lines +308 to +309
buffer[0] = 0x00;
buffer[1] = addr as u8;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If addr_width is 16, couldn't addr be 16 bits?

.addr_buffer
.take()
.map_or(Err(ErrorCode::NOMEM), |buffer| {
buffer[0] = 0x00;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
buffer[0] = 0x00;
buffer[0] = addr & 0xff;

.take()
.map_or(Err(ErrorCode::NOMEM), |buffer| {
buffer[0] = 0x00;
buffer[1] = addr as u8;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
buffer[1] = addr as u8;
buffer[1] = (addr >> 8) as u8;

@alistair23
Copy link
Contributor

Why add this if it's untested? If it is not being used we don't need to support it

@lschuermann
Copy link
Member

Why add this if it's untested? If it is not being used we don't need to support it

This is used and @alexandruradovici explicitly asked for it to be split out in #3811.

@Cristian243342 Do you have any updates on this?

@lschuermann
Copy link
Member

@alexandruradovici, do you know how to best proceed here?

@alexandruradovici
Copy link
Contributor

This is not yet done, I'll talk to my student and get back on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants