aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2023-12-28 23:58:19 +0100
committerGitHub <[email protected]>2023-12-28 23:58:19 +0100
commit90e96d281f87efdbea3a1418f5354f14386a42e8 (patch)
tree662c46d43fe831f08ebe779b7a588b4bccf6d9f9
parenta2faa9e14a6964a7b27be65a841f686f6bee0271 (diff)
parenta780339103239890e52fea26172071ec222ee81b (diff)
Merge pull request #2373 from embassy-rs/jamesmunns-patch-2
stm32: Add breadcrumb to i2cv1 investigation
-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 231d08f18..cbbc201de 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