Skip to content

Commit 64bdd64

Browse files
author
Em Shotton
committed
Update the I2C documentation to use "controller/target" instead of "master/slave" to align with the I2C bus specification v.7
1 parent bbd5803 commit 64bdd64

File tree

2 files changed

+48
-48
lines changed

2 files changed

+48
-48
lines changed

embedded-hal-async/src/i2c.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,44 +23,44 @@ pub use embedded_hal::i2c::{
2323

2424
/// Async I2c.
2525
pub trait I2c<A: AddressMode = SevenBitAddress>: ErrorType {
26-
/// Reads enough bytes from slave with `address` to fill `buffer`.
26+
/// Reads enough bytes from target with `address` to fill `buffer`.
2727
///
2828
/// # I2C Events (contract)
2929
///
3030
/// ``` text
31-
/// Master: ST SAD+R MAK MAK ... NMAK SP
32-
/// Slave: SAK B0 B1 ... BN
31+
/// Controller: ST TAD+R CAK CAK ... NCAK SP
32+
/// Target: TAK B0 B1 ... BN
3333
/// ```
3434
///
3535
/// Where
3636
///
3737
/// - `ST` = start condition
38-
/// - `SAD+R` = slave address followed by bit 1 to indicate reading
39-
/// - `SAK` = slave acknowledge
38+
/// - `TAD+R` = target address followed by bit 1 to indicate reading
39+
/// - `TAK` = target acknowledge
4040
/// - `Bi` = ith byte of data
41-
/// - `MAK` = master acknowledge
42-
/// - `NMAK` = master no acknowledge
41+
/// - `CAK` = controller acknowledge
42+
/// - `NCAK` = controller no acknowledge
4343
/// - `SP` = stop condition
4444
#[inline]
4545
async fn read(&mut self, address: A, read: &mut [u8]) -> Result<(), Self::Error> {
4646
self.transaction(address, &mut [Operation::Read(read)])
4747
.await
4848
}
4949

50-
/// Writes bytes to slave with address `address`.
50+
/// Writes bytes to target with address `address`.
5151
///
5252
/// # I2C Events (contract)
5353
///
5454
/// ``` text
55-
/// Master: ST SAD+W B0 B1 ... BN SP
56-
/// Slave: SAK SAK SAK ... SAK
55+
/// Controller: ST TAD+W B0 B1 ... BN SP
56+
/// Target: TAK TAK TAK ... TAK
5757
/// ```
5858
///
5959
/// Where
6060
///
6161
/// - `ST` = start condition
62-
/// - `SAD+W` = slave address followed by bit 0 to indicate writing
63-
/// - `SAK` = slave acknowledge
62+
/// - `TAD+W` = target address followed by bit 0 to indicate writing
63+
/// - `TAK` = target acknowledge
6464
/// - `Bi` = ith byte of data
6565
/// - `SP` = stop condition
6666
#[inline]
@@ -69,27 +69,27 @@ pub trait I2c<A: AddressMode = SevenBitAddress>: ErrorType {
6969
.await
7070
}
7171

72-
/// Writes bytes to slave with address `address` and then reads enough bytes to fill `read` *in a
72+
/// Writes bytes to target with address `address` and then reads enough bytes to fill `read` *in a
7373
/// single transaction*.
7474
///
7575
/// # I2C Events (contract)
7676
///
7777
/// ``` text
78-
/// Master: ST SAD+W O0 O1 ... OM SR SAD+R MAK MAK ... NMAK SP
79-
/// Slave: SAK SAK SAK ... SAK SAK I0 I1 ... IN
78+
/// Controller: ST TAD+W O0 O1 ... OM SR TAD+R CAK CAK ... NCAK SP
79+
/// Target: TAK TAK TAK ... TAK TAK I0 I1 ... IN
8080
/// ```
8181
///
8282
/// Where
8383
///
8484
/// - `ST` = start condition
85-
/// - `SAD+W` = slave address followed by bit 0 to indicate writing
86-
/// - `SAK` = slave acknowledge
85+
/// - `TAD+W` = target address followed by bit 0 to indicate writing
86+
/// - `TAK` = target acknowledge
8787
/// - `Oi` = ith outgoing byte of data
8888
/// - `SR` = repeated start condition
89-
/// - `SAD+R` = slave address followed by bit 1 to indicate reading
89+
/// - `TAD+R` = target address followed by bit 1 to indicate reading
9090
/// - `Ii` = ith incoming byte of data
91-
/// - `MAK` = master acknowledge
92-
/// - `NMAK` = master no acknowledge
91+
/// - `CAK` = controller acknowledge
92+
/// - `NCAK` = controller no acknowledge
9393
/// - `SP` = stop condition
9494
#[inline]
9595
async fn write_read(
@@ -108,14 +108,14 @@ pub trait I2c<A: AddressMode = SevenBitAddress>: ErrorType {
108108
/// Execute the provided operations on the I2C bus as a single transaction.
109109
///
110110
/// Transaction contract:
111-
/// - Before executing the first operation an ST is sent automatically. This is followed by SAD+R/W as appropriate.
111+
/// - Before executing the first operation an ST is sent automatically. This is followed by TAD+R/W as appropriate.
112112
/// - Data from adjacent operations of the same type are sent after each other without an SP or SR.
113-
/// - Between adjacent operations of a different type an SR and SAD+R/W is sent.
113+
/// - Between adjacent operations of a different type an SR and TAD+R/W is sent.
114114
/// - After executing the last operation an SP is sent automatically.
115-
/// - At the end of each read operation (before SP or SR), the master does not send an acknowledge for the last byte.
115+
/// - At the end of each read operation (before SP or SR), the controller does not send an acknowledge for the last byte.
116116
///
117117
/// - `ST` = start condition
118-
/// - `SAD+R/W` = slave address followed by bit 1 to indicate reading or 0 to indicate writing
118+
/// - `TAD+R/W` = target address followed by bit 1 to indicate reading or 0 to indicate writing
119119
/// - `SR` = repeated start condition
120120
/// - `SP` = stop condition
121121
async fn transaction(

embedded-hal/src/i2c.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -311,71 +311,71 @@ pub enum Operation<'a> {
311311

312312
/// Blocking I2C.
313313
pub trait I2c<A: AddressMode = SevenBitAddress>: ErrorType {
314-
/// Reads enough bytes from slave with `address` to fill `read`.
314+
/// Reads enough bytes from target with `address` to fill `read`.
315315
///
316316
/// # I2C Events (contract)
317317
///
318318
/// ``` text
319-
/// Master: ST SAD+R MAK MAK ... NMAK SP
320-
/// Slave: SAK B0 B1 ... BN
319+
/// Controller: ST TAD+R CAK CAK ... NCAK SP
320+
/// Target: TAK B0 B1 ... BN
321321
/// ```
322322
///
323323
/// Where
324324
///
325325
/// - `ST` = start condition
326-
/// - `SAD+R` = slave address followed by bit 1 to indicate reading
327-
/// - `SAK` = slave acknowledge
326+
/// - `TAD+R` = target address followed by bit 1 to indicate reading
327+
/// - `TAK` = target acknowledge
328328
/// - `Bi` = ith byte of data
329-
/// - `MAK` = master acknowledge
330-
/// - `NMAK` = master no acknowledge
329+
/// - `CAK` = controller acknowledge
330+
/// - `NCAK` = controller no acknowledge
331331
/// - `SP` = stop condition
332332
#[inline]
333333
fn read(&mut self, address: A, read: &mut [u8]) -> Result<(), Self::Error> {
334334
self.transaction(address, &mut [Operation::Read(read)])
335335
}
336336

337-
/// Writes bytes to slave with address `address`.
337+
/// Writes bytes to target with address `address`.
338338
///
339339
/// # I2C Events (contract)
340340
///
341341
/// ``` text
342-
/// Master: ST SAD+W B0 B1 ... BN SP
343-
/// Slave: SAK SAK SAK ... SAK
342+
/// Controller: ST TAD+W B0 B1 ... BN SP
343+
/// Target: TAK TAK TAK ... TAK
344344
/// ```
345345
///
346346
/// Where
347347
///
348348
/// - `ST` = start condition
349-
/// - `SAD+W` = slave address followed by bit 0 to indicate writing
350-
/// - `SAK` = slave acknowledge
349+
/// - `TAD+W` = target address followed by bit 0 to indicate writing
350+
/// - `TAK` = target acknowledge
351351
/// - `Bi` = ith byte of data
352352
/// - `SP` = stop condition
353353
#[inline]
354354
fn write(&mut self, address: A, write: &[u8]) -> Result<(), Self::Error> {
355355
self.transaction(address, &mut [Operation::Write(write)])
356356
}
357357

358-
/// Writes bytes to slave with address `address` and then reads enough bytes to fill `read` *in a
358+
/// Writes bytes to target with address `address` and then reads enough bytes to fill `read` *in a
359359
/// single transaction*.
360360
///
361361
/// # I2C Events (contract)
362362
///
363363
/// ``` text
364-
/// Master: ST SAD+W O0 O1 ... OM SR SAD+R MAK MAK ... NMAK SP
365-
/// Slave: SAK SAK SAK ... SAK SAK I0 I1 ... IN
364+
/// Controller: ST TAD+W O0 O1 ... OM SR TAD+R CAK CAK ... NCAK SP
365+
/// Target: TAK TAK TAK ... TAK TAK I0 I1 ... IN
366366
/// ```
367367
///
368368
/// Where
369369
///
370370
/// - `ST` = start condition
371-
/// - `SAD+W` = slave address followed by bit 0 to indicate writing
372-
/// - `SAK` = slave acknowledge
371+
/// - `TAD+W` = target address followed by bit 0 to indicate writing
372+
/// - `TAK` = target acknowledge
373373
/// - `Oi` = ith outgoing byte of data
374374
/// - `SR` = repeated start condition
375-
/// - `SAD+R` = slave address followed by bit 1 to indicate reading
375+
/// - `TAD+R` = target address followed by bit 1 to indicate reading
376376
/// - `Ii` = ith incoming byte of data
377-
/// - `MAK` = master acknowledge
378-
/// - `NMAK` = master no acknowledge
377+
/// - `CAK` = controller acknowledge
378+
/// - `NCAK` = controller no acknowledge
379379
/// - `SP` = stop condition
380380
#[inline]
381381
fn write_read(&mut self, address: A, write: &[u8], read: &mut [u8]) -> Result<(), Self::Error> {
@@ -388,14 +388,14 @@ pub trait I2c<A: AddressMode = SevenBitAddress>: ErrorType {
388388
/// Execute the provided operations on the I2C bus.
389389
///
390390
/// Transaction contract:
391-
/// - Before executing the first operation an ST is sent automatically. This is followed by SAD+R/W as appropriate.
391+
/// - Before executing the first operation an ST is sent automatically. This is followed by TAD+R/W as appropriate.
392392
/// - Data from adjacent operations of the same type are sent after each other without an SP or SR.
393-
/// - Between adjacent operations of a different type an SR and SAD+R/W is sent.
393+
/// - Between adjacent operations of a different type an SR and TAD+R/W is sent.
394394
/// - After executing the last operation an SP is sent automatically.
395-
/// - At the end of each read operation (before SP or SR), the master does not send an acknowledge for the last byte.
395+
/// - At the end of each read operation (before SP or SR), the controller does not send an acknowledge for the last byte.
396396
///
397397
/// - `ST` = start condition
398-
/// - `SAD+R/W` = slave address followed by bit 1 to indicate reading or 0 to indicate writing
398+
/// - `TAD+R/W` = target address followed by bit 1 to indicate reading or 0 to indicate writing
399399
/// - `SR` = repeated start condition
400400
/// - `SP` = stop condition
401401
fn transaction(

0 commit comments

Comments
 (0)