|
40 | 40 | //!
|
41 | 41 | //! # For driver authors
|
42 | 42 | //!
|
43 |
| -//! Drivers can be generic over `I2c<SevenBitAddress>` or `I2c<TenBitAddress>` depending |
44 |
| -//! on the kind of address supported by the target device. If it can use either, the driver can |
| 43 | +//! Drivers can select the adequate address length with `I2c<SevenBitAddress>` or `I2c<TenBitAddress>` depending |
| 44 | +//! on the target device. If it can use either, the driver can |
45 | 45 | //! be generic over the address kind as well, though this is rare.
|
46 | 46 | //!
|
47 | 47 | //! Drivers should take the `I2c` instance as an argument to `new()`, and store it in their
|
48 | 48 | //! struct. They **should not** take `&mut I2c`, the trait has a blanket impl for all `&mut T`
|
49 | 49 | //! so taking just `I2c` ensures the user can still pass a `&mut`, but is not forced to.
|
50 | 50 | //!
|
51 | 51 | //! Drivers **should not** try to enable bus sharing by taking `&mut I2c` at every method.
|
52 |
| -//! This is much less ergonomic than owning the `I2c`, and allowing the user to pass an |
| 52 | +//! This is much less ergonomic than owning the `I2c`, which still allows the user to pass an |
53 | 53 | //! implementation that does sharing behind the scenes
|
54 | 54 | //! (from [`embedded-hal-bus`](https://docs.rs/embedded-hal-bus), or others).
|
55 | 55 | //!
|
|
111 | 111 | //! supports sharing, such as Linux or some RTOSs.)
|
112 | 112 | //!
|
113 | 113 | //! Here is an example of an embedded-hal implementation of the `I2C` trait
|
114 |
| -//! for both modes. All trait methods have have default implementations in terms of `transaction`, |
115 |
| -//! so that's the only one that requires implementing. |
| 114 | +//! for both addressing modes. All trait methods have have default implementations in terms of `transaction`. |
| 115 | +//! As such, that is the only method that requires implementation in the HAL. |
116 | 116 | //!
|
117 | 117 | //! ```
|
118 | 118 | //! use embedded_hal::i2c::{self, SevenBitAddress, TenBitAddress, I2c, Operation};
|
|
0 commit comments