-
Notifications
You must be signed in to change notification settings - Fork 651
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
base: master
Are you sure you want to change the base?
Added support for 16 bit bus for I2CMasterBus #3812
Conversation
@@ -301,7 +301,21 @@ impl<'a, I: I2CDevice> Bus<'a> for I2CMasterBus<'a, I> { | |||
} | |||
} | |||
}), | |||
|
|||
BusWidth::Bits16LE => self |
There was a problem hiding this comment.
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.
buffer[0] = 0x00; | ||
buffer[1] = addr as u8; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
buffer[0] = 0x00; | |
buffer[0] = addr & 0xff; |
.take() | ||
.map_or(Err(ErrorCode::NOMEM), |buffer| { | ||
buffer[0] = 0x00; | ||
buffer[1] = addr as u8; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
buffer[1] = addr as u8; | |
buffer[1] = (addr >> 8) as u8; |
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? |
@alexandruradovici, do you know how to best proceed here? |
This is not yet done, I'll talk to my student and get back on this. |
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
Formatting
make prepush
.