Q: How to use Wait::wait_for_low and avoid the race condition between interrupt setup and pin triggering?
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- rust
- Lĩnh vực
- embedded-iot
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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?
- Ngôn ngữ chính
- Rust
- Star
- 2.7k
- Fork
- 283
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của rust-embedded/embedded-hal
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
rust-embedded/embedded-hal#742 · 1 bình luận ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
rust-embedded/embedded-hal#747 · 5 bình luận · 1 reaction ·
-
Write without providing a bufferĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
rust-embedded/embedded-hal#746 · 2 bình luận · 1 reaction ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
rust-embedded/embedded-hal#745 · 1 reaction ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 55/100
rust-embedded/embedded-hal#744 · 1 bình luận ·
Tất cả issue của rust-embedded/embedded-hal
Issue tương tự
-
ai_p2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
ClickHouse/ClickHouse#123351 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
github/copilot-sdk#2804 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
lance-format/lance#9655 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug language::rust router
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Hexagon lifting issuesĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Vector35/binaryninja-api#8621 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày