diff options
| author | HybridChild <[email protected]> | 2025-08-23 09:17:49 +0200 |
|---|---|---|
| committer | HybridChild <[email protected]> | 2025-08-23 09:17:49 +0200 |
| commit | fbefd6c36aa123e479e39d2bd8c37d987e36597c (patch) | |
| tree | faabb9d1e196fa9ef75304d54224a6983edaf2c6 | |
| parent | 572a40b4eee99b177733f50b08e29ff9b5ab6fa5 (diff) | |
Revert "stm32/i2c: v1 and v2 now has separate definitions for the State struct"
This reverts commit b690a0314f0f2e42137ad4b3e867e056c1d3c14e.
| -rw-r--r-- | embassy-stm32/src/i2c/mod.rs | 17 | ||||
| -rw-r--r-- | embassy-stm32/src/i2c/v1.rs | 15 | ||||
| -rw-r--r-- | embassy-stm32/src/i2c/v2.rs | 15 |
3 files changed, 14 insertions, 33 deletions
diff --git a/embassy-stm32/src/i2c/mod.rs b/embassy-stm32/src/i2c/mod.rs index 675a392f9..4caa35efb 100644 --- a/embassy-stm32/src/i2c/mod.rs +++ b/embassy-stm32/src/i2c/mod.rs | |||
| @@ -5,9 +5,6 @@ | |||
| 5 | #[cfg_attr(any(i2c_v2, i2c_v3), path = "v2.rs")] | 5 | #[cfg_attr(any(i2c_v2, i2c_v3), path = "v2.rs")] |
| 6 | mod _version; | 6 | mod _version; |
| 7 | 7 | ||
| 8 | // Type alias for the peri_trait! macro | ||
| 9 | type State = _version::State; | ||
| 10 | |||
| 11 | mod config; | 8 | mod config; |
| 12 | 9 | ||
| 13 | use core::future::Future; | 10 | use core::future::Future; |
| @@ -16,6 +13,7 @@ use core::marker::PhantomData; | |||
| 16 | 13 | ||
| 17 | pub use config::*; | 14 | pub use config::*; |
| 18 | use embassy_hal_internal::Peri; | 15 | use embassy_hal_internal::Peri; |
| 16 | use embassy_sync::waitqueue::AtomicWaker; | ||
| 19 | #[cfg(feature = "time")] | 17 | #[cfg(feature = "time")] |
| 20 | use embassy_time::{Duration, Instant}; | 18 | use embassy_time::{Duration, Instant}; |
| 21 | use mode::MasterMode; | 19 | use mode::MasterMode; |
| @@ -277,6 +275,19 @@ impl Timeout { | |||
| 277 | } | 275 | } |
| 278 | } | 276 | } |
| 279 | 277 | ||
| 278 | struct State { | ||
| 279 | #[allow(unused)] | ||
| 280 | waker: AtomicWaker, | ||
| 281 | } | ||
| 282 | |||
| 283 | impl State { | ||
| 284 | const fn new() -> Self { | ||
| 285 | Self { | ||
| 286 | waker: AtomicWaker::new(), | ||
| 287 | } | ||
| 288 | } | ||
| 289 | } | ||
| 290 | |||
| 280 | struct Info { | 291 | struct Info { |
| 281 | regs: crate::pac::i2c::I2c, | 292 | regs: crate::pac::i2c::I2c, |
| 282 | rcc: RccInfo, | 293 | rcc: RccInfo, |
diff --git a/embassy-stm32/src/i2c/v1.rs b/embassy-stm32/src/i2c/v1.rs index b362ab017..879d1686b 100644 --- a/embassy-stm32/src/i2c/v1.rs +++ b/embassy-stm32/src/i2c/v1.rs | |||
| @@ -17,21 +17,6 @@ use super::*; | |||
| 17 | use crate::mode::Mode; | 17 | use crate::mode::Mode; |
| 18 | use crate::pac::i2c; | 18 | use crate::pac::i2c; |
| 19 | 19 | ||
| 20 | use embassy_sync::waitqueue::AtomicWaker; | ||
| 21 | |||
| 22 | /// I2C v2 peripheral state | ||
| 23 | pub(crate) struct State { | ||
| 24 | pub(crate) waker: AtomicWaker, | ||
| 25 | } | ||
| 26 | |||
| 27 | impl State { | ||
| 28 | pub(crate) const fn new() -> Self { | ||
| 29 | Self { | ||
| 30 | waker: AtomicWaker::new(), | ||
| 31 | } | ||
| 32 | } | ||
| 33 | } | ||
| 34 | |||
| 35 | // /!\ /!\ | 20 | // /!\ /!\ |
| 36 | // /!\ Implementation note! /!\ | 21 | // /!\ Implementation note! /!\ |
| 37 | // /!\ /!\ | 22 | // /!\ /!\ |
diff --git a/embassy-stm32/src/i2c/v2.rs b/embassy-stm32/src/i2c/v2.rs index 72a7d05ab..3b09f1b34 100644 --- a/embassy-stm32/src/i2c/v2.rs +++ b/embassy-stm32/src/i2c/v2.rs | |||
| @@ -12,21 +12,6 @@ use stm32_metapac::i2c::vals::{Addmode, Oamsk}; | |||
| 12 | use super::*; | 12 | use super::*; |
| 13 | use crate::pac::i2c; | 13 | use crate::pac::i2c; |
| 14 | 14 | ||
| 15 | use embassy_sync::waitqueue::AtomicWaker; | ||
| 16 | |||
| 17 | /// I2C v2 peripheral state | ||
| 18 | pub(crate) struct State { | ||
| 19 | pub(crate) waker: AtomicWaker, | ||
| 20 | } | ||
| 21 | |||
| 22 | impl State { | ||
| 23 | pub(crate) const fn new() -> Self { | ||
| 24 | Self { | ||
| 25 | waker: AtomicWaker::new(), | ||
| 26 | } | ||
| 27 | } | ||
| 28 | } | ||
| 29 | |||
| 30 | impl From<AddrMask> for Oamsk { | 15 | impl From<AddrMask> for Oamsk { |
| 31 | fn from(value: AddrMask) -> Self { | 16 | fn from(value: AddrMask) -> Self { |
| 32 | match value { | 17 | match value { |
