aboutsummaryrefslogtreecommitdiff
path: root/embassy-nrf/src/twim.rs
diff options
context:
space:
mode:
Diffstat (limited to 'embassy-nrf/src/twim.rs')
-rw-r--r--embassy-nrf/src/twim.rs28
1 files changed, 10 insertions, 18 deletions
diff --git a/embassy-nrf/src/twim.rs b/embassy-nrf/src/twim.rs
index 8d6171fac..4eafd18c2 100644
--- a/embassy-nrf/src/twim.rs
+++ b/embassy-nrf/src/twim.rs
@@ -841,39 +841,31 @@ mod eh1 {
841mod eha { 841mod eha {
842 use super::*; 842 use super::*;
843 impl<'d, T: Instance> embedded_hal_async::i2c::I2c for Twim<'d, T> { 843 impl<'d, T: Instance> embedded_hal_async::i2c::I2c for Twim<'d, T> {
844 type ReadFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; 844 async fn read<'a>(&'a mut self, address: u8, buffer: &'a mut [u8]) -> Result<(), Error> {
845 845 self.read(address, buffer).await
846 fn read<'a>(&'a mut self, address: u8, buffer: &'a mut [u8]) -> Self::ReadFuture<'a> {
847 self.read(address, buffer)
848 } 846 }
849 847
850 type WriteFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; 848 async fn write<'a>(&'a mut self, address: u8, bytes: &'a [u8]) -> Result<(), Error> {
851 849 self.write(address, bytes).await
852 fn write<'a>(&'a mut self, address: u8, bytes: &'a [u8]) -> Self::WriteFuture<'a> {
853 self.write(address, bytes)
854 } 850 }
855 851
856 type WriteReadFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; 852 async fn write_read<'a>(
857
858 fn write_read<'a>(
859 &'a mut self, 853 &'a mut self,
860 address: u8, 854 address: u8,
861 wr_buffer: &'a [u8], 855 wr_buffer: &'a [u8],
862 rd_buffer: &'a mut [u8], 856 rd_buffer: &'a mut [u8],
863 ) -> Self::WriteReadFuture<'a> { 857 ) -> Result<(), Error> {
864 self.write_read(address, wr_buffer, rd_buffer) 858 self.write_read(address, wr_buffer, rd_buffer).await
865 } 859 }
866 860
867 type TransactionFuture<'a, 'b> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a, 'b: 'a; 861 async fn transaction<'a, 'b>(
868
869 fn transaction<'a, 'b>(
870 &'a mut self, 862 &'a mut self,
871 address: u8, 863 address: u8,
872 operations: &'a mut [embedded_hal_async::i2c::Operation<'b>], 864 operations: &'a mut [embedded_hal_async::i2c::Operation<'b>],
873 ) -> Self::TransactionFuture<'a, 'b> { 865 ) -> Result<(), Error> {
874 let _ = address; 866 let _ = address;
875 let _ = operations; 867 let _ = operations;
876 async move { todo!() } 868 todo!()
877 } 869 }
878 } 870 }
879} 871}