Skip to content

Commit 5901e91

Browse files
committed
i2c: remove iter methods.
1 parent b036e16 commit 5901e91

File tree

1 file changed

+0
-91
lines changed

1 file changed

+0
-91
lines changed

embedded-hal/src/i2c.rs

Lines changed: 0 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -37,26 +37,14 @@
3737
//! // ...
3838
//! # Ok(())
3939
//! }
40-
//! fn write_iter<B: IntoIterator<Item = u8>>(&mut self, addr: u8, bytes: B) -> Result<(), Self::Error> {
41-
//! // ...
42-
//! # Ok(())
43-
//! }
4440
//! fn write_read(&mut self, addr: u8, bytes: &[u8], buffer: &mut [u8]) -> Result<(), Self::Error> {
4541
//! // ...
4642
//! # Ok(())
4743
//! }
48-
//! fn write_iter_read<B: IntoIterator<Item = u8>>(&mut self, addr: u8, bytes: B, buffer: &mut [u8]) -> Result<(), Self::Error> {
49-
//! // ...
50-
//! # Ok(())
51-
//! }
5244
//! fn transaction<'a>(&mut self, address: u8, operations: &mut [Operation<'a>]) -> Result<(), Self::Error> {
5345
//! // ...
5446
//! # Ok(())
5547
//! }
56-
//! fn transaction_iter<'a, O: IntoIterator<Item = Operation<'a>>>(&mut self, address: u8, operations: O) -> Result<(), Self::Error> {
57-
//! // ...
58-
//! # Ok(())
59-
//! }
6048
//! }
6149
//!
6250
//! impl I2c<TenBitAddress> for I2c0
@@ -69,26 +57,14 @@
6957
//! // ...
7058
//! # Ok(())
7159
//! }
72-
//! fn write_iter<B: IntoIterator<Item = u8>>(&mut self, addr: u16, bytes: B) -> Result<(), Self::Error> {
73-
//! // ...
74-
//! # Ok(())
75-
//! }
7660
//! fn write_read(&mut self, addr: u16, bytes: &[u8], buffer: &mut [u8]) -> Result<(), Self::Error> {
7761
//! // ...
7862
//! # Ok(())
7963
//! }
80-
//! fn write_iter_read<B: IntoIterator<Item = u8>>(&mut self, addr: u16, bytes: B, buffer: &mut [u8]) -> Result<(), Self::Error> {
81-
//! // ...
82-
//! # Ok(())
83-
//! }
8464
//! fn transaction<'a>(&mut self, address: u16, operations: &mut [Operation<'a>]) -> Result<(), Self::Error> {
8565
//! // ...
8666
//! # Ok(())
8767
//! }
88-
//! fn transaction_iter<'a, O: IntoIterator<Item = Operation<'a>>>(&mut self, address: u16, operations: O) -> Result<(), Self::Error> {
89-
//! // ...
90-
//! # Ok(())
91-
//! }
9268
//! }
9369
//! ```
9470
//!
@@ -307,15 +283,6 @@ pub trait I2c<A: AddressMode = SevenBitAddress>: ErrorType {
307283
/// - `SP` = stop condition
308284
fn write(&mut self, address: A, bytes: &[u8]) -> Result<(), Self::Error>;
309285

310-
/// Writes bytes to slave with address `address`
311-
///
312-
/// # I2C Events (contract)
313-
///
314-
/// Same as the `write` method
315-
fn write_iter<B>(&mut self, address: A, bytes: B) -> Result<(), Self::Error>
316-
where
317-
B: IntoIterator<Item = u8>;
318-
319286
/// Writes bytes to slave with address `address` and then reads enough bytes to fill `buffer` *in a
320287
/// single transaction*
321288
///
@@ -345,21 +312,6 @@ pub trait I2c<A: AddressMode = SevenBitAddress>: ErrorType {
345312
buffer: &mut [u8],
346313
) -> Result<(), Self::Error>;
347314

348-
/// Writes bytes to slave with address `address` and then reads enough bytes to fill `buffer` *in a
349-
/// single transaction*
350-
///
351-
/// # I2C Events (contract)
352-
///
353-
/// Same as the `write_read` method
354-
fn write_iter_read<B>(
355-
&mut self,
356-
address: A,
357-
bytes: B,
358-
buffer: &mut [u8],
359-
) -> Result<(), Self::Error>
360-
where
361-
B: IntoIterator<Item = u8>;
362-
363315
/// Execute the provided operations on the I2C bus.
364316
///
365317
/// Transaction contract:
@@ -378,23 +330,6 @@ pub trait I2c<A: AddressMode = SevenBitAddress>: ErrorType {
378330
address: A,
379331
operations: &mut [Operation<'a>],
380332
) -> Result<(), Self::Error>;
381-
382-
/// Execute the provided operations on the I2C bus (iterator version).
383-
///
384-
/// Transaction contract:
385-
/// - Before executing the first operation an ST is sent automatically. This is followed by SAD+R/W as appropriate.
386-
/// - Data from adjacent operations of the same type are sent after each other without an SP or SR.
387-
/// - Between adjacent operations of a different type an SR and SAD+R/W is sent.
388-
/// - After executing the last operation an SP is sent automatically.
389-
/// - If the last operation is a `Read` the master does not send an acknowledge for the last byte.
390-
///
391-
/// - `ST` = start condition
392-
/// - `SAD+R/W` = slave address followed by bit 1 to indicate reading or 0 to indicate writing
393-
/// - `SR` = repeated start condition
394-
/// - `SP` = stop condition
395-
fn transaction_iter<'a, O>(&mut self, address: A, operations: O) -> Result<(), Self::Error>
396-
where
397-
O: IntoIterator<Item = Operation<'a>>;
398333
}
399334

400335
impl<A: AddressMode, T: I2c<A>> I2c<A> for &mut T {
@@ -406,13 +341,6 @@ impl<A: AddressMode, T: I2c<A>> I2c<A> for &mut T {
406341
T::write(self, address, bytes)
407342
}
408343

409-
fn write_iter<B>(&mut self, address: A, bytes: B) -> Result<(), Self::Error>
410-
where
411-
B: IntoIterator<Item = u8>,
412-
{
413-
T::write_iter(self, address, bytes)
414-
}
415-
416344
fn write_read(
417345
&mut self,
418346
address: A,
@@ -422,30 +350,11 @@ impl<A: AddressMode, T: I2c<A>> I2c<A> for &mut T {
422350
T::write_read(self, address, bytes, buffer)
423351
}
424352

425-
fn write_iter_read<B>(
426-
&mut self,
427-
address: A,
428-
bytes: B,
429-
buffer: &mut [u8],
430-
) -> Result<(), Self::Error>
431-
where
432-
B: IntoIterator<Item = u8>,
433-
{
434-
T::write_iter_read(self, address, bytes, buffer)
435-
}
436-
437353
fn transaction<'a>(
438354
&mut self,
439355
address: A,
440356
operations: &mut [Operation<'a>],
441357
) -> Result<(), Self::Error> {
442358
T::transaction(self, address, operations)
443359
}
444-
445-
fn transaction_iter<'a, O>(&mut self, address: A, operations: O) -> Result<(), Self::Error>
446-
where
447-
O: IntoIterator<Item = Operation<'a>>,
448-
{
449-
T::transaction_iter(self, address, operations)
450-
}
451360
}

0 commit comments

Comments
 (0)