start working on i2c slave implementation
This commit is contained in:
@@ -0,0 +1,23 @@
|
|||||||
|
use ch32_hal::{
|
||||||
|
self as hal,
|
||||||
|
i2c::{SclPin, SdaPin},
|
||||||
|
Peripheral,
|
||||||
|
};
|
||||||
|
use panic_halt as _;
|
||||||
|
|
||||||
|
use core::marker::PhantomData;
|
||||||
|
use hal::i2c::Instance;
|
||||||
|
|
||||||
|
pub struct I2cSlave<'d, T: Instance> {
|
||||||
|
_phantom: PhantomData<&'d mut T>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'d, T: Instance> I2cSlave<'d, T> {
|
||||||
|
pub fn new(
|
||||||
|
peri: impl Peripheral<P = T> + 'd,
|
||||||
|
scl: impl Peripheral<P = impl SclPin<T>> + 'd,
|
||||||
|
sda: impl Peripheral<P = impl SdaPin<T>> + 'd,
|
||||||
|
) -> Self {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,8 @@
|
|||||||
#![feature(type_alias_impl_trait)]
|
#![feature(type_alias_impl_trait)]
|
||||||
#![feature(impl_trait_in_assoc_type)]
|
#![feature(impl_trait_in_assoc_type)]
|
||||||
|
|
||||||
|
mod i2c_slave;
|
||||||
|
|
||||||
use embassy_executor::Spawner;
|
use embassy_executor::Spawner;
|
||||||
use embassy_time::Timer;
|
use embassy_time::Timer;
|
||||||
use hal::bind_interrupts;
|
use hal::bind_interrupts;
|
||||||
|
|||||||
Reference in New Issue
Block a user