aboutsummaryrefslogtreecommitdiff
path: root/rtic-sync/src
diff options
context:
space:
mode:
authorAndres Vahter <andres@vahter.me>2023-11-28 10:36:39 +0200
committerEmil Fresk <emil.fresk@gmail.com>2023-11-28 09:59:29 +0000
commit9f5820da1d36a8c84455b1bc0458d34eb7dd9a70 (patch)
treeef40fa0a052b400b954987ef5c110ba230c05d24 /rtic-sync/src
parente8667d78725222e406a49a5de86d4cf244e4800a (diff)
rtic-sync Arbiter: impl more I2C trait fns
For example embassy-stm32 I2C does not impl transaction yet but other fns are available. So it would be better to impl all of them here.
Diffstat (limited to 'rtic-sync/src')
-rw-r--r--rtic-sync/src/arbiter.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/rtic-sync/src/arbiter.rs b/rtic-sync/src/arbiter.rs
index 615a7ed..99d4174 100644
--- a/rtic-sync/src/arbiter.rs
+++ b/rtic-sync/src/arbiter.rs
@@ -352,6 +352,26 @@ pub mod i2c {
BUS: I2c<A>,
A: AddressMode,
{
+ async fn read(&mut self, address: A, read: &mut [u8]) -> Result<(), Self::Error> {
+ let mut bus = self.bus.access().await;
+ bus.read(address, read).await
+ }
+
+ async fn write(&mut self, address: A, write: &[u8]) -> Result<(), Self::Error> {
+ let mut bus = self.bus.access().await;
+ bus.write(address, write).await
+ }
+
+ async fn write_read(
+ &mut self,
+ address: A,
+ write: &[u8],
+ read: &mut [u8],
+ ) -> Result<(), Self::Error> {
+ let mut bus = self.bus.access().await;
+ bus.write_read(address, write, read).await
+ }
+
async fn transaction(
&mut self,
address: A,