diff options
| author | jrmoulton <[email protected]> | 2024-06-17 21:23:24 -0600 |
|---|---|---|
| committer | jrmoulton <[email protected]> | 2024-08-13 09:46:16 -0600 |
| commit | 65c7457c01317a803817cfdfac7b66ab23adf710 (patch) | |
| tree | 74d4dd1e3ed163798f125e76155f1fdd43d7b8f8 | |
| parent | 49357709ed4f619144746dd04e088d78ad7f355f (diff) | |
reference the i2c mode in v1 module
| -rw-r--r-- | embassy-stm32/src/i2c/v1.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/embassy-stm32/src/i2c/v1.rs b/embassy-stm32/src/i2c/v1.rs index 28026f83c..a93a5d987 100644 --- a/embassy-stm32/src/i2c/v1.rs +++ b/embassy-stm32/src/i2c/v1.rs | |||
| @@ -11,6 +11,7 @@ use embassy_embedded_hal::SetConfig; | |||
| 11 | use embassy_futures::select::{select, Either}; | 11 | use embassy_futures::select::{select, Either}; |
| 12 | use embassy_hal_internal::drop::OnDrop; | 12 | use embassy_hal_internal::drop::OnDrop; |
| 13 | use embedded_hal_1::i2c::Operation; | 13 | use embedded_hal_1::i2c::Operation; |
| 14 | use mode::Master; | ||
| 14 | 15 | ||
| 15 | use super::*; | 16 | use super::*; |
| 16 | use crate::mode::Mode as PeriMode; | 17 | use crate::mode::Mode as PeriMode; |
| @@ -41,7 +42,7 @@ pub unsafe fn on_interrupt<T: Instance>() { | |||
| 41 | }); | 42 | }); |
| 42 | } | 43 | } |
| 43 | 44 | ||
| 44 | impl<'d, M: PeriMode> I2c<'d, M> { | 45 | impl<'d, M: PeriMode> I2c<'d, M, Master> { |
| 45 | pub(crate) fn init(&mut self, freq: Hertz, _config: Config) { | 46 | pub(crate) fn init(&mut self, freq: Hertz, _config: Config) { |
| 46 | self.info.regs.cr1().modify(|reg| { | 47 | self.info.regs.cr1().modify(|reg| { |
| 47 | reg.set_pe(false); | 48 | reg.set_pe(false); |
| @@ -354,7 +355,7 @@ impl<'d, M: PeriMode> I2c<'d, M> { | |||
| 354 | } | 355 | } |
| 355 | } | 356 | } |
| 356 | 357 | ||
| 357 | impl<'d> I2c<'d, Async> { | 358 | impl<'d> I2c<'d, Async, Master> { |
| 358 | async fn write_frame(&mut self, address: u8, write: &[u8], frame: FrameOptions) -> Result<(), Error> { | 359 | async fn write_frame(&mut self, address: u8, write: &[u8], frame: FrameOptions) -> Result<(), Error> { |
| 359 | self.info.regs.cr2().modify(|w| { | 360 | self.info.regs.cr2().modify(|w| { |
| 360 | // Note: Do not enable the ITBUFEN bit in the I2C_CR2 register if DMA is used for | 361 | // Note: Do not enable the ITBUFEN bit in the I2C_CR2 register if DMA is used for |
| @@ -800,7 +801,7 @@ impl Timings { | |||
| 800 | } | 801 | } |
| 801 | } | 802 | } |
| 802 | 803 | ||
| 803 | impl<'d, M: PeriMode> SetConfig for I2c<'d, M> { | 804 | impl<'d, M: PeriMode> SetConfig for I2c<'d, M, Master> { |
| 804 | type Config = Hertz; | 805 | type Config = Hertz; |
| 805 | type ConfigError = (); | 806 | type ConfigError = (); |
| 806 | fn set_config(&mut self, config: &Self::Config) -> Result<(), ()> { | 807 | fn set_config(&mut self, config: &Self::Config) -> Result<(), ()> { |
