Rename to match upstream docs

This commit is contained in:
Caleb Jamison 2023-09-04 16:51:13 -04:00 committed by Dario Nieuwenhuis
parent 28e2570533
commit 18da91e252
2 changed files with 8 additions and 8 deletions

View File

@ -35,32 +35,32 @@ pub enum ReadStatus {
LeftoverBytes(u16), LeftoverBytes(u16),
} }
/// Device Configuration /// Slave Configuration
#[non_exhaustive] #[non_exhaustive]
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))] #[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct DeviceConfig { pub struct SlaveConfig {
/// Target Address /// Target Address
pub addr: u16, pub addr: u16,
} }
impl Default for DeviceConfig { impl Default for SlaveConfig {
fn default() -> Self { fn default() -> Self {
Self { addr: 0x55 } Self { addr: 0x55 }
} }
} }
pub struct I2cDevice<'d, T: Instance> { pub struct I2cSlave<'d, T: Instance> {
phantom: PhantomData<&'d mut T>, phantom: PhantomData<&'d mut T>,
} }
impl<'d, T: Instance> I2cDevice<'d, T> { impl<'d, T: Instance> I2cSlave<'d, T> {
pub fn new( pub fn new(
_peri: impl Peripheral<P = T> + 'd, _peri: impl Peripheral<P = T> + 'd,
scl: impl Peripheral<P = impl SclPin<T>> + 'd, scl: impl Peripheral<P = impl SclPin<T>> + 'd,
sda: impl Peripheral<P = impl SdaPin<T>> + 'd, sda: impl Peripheral<P = impl SdaPin<T>> + 'd,
_irq: impl Binding<T::Interrupt, InterruptHandler<T>>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>>,
config: DeviceConfig, config: SlaveConfig,
) -> Self { ) -> Self {
into_ref!(_peri, scl, sda); into_ref!(_peri, scl, sda);

View File

@ -1,11 +1,11 @@
mod i2c; mod i2c;
mod i2c_device; mod i2c_slave;
use core::marker::PhantomData; use core::marker::PhantomData;
use embassy_sync::waitqueue::AtomicWaker; use embassy_sync::waitqueue::AtomicWaker;
pub use i2c::{Config, I2c}; pub use i2c::{Config, I2c};
pub use i2c_device::{Command, DeviceConfig, I2cDevice, ReadStatus}; pub use i2c_slave::{Command, I2cSlave, ReadStatus, SlaveConfig};
use crate::{interrupt, pac, peripherals}; use crate::{interrupt, pac, peripherals};