Q: How to use Wait::wait_for_low and avoid the race condition between interrupt setup and pin triggering?
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 文档
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- rust
- 领域
- embedded-iot
调研方向
Start with embedded-hal-async/src/digital.rs at the Wait trait and compare the esp-hal GPIO implementation linked in the report. Determine whether the trait needs usage guidance or an API change to make interrupt setup safe before triggering activity, then document or specify the intended sequence and its completion criteria.
由索引模型根据 Issue 内容生成。
描述
Hi folks,
I am trying to detect a brief pulse using embedded-hal-async GPIO Wait trait. The methods like wait_for_low are perfect for that in general (https://github.com/rust-embedded/embedded-hal/blob/master/embedded-hal-async/src/digital.rs#L34)
However most of the implementations I have seen configure the interrupt within the wait_for_low method which means it must first be polled at least once (but sometimes more) before the interrupt is set up properly. See for example how the esp waits for the setup to be possible here https://github.com/esp-rs/esp-hal/blob/87d501766f178a2dd812c382ca257d268ee266ad/esp-hal/src/gpio/mod.rs#L2242
Now, I have a device where the pulse can disappear on its own and I need to detect it reliably. I have custom code that first sets up the interrupt and only then triggers the behavior. This works, but I would like to rewrite my custom code to adhere to the embedded-hal-async traits.
Do you have any idea about how to use the wait_for_low in this way? First set-up the interrupts, then do something outside to trigger the activity and then wait for the interrupt to happen?
The code I have right know looks roughly like this:
let w = WaitForPin::listen(gpio, pin, LOW);
device.start()
w.await;
TLDR: How to use Wait::wait_for_low and avoid the race condition between interrupt setup and pin triggering?
- 主要语言
- Rust
- 星标
- 2.7k
- 派生
- 283
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
rust-embedded/embedded-hal 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
rust-embedded/embedded-hal#742 · 1 条评论 ·
-
难度 5/5 一周以上 新手友好度 30/100
rust-embedded/embedded-hal#747 · 5 条评论 · 1 个 reaction ·
-
难度 5/5 一周以上 新手友好度 35/100
rust-embedded/embedded-hal#746 · 2 条评论 · 1 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 48/100
rust-embedded/embedded-hal#745 · 1 个 reaction ·
-
难度 2/5 1-3 小时 新手友好度 55/100
rust-embedded/embedded-hal#744 · 1 条评论 ·
查看 rust-embedded/embedded-hal 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 63/100
AimesSoft/NipaPlay-Reload#1022 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
ZcashFoundation/frost-tools#612 ·
-
难度 2/5 1-3 小时 新手友好度 64/100
ScoopInstaller/Extras#19070 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100