mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-21 22:32:29 +00:00
Merge pull request #2039 from jcdickinson/rp-i2c-stop-restart
fix (rp i2c): fix restart/stop flags for i2c master methods
This commit is contained in:
commit
5a19d18b9c
@ -294,13 +294,24 @@ impl<'d, T: Instance> I2c<'d, T, Async> {
|
|||||||
|
|
||||||
pub async fn read_async(&mut self, addr: u16, buffer: &mut [u8]) -> Result<(), Error> {
|
pub async fn read_async(&mut self, addr: u16, buffer: &mut [u8]) -> Result<(), Error> {
|
||||||
Self::setup(addr)?;
|
Self::setup(addr)?;
|
||||||
self.read_async_internal(buffer, false, true).await
|
self.read_async_internal(buffer, true, true).await
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn write_async(&mut self, addr: u16, bytes: impl IntoIterator<Item = u8>) -> Result<(), Error> {
|
pub async fn write_async(&mut self, addr: u16, bytes: impl IntoIterator<Item = u8>) -> Result<(), Error> {
|
||||||
Self::setup(addr)?;
|
Self::setup(addr)?;
|
||||||
self.write_async_internal(bytes, true).await
|
self.write_async_internal(bytes, true).await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn write_read_async(
|
||||||
|
&mut self,
|
||||||
|
addr: u16,
|
||||||
|
bytes: impl IntoIterator<Item = u8>,
|
||||||
|
buffer: &mut [u8],
|
||||||
|
) -> Result<(), Error> {
|
||||||
|
Self::setup(addr)?;
|
||||||
|
self.write_async_internal(bytes, false).await?;
|
||||||
|
self.read_async_internal(buffer, true, true).await
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct InterruptHandler<T: Instance> {
|
pub struct InterruptHandler<T: Instance> {
|
||||||
@ -713,7 +724,7 @@ mod nightly {
|
|||||||
|
|
||||||
Self::setup(addr)?;
|
Self::setup(addr)?;
|
||||||
self.write_async_internal(write.iter().cloned(), false).await?;
|
self.write_async_internal(write.iter().cloned(), false).await?;
|
||||||
self.read_async_internal(read, false, true).await
|
self.read_async_internal(read, true, true).await
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn transaction(&mut self, address: A, operations: &mut [Operation<'_>]) -> Result<(), Self::Error> {
|
async fn transaction(&mut self, address: A, operations: &mut [Operation<'_>]) -> Result<(), Self::Error> {
|
||||||
|
Loading…
Reference in New Issue
Block a user