mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-25 16:23:10 +00:00
Rename to match upstream docs
This commit is contained in:
parent
28e2570533
commit
18da91e252
@ -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);
|
||||||
|
|
@ -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};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user