mirror of
https://github.com/italicsjenga/rp-hal-boards.git
synced 2024-12-24 05:01:31 +11:00
embassy-traits: Fix unexpected restart on repeated read.
This commit is contained in:
parent
ce7c9f4be3
commit
7840d0f833
|
@ -7,7 +7,7 @@ impl<T: Deref<Target = Block>, PINS> I2C<T, PINS, Controller> {
|
||||||
&mut self,
|
&mut self,
|
||||||
mut buffer: Peekable<U>,
|
mut buffer: Peekable<U>,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
let first = true;
|
let mut first = true;
|
||||||
while let Some(byte) = buffer.next() {
|
while let Some(byte) = buffer.next() {
|
||||||
let last = buffer.peek().is_none();
|
let last = buffer.peek().is_none();
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ impl<T: Deref<Target = Block>, PINS> I2C<T, PINS, Controller> {
|
||||||
self.i2c.ic_data_cmd.write(|w| {
|
self.i2c.ic_data_cmd.write(|w| {
|
||||||
if first {
|
if first {
|
||||||
w.restart().enable();
|
w.restart().enable();
|
||||||
|
first = false;
|
||||||
} else {
|
} else {
|
||||||
w.restart().disable();
|
w.restart().disable();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue