reference the i2c mode in v1 module
This commit is contained in:
parent
49357709ed
commit
65c7457c01
@ -11,6 +11,7 @@ use embassy_embedded_hal::SetConfig;
|
|||||||
use embassy_futures::select::{select, Either};
|
use embassy_futures::select::{select, Either};
|
||||||
use embassy_hal_internal::drop::OnDrop;
|
use embassy_hal_internal::drop::OnDrop;
|
||||||
use embedded_hal_1::i2c::Operation;
|
use embedded_hal_1::i2c::Operation;
|
||||||
|
use mode::Master;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::mode::Mode as PeriMode;
|
use crate::mode::Mode as PeriMode;
|
||||||
@ -41,7 +42,7 @@ pub unsafe fn on_interrupt<T: Instance>() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, M: PeriMode> I2c<'d, M> {
|
impl<'d, M: PeriMode> I2c<'d, M, Master> {
|
||||||
pub(crate) fn init(&mut self, freq: Hertz, _config: Config) {
|
pub(crate) fn init(&mut self, freq: Hertz, _config: Config) {
|
||||||
self.info.regs.cr1().modify(|reg| {
|
self.info.regs.cr1().modify(|reg| {
|
||||||
reg.set_pe(false);
|
reg.set_pe(false);
|
||||||
@ -354,7 +355,7 @@ impl<'d, M: PeriMode> I2c<'d, M> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d> I2c<'d, Async> {
|
impl<'d> I2c<'d, Async, Master> {
|
||||||
async fn write_frame(&mut self, address: u8, write: &[u8], frame: FrameOptions) -> Result<(), Error> {
|
async fn write_frame(&mut self, address: u8, write: &[u8], frame: FrameOptions) -> Result<(), Error> {
|
||||||
self.info.regs.cr2().modify(|w| {
|
self.info.regs.cr2().modify(|w| {
|
||||||
// Note: Do not enable the ITBUFEN bit in the I2C_CR2 register if DMA is used for
|
// Note: Do not enable the ITBUFEN bit in the I2C_CR2 register if DMA is used for
|
||||||
@ -800,7 +801,7 @@ impl Timings {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'d, M: PeriMode> SetConfig for I2c<'d, M> {
|
impl<'d, M: PeriMode> SetConfig for I2c<'d, M, Master> {
|
||||||
type Config = Hertz;
|
type Config = Hertz;
|
||||||
type ConfigError = ();
|
type ConfigError = ();
|
||||||
fn set_config(&mut self, config: &Self::Config) -> Result<(), ()> {
|
fn set_config(&mut self, config: &Self::Config) -> Result<(), ()> {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user