diff options
| author | Caleb Jamison <[email protected]> | 2023-09-04 16:51:13 -0400 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2023-09-10 23:01:15 +0200 |
| commit | 18da91e2529b7973d0476e5c239709b3851db14b (patch) | |
| tree | 33768e4f25d10aee40d32ab32d865ee8dc56eebc | |
| parent | 28e25705339e5c275c5025634aab919d52459770 (diff) | |
Rename to match upstream docs
| -rw-r--r-- | embassy-rp/src/i2c/i2c_slave.rs (renamed from embassy-rp/src/i2c/i2c_device.rs) | 12 | ||||
| -rw-r--r-- | embassy-rp/src/i2c/mod.rs | 4 |
2 files changed, 8 insertions, 8 deletions
diff --git a/embassy-rp/src/i2c/i2c_device.rs b/embassy-rp/src/i2c/i2c_slave.rs index 5c78a86e3..154a0f32c 100644 --- a/embassy-rp/src/i2c/i2c_device.rs +++ b/embassy-rp/src/i2c/i2c_slave.rs | |||
| @@ -35,32 +35,32 @@ pub enum ReadStatus { | |||
| 35 | LeftoverBytes(u16), | 35 | LeftoverBytes(u16), |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | /// Device Configuration | 38 | /// Slave Configuration |
| 39 | #[non_exhaustive] | 39 | #[non_exhaustive] |
| 40 | #[derive(Copy, Clone)] | 40 | #[derive(Copy, Clone)] |
| 41 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 41 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 42 | pub struct DeviceConfig { | 42 | pub struct SlaveConfig { |
| 43 | /// Target Address | 43 | /// Target Address |
| 44 | pub addr: u16, | 44 | pub addr: u16, |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | impl Default for DeviceConfig { | 47 | impl Default for SlaveConfig { |
| 48 | fn default() -> Self { | 48 | fn default() -> Self { |
| 49 | Self { addr: 0x55 } | 49 | Self { addr: 0x55 } |
| 50 | } | 50 | } |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | pub struct I2cDevice<'d, T: Instance> { | 53 | pub struct I2cSlave<'d, T: Instance> { |
| 54 | phantom: PhantomData<&'d mut T>, | 54 | phantom: PhantomData<&'d mut T>, |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | impl<'d, T: Instance> I2cDevice<'d, T> { | 57 | impl<'d, T: Instance> I2cSlave<'d, T> { |
| 58 | pub fn new( | 58 | pub fn new( |
| 59 | _peri: impl Peripheral<P = T> + 'd, | 59 | _peri: impl Peripheral<P = T> + 'd, |
| 60 | scl: impl Peripheral<P = impl SclPin<T>> + 'd, | 60 | scl: impl Peripheral<P = impl SclPin<T>> + 'd, |
| 61 | sda: impl Peripheral<P = impl SdaPin<T>> + 'd, | 61 | sda: impl Peripheral<P = impl SdaPin<T>> + 'd, |
| 62 | _irq: impl Binding<T::Interrupt, InterruptHandler<T>>, | 62 | _irq: impl Binding<T::Interrupt, InterruptHandler<T>>, |
| 63 | config: DeviceConfig, | 63 | config: SlaveConfig, |
| 64 | ) -> Self { | 64 | ) -> Self { |
| 65 | into_ref!(_peri, scl, sda); | 65 | into_ref!(_peri, scl, sda); |
| 66 | 66 | ||
diff --git a/embassy-rp/src/i2c/mod.rs b/embassy-rp/src/i2c/mod.rs index 2b3523d69..05662fa6a 100644 --- a/embassy-rp/src/i2c/mod.rs +++ b/embassy-rp/src/i2c/mod.rs | |||
| @@ -1,11 +1,11 @@ | |||
| 1 | mod i2c; | 1 | mod i2c; |
| 2 | mod i2c_device; | 2 | mod i2c_slave; |
| 3 | 3 | ||
| 4 | use core::marker::PhantomData; | 4 | use core::marker::PhantomData; |
| 5 | 5 | ||
| 6 | use embassy_sync::waitqueue::AtomicWaker; | 6 | use embassy_sync::waitqueue::AtomicWaker; |
| 7 | pub use i2c::{Config, I2c}; | 7 | pub use i2c::{Config, I2c}; |
| 8 | pub use i2c_device::{Command, DeviceConfig, I2cDevice, ReadStatus}; | 8 | pub use i2c_slave::{Command, I2cSlave, ReadStatus, SlaveConfig}; |
| 9 | 9 | ||
| 10 | use crate::{interrupt, pac, peripherals}; | 10 | use crate::{interrupt, pac, peripherals}; |
| 11 | 11 | ||
