37
37
//! // ...
38
38
//! # Ok(())
39
39
//! }
40
- //! fn write_iter<B: IntoIterator<Item = u8>>(&mut self, addr: u8, bytes: B) -> Result<(), Self::Error> {
41
- //! // ...
42
- //! # Ok(())
43
- //! }
44
40
//! fn write_read(&mut self, addr: u8, bytes: &[u8], buffer: &mut [u8]) -> Result<(), Self::Error> {
45
41
//! // ...
46
42
//! # Ok(())
47
43
//! }
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
- //! }
52
44
//! fn transaction<'a>(&mut self, address: u8, operations: &mut [Operation<'a>]) -> Result<(), Self::Error> {
53
45
//! // ...
54
46
//! # Ok(())
55
47
//! }
56
- //! fn transaction_iter<'a, O: IntoIterator<Item = Operation<'a>>>(&mut self, address: u8, operations: O) -> Result<(), Self::Error> {
57
- //! // ...
58
- //! # Ok(())
59
- //! }
60
48
//! }
61
49
//!
62
50
//! impl I2c<TenBitAddress> for I2c0
69
57
//! // ...
70
58
//! # Ok(())
71
59
//! }
72
- //! fn write_iter<B: IntoIterator<Item = u8>>(&mut self, addr: u16, bytes: B) -> Result<(), Self::Error> {
73
- //! // ...
74
- //! # Ok(())
75
- //! }
76
60
//! fn write_read(&mut self, addr: u16, bytes: &[u8], buffer: &mut [u8]) -> Result<(), Self::Error> {
77
61
//! // ...
78
62
//! # Ok(())
79
63
//! }
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
- //! }
84
64
//! fn transaction<'a>(&mut self, address: u16, operations: &mut [Operation<'a>]) -> Result<(), Self::Error> {
85
65
//! // ...
86
66
//! # Ok(())
87
67
//! }
88
- //! fn transaction_iter<'a, O: IntoIterator<Item = Operation<'a>>>(&mut self, address: u16, operations: O) -> Result<(), Self::Error> {
89
- //! // ...
90
- //! # Ok(())
91
- //! }
92
68
//! }
93
69
//! ```
94
70
//!
@@ -307,15 +283,6 @@ pub trait I2c<A: AddressMode = SevenBitAddress>: ErrorType {
307
283
/// - `SP` = stop condition
308
284
fn write ( & mut self , address : A , bytes : & [ u8 ] ) -> Result < ( ) , Self :: Error > ;
309
285
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
-
319
286
/// Writes bytes to slave with address `address` and then reads enough bytes to fill `buffer` *in a
320
287
/// single transaction*
321
288
///
@@ -345,21 +312,6 @@ pub trait I2c<A: AddressMode = SevenBitAddress>: ErrorType {
345
312
buffer : & mut [ u8 ] ,
346
313
) -> Result < ( ) , Self :: Error > ;
347
314
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
-
363
315
/// Execute the provided operations on the I2C bus.
364
316
///
365
317
/// Transaction contract:
@@ -378,23 +330,6 @@ pub trait I2c<A: AddressMode = SevenBitAddress>: ErrorType {
378
330
address : A ,
379
331
operations : & mut [ Operation < ' a > ] ,
380
332
) -> 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 > > ;
398
333
}
399
334
400
335
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 {
406
341
T :: write ( self , address, bytes)
407
342
}
408
343
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
-
416
344
fn write_read (
417
345
& mut self ,
418
346
address : A ,
@@ -422,30 +350,11 @@ impl<A: AddressMode, T: I2c<A>> I2c<A> for &mut T {
422
350
T :: write_read ( self , address, bytes, buffer)
423
351
}
424
352
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
-
437
353
fn transaction < ' a > (
438
354
& mut self ,
439
355
address : A ,
440
356
operations : & mut [ Operation < ' a > ] ,
441
357
) -> Result < ( ) , Self :: Error > {
442
358
T :: transaction ( self , address, operations)
443
359
}
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
- }
451
360
}
0 commit comments