aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaleb Jamison <[email protected]>2023-09-04 16:51:13 -0400
committerDario Nieuwenhuis <[email protected]>2023-09-10 23:01:15 +0200
commit18da91e2529b7973d0476e5c239709b3851db14b (patch)
tree33768e4f25d10aee40d32ab32d865ee8dc56eebc
parent28e25705339e5c275c5025634aab919d52459770 (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.rs4
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))]
42pub struct DeviceConfig { 42pub struct SlaveConfig {
43 /// Target Address 43 /// Target Address
44 pub addr: u16, 44 pub addr: u16,
45} 45}
46 46
47impl Default for DeviceConfig { 47impl 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
53pub struct I2cDevice<'d, T: Instance> { 53pub struct I2cSlave<'d, T: Instance> {
54 phantom: PhantomData<&'d mut T>, 54 phantom: PhantomData<&'d mut T>,
55} 55}
56 56
57impl<'d, T: Instance> I2cDevice<'d, T> { 57impl<'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 @@
1mod i2c; 1mod i2c;
2mod i2c_device; 2mod i2c_slave;
3 3
4use core::marker::PhantomData; 4use core::marker::PhantomData;
5 5
6use embassy_sync::waitqueue::AtomicWaker; 6use embassy_sync::waitqueue::AtomicWaker;
7pub use i2c::{Config, I2c}; 7pub use i2c::{Config, I2c};
8pub use i2c_device::{Command, DeviceConfig, I2cDevice, ReadStatus}; 8pub use i2c_slave::{Command, I2cSlave, ReadStatus, SlaveConfig};
9 9
10use crate::{interrupt, pac, peripherals}; 10use crate::{interrupt, pac, peripherals};
11 11