aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2023-10-11 00:40:59 +0000
committerGitHub <[email protected]>2023-10-11 00:40:59 +0000
commit5a19d18b9cd2027d0b3864cf6c09d4648fed569b (patch)
treeb90a07a2e77fb57223609e52be7e6614942b6d70
parented7b6056a6bef23ae5981e38c557abbfad8bdc81 (diff)
parent322f9cb1535750bd90745e445c5f68915aab0eb1 (diff)
Merge pull request #2039 from jcdickinson/rp-i2c-stop-restart
fix (rp i2c): fix restart/stop flags for i2c master methods
-rw-r--r--embassy-rp/src/i2c.rs15
1 files changed, 13 insertions, 2 deletions
diff --git a/embassy-rp/src/i2c.rs b/embassy-rp/src/i2c.rs
index b4036f207..4fe4b27eb 100644
--- a/embassy-rp/src/i2c.rs
+++ b/embassy-rp/src/i2c.rs
@@ -294,13 +294,24 @@ impl<'d, T: Instance> I2c<'d, T, Async> {
294 294
295 pub async fn read_async(&mut self, addr: u16, buffer: &mut [u8]) -> Result<(), Error> { 295 pub async fn read_async(&mut self, addr: u16, buffer: &mut [u8]) -> Result<(), Error> {
296 Self::setup(addr)?; 296 Self::setup(addr)?;
297 self.read_async_internal(buffer, false, true).await 297 self.read_async_internal(buffer, true, true).await
298 } 298 }
299 299
300 pub async fn write_async(&mut self, addr: u16, bytes: impl IntoIterator<Item = u8>) -> Result<(), Error> { 300 pub async fn write_async(&mut self, addr: u16, bytes: impl IntoIterator<Item = u8>) -> Result<(), Error> {
301 Self::setup(addr)?; 301 Self::setup(addr)?;
302 self.write_async_internal(bytes, true).await 302 self.write_async_internal(bytes, true).await
303 } 303 }
304
305 pub async fn write_read_async(
306 &mut self,
307 addr: u16,
308 bytes: impl IntoIterator<Item = u8>,
309 buffer: &mut [u8],
310 ) -> Result<(), Error> {
311 Self::setup(addr)?;
312 self.write_async_internal(bytes, false).await?;
313 self.read_async_internal(buffer, true, true).await
314 }
304} 315}
305 316
306pub struct InterruptHandler<T: Instance> { 317pub struct InterruptHandler<T: Instance> {
@@ -713,7 +724,7 @@ mod nightly {
713 724
714 Self::setup(addr)?; 725 Self::setup(addr)?;
715 self.write_async_internal(write.iter().cloned(), false).await?; 726 self.write_async_internal(write.iter().cloned(), false).await?;
716 self.read_async_internal(read, false, true).await 727 self.read_async_internal(read, true, true).await
717 } 728 }
718 729
719 async fn transaction(&mut self, address: A, operations: &mut [Operation<'_>]) -> Result<(), Self::Error> { 730 async fn transaction(&mut self, address: A, operations: &mut [Operation<'_>]) -> Result<(), Self::Error> {