aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHybridChild <[email protected]>2025-08-23 09:17:49 +0200
committerHybridChild <[email protected]>2025-08-23 09:17:49 +0200
commitfbefd6c36aa123e479e39d2bd8c37d987e36597c (patch)
treefaabb9d1e196fa9ef75304d54224a6983edaf2c6
parent572a40b4eee99b177733f50b08e29ff9b5ab6fa5 (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.rs17
-rw-r--r--embassy-stm32/src/i2c/v1.rs15
-rw-r--r--embassy-stm32/src/i2c/v2.rs15
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")]
6mod _version; 6mod _version;
7 7
8// Type alias for the peri_trait! macro
9type State = _version::State;
10
11mod config; 8mod config;
12 9
13use core::future::Future; 10use core::future::Future;
@@ -16,6 +13,7 @@ use core::marker::PhantomData;
16 13
17pub use config::*; 14pub use config::*;
18use embassy_hal_internal::Peri; 15use embassy_hal_internal::Peri;
16use embassy_sync::waitqueue::AtomicWaker;
19#[cfg(feature = "time")] 17#[cfg(feature = "time")]
20use embassy_time::{Duration, Instant}; 18use embassy_time::{Duration, Instant};
21use mode::MasterMode; 19use mode::MasterMode;
@@ -277,6 +275,19 @@ impl Timeout {
277 } 275 }
278} 276}
279 277
278struct State {
279 #[allow(unused)]
280 waker: AtomicWaker,
281}
282
283impl State {
284 const fn new() -> Self {
285 Self {
286 waker: AtomicWaker::new(),
287 }
288 }
289}
290
280struct Info { 291struct 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::*;
17use crate::mode::Mode; 17use crate::mode::Mode;
18use crate::pac::i2c; 18use crate::pac::i2c;
19 19
20use embassy_sync::waitqueue::AtomicWaker;
21
22/// I2C v2 peripheral state
23pub(crate) struct State {
24 pub(crate) waker: AtomicWaker,
25}
26
27impl 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};
12use super::*; 12use super::*;
13use crate::pac::i2c; 13use crate::pac::i2c;
14 14
15use embassy_sync::waitqueue::AtomicWaker;
16
17/// I2C v2 peripheral state
18pub(crate) struct State {
19 pub(crate) waker: AtomicWaker,
20}
21
22impl State {
23 pub(crate) const fn new() -> Self {
24 Self {
25 waker: AtomicWaker::new(),
26 }
27 }
28}
29
30impl From<AddrMask> for Oamsk { 15impl From<AddrMask> for Oamsk {
31 fn from(value: AddrMask) -> Self { 16 fn from(value: AddrMask) -> Self {
32 match value { 17 match value {