aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Munns <[email protected]>2023-12-28 23:57:10 +0100
committerGitHub <[email protected]>2023-12-28 23:57:10 +0100
commita780339103239890e52fea26172071ec222ee81b (patch)
tree0afdaf620abf8c35ffaefdaacc5d8bf837cb33aa
parent47a94f22aa040f195a6265ff6950187647e1fe48 (diff)
stm32: Add breadcrumb to i2cv1 investigation
Adds an in-code breadcrumb for https://github.com/embassy-rs/embassy/issues/2372
-rw-r--r--embassy-stm32/src/i2c/v1.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/embassy-stm32/src/i2c/v1.rs b/embassy-stm32/src/i2c/v1.rs
index df5b44c2d..134593276 100644
--- a/embassy-stm32/src/i2c/v1.rs
+++ b/embassy-stm32/src/i2c/v1.rs
@@ -1,3 +1,9 @@
1//! # I2Cv1
2//!
3//! This implementation is used for STM32F1, STM32F2, STM32F4, and STM32L1 devices.
4//!
5//! All other devices (as of 2023-12-28) use [`v2`](super::v2) instead.
6
1use core::future::poll_fn; 7use core::future::poll_fn;
2use core::task::Poll; 8use core::task::Poll;
3 9
@@ -10,6 +16,17 @@ use crate::dma::Transfer;
10use crate::pac::i2c; 16use crate::pac::i2c;
11use crate::time::Hertz; 17use crate::time::Hertz;
12 18
19// /!\ /!\
20// /!\ Implementation note! /!\
21// /!\ /!\
22//
23// It's somewhat unclear whether using interrupts here in a *strictly* one-shot style is actually
24// what we want! If you are looking in this file because you are doing async I2C and your code is
25// just totally hanging (sometimes), maybe swing by this issue:
26// <https://github.com/embassy-rs/embassy/issues/2372>.
27//
28// There's some more details there, and we might have a fix for you. But please let us know if you
29// hit a case like this!
13pub unsafe fn on_interrupt<T: Instance>() { 30pub unsafe fn on_interrupt<T: Instance>() {
14 let regs = T::regs(); 31 let regs = T::regs();
15 // i2c v2 only woke the task on transfer complete interrupts. v1 uses interrupts for a bunch of 32 // i2c v2 only woke the task on transfer complete interrupts. v1 uses interrupts for a bunch of