start working on i2c slave implementation
This commit is contained in:
parent
2e03acfa62
commit
96cfe503c6
2 changed files with 25 additions and 0 deletions
23
src/i2c_slave.rs
Normal file
23
src/i2c_slave.rs
Normal file
|
|
@ -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(impl_trait_in_assoc_type)]
|
||||
|
||||
mod i2c_slave;
|
||||
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_time::Timer;
|
||||
use hal::bind_interrupts;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue