3030//! {
3131//! # type Error = ();
3232//! #
33- //! fn try_write (&mut self, addr: u8, output: &[u8]) -> Result<(), Self::Error> {
33+ //! fn write (&mut self, addr: u8, output: &[u8]) -> Result<(), Self::Error> {
3434//! // ...
3535//! # Ok(())
3636//! }
4040//! {
4141//! # type Error = ();
4242//! #
43- //! fn try_write (&mut self, addr: u16, output: &[u8]) -> Result<(), Self::Error> {
43+ //! fn write (&mut self, addr: u16, output: &[u8]) -> Result<(), Self::Error> {
4444//! // ...
4545//! # Ok(())
4646//! }
6666//! pub fn read_temperature(&mut self) -> Result<u8, E> {
6767//! let mut temp = [0];
6868//! self.i2c
69- //! .try_write_read (ADDR, &[TEMP_REGISTER], &mut temp)
69+ //! .write_read (ADDR, &[TEMP_REGISTER], &mut temp)
7070//! .and(Ok(temp[0]))
7171//! }
7272//! }
8989//! pub fn read_temperature(&mut self) -> Result<u8, E> {
9090//! let mut temp = [0];
9191//! self.i2c
92- //! .try_write_read (ADDR, &[TEMP_REGISTER], &mut temp)
92+ //! .write_read (ADDR, &[TEMP_REGISTER], &mut temp)
9393//! .and(Ok(temp[0]))
9494//! }
9595//! }
@@ -135,7 +135,7 @@ pub trait Read<A: AddressMode = SevenBitAddress> {
135135 /// - `MAK` = master acknowledge
136136 /// - `NMAK` = master no acknowledge
137137 /// - `SP` = stop condition
138- fn try_read ( & mut self , address : A , buffer : & mut [ u8 ] ) -> Result < ( ) , Self :: Error > ;
138+ fn read ( & mut self , address : A , buffer : & mut [ u8 ] ) -> Result < ( ) , Self :: Error > ;
139139}
140140
141141/// Blocking write
@@ -159,7 +159,7 @@ pub trait Write<A: AddressMode = SevenBitAddress> {
159159 /// - `SAK` = slave acknowledge
160160 /// - `Bi` = ith byte of data
161161 /// - `SP` = stop condition
162- fn try_write ( & mut self , address : A , bytes : & [ u8 ] ) -> Result < ( ) , Self :: Error > ;
162+ fn write ( & mut self , address : A , bytes : & [ u8 ] ) -> Result < ( ) , Self :: Error > ;
163163}
164164
165165/// Blocking write (iterator version)
@@ -172,7 +172,7 @@ pub trait WriteIter<A: AddressMode = SevenBitAddress> {
172172 /// # I2C Events (contract)
173173 ///
174174 /// Same as `Write`
175- fn try_write_iter < B > ( & mut self , address : A , bytes : B ) -> Result < ( ) , Self :: Error >
175+ fn write_iter < B > ( & mut self , address : A , bytes : B ) -> Result < ( ) , Self :: Error >
176176 where
177177 B : IntoIterator < Item = u8 > ;
178178}
@@ -204,7 +204,7 @@ pub trait WriteRead<A: AddressMode = SevenBitAddress> {
204204 /// - `MAK` = master acknowledge
205205 /// - `NMAK` = master no acknowledge
206206 /// - `SP` = stop condition
207- fn try_write_read (
207+ fn write_read (
208208 & mut self ,
209209 address : A ,
210210 bytes : & [ u8 ] ,
@@ -223,7 +223,7 @@ pub trait WriteIterRead<A: AddressMode = SevenBitAddress> {
223223 /// # I2C Events (contract)
224224 ///
225225 /// Same as the `WriteRead` trait
226- fn try_write_iter_read < B > (
226+ fn write_iter_read < B > (
227227 & mut self ,
228228 address : A ,
229229 bytes : B ,
@@ -264,11 +264,8 @@ pub trait Transactional<A: AddressMode = SevenBitAddress> {
264264 /// - `SAD+R/W` = slave address followed by bit 1 to indicate reading or 0 to indicate writing
265265 /// - `SR` = repeated start condition
266266 /// - `SP` = stop condition
267- fn try_exec < ' a > (
268- & mut self ,
269- address : A ,
270- operations : & mut [ Operation < ' a > ] ,
271- ) -> Result < ( ) , Self :: Error > ;
267+ fn exec < ' a > ( & mut self , address : A , operations : & mut [ Operation < ' a > ] )
268+ -> Result < ( ) , Self :: Error > ;
272269}
273270
274271/// Transactional I2C interface (iterator version).
@@ -291,7 +288,7 @@ pub trait TransactionalIter<A: AddressMode = SevenBitAddress> {
291288 /// - `SAD+R/W` = slave address followed by bit 1 to indicate reading or 0 to indicate writing
292289 /// - `SR` = repeated start condition
293290 /// - `SP` = stop condition
294- fn try_exec_iter < ' a , O > ( & mut self , address : A , operations : O ) -> Result < ( ) , Self :: Error >
291+ fn exec_iter < ' a , O > ( & mut self , address : A , operations : O ) -> Result < ( ) , Self :: Error >
295292 where
296293 O : IntoIterator < Item = Operation < ' a > > ;
297294}
@@ -310,7 +307,7 @@ pub trait TransactionalIter<A: AddressMode = SevenBitAddress> {
310307///
311308/// impl i2c::Transactional<i2c::SevenBitAddress> for I2c1 {
312309/// # type Error = ();
313- /// fn try_exec <'a>(
310+ /// fn exec <'a>(
314311/// &mut self,
315312/// address: i2c::SevenBitAddress,
316313/// operations: &mut [i2c::Operation<'a>],
@@ -327,7 +324,7 @@ pub trait TransactionalIter<A: AddressMode = SevenBitAddress> {
327324/// use i2c::Write;
328325///
329326/// let mut i2c1 = I2c1{};
330- /// i2c1.try_write (0x01, &[0xAB, 0xCD]).unwrap();
327+ /// i2c1.write (0x01, &[0xAB, 0xCD]).unwrap();
331328/// ```
332329pub mod transactional {
333330 use super :: { AddressMode , Operation , Read , Transactional , Write , WriteRead } ;
@@ -343,8 +340,8 @@ pub mod transactional {
343340 {
344341 type Error = E ;
345342
346- fn try_write ( & mut self , address : A , bytes : & [ u8 ] ) -> Result < ( ) , Self :: Error > {
347- self . try_exec ( address, & mut [ Operation :: Write ( bytes) ] )
343+ fn write ( & mut self , address : A , bytes : & [ u8 ] ) -> Result < ( ) , Self :: Error > {
344+ self . exec ( address, & mut [ Operation :: Write ( bytes) ] )
348345 }
349346 }
350347
@@ -355,8 +352,8 @@ pub mod transactional {
355352 {
356353 type Error = E ;
357354
358- fn try_read ( & mut self , address : A , buffer : & mut [ u8 ] ) -> Result < ( ) , Self :: Error > {
359- self . try_exec ( address, & mut [ Operation :: Read ( buffer) ] )
355+ fn read ( & mut self , address : A , buffer : & mut [ u8 ] ) -> Result < ( ) , Self :: Error > {
356+ self . exec ( address, & mut [ Operation :: Read ( buffer) ] )
360357 }
361358 }
362359
@@ -367,13 +364,13 @@ pub mod transactional {
367364 {
368365 type Error = E ;
369366
370- fn try_write_read (
367+ fn write_read (
371368 & mut self ,
372369 address : A ,
373370 bytes : & [ u8 ] ,
374371 buffer : & mut [ u8 ] ,
375372 ) -> Result < ( ) , Self :: Error > {
376- self . try_exec (
373+ self . exec (
377374 address,
378375 & mut [ Operation :: Write ( bytes) , Operation :: Read ( buffer) ] ,
379376 )
0 commit comments