Comments (10)
I think we can close this now, with #118 & #103 being merged. We can explore a closure-based approach in another issue.
from esp-hal.
Originally, I thought of something like this as a separate crate - in any case I'd love to have this opt-in or opt-out since e.g. for esp-wifi
I'm not sure if we can do it this way ... but maybe we can ... anyway, would be good to have a choice.
Additionally (not now probably) it would be nice to have some convenience to pass resources into the handlers - not as invasive as RTIC in best case. But haven't thought that through.
Other than that sounds like a good idea
from esp-hal.
Originally, I thought of something like this as a separate crate - in any case I'd love to have this opt-in or opt-out since e.g. for esp-wifi I'm not sure if we can do it this way ... but maybe we can ... anyway, would be good to have a choice.
Because there a predetermined interrupts for WiFi, bluetooth etc? Provided they set a flag in the interrupt status I think we should be okay, as we can add WIFI
& BLUETOOTH
handlers in our PAC crates, then esp-wifi can use them.
Even if that doesn't work, for Xtensa, there are also predetermined interrupts for CPU timers etc, so we will need to solve this issue anyway. It should be simple enough to have a per chip interrupt mask that will give us the available "free" cpu interrupts for the user to use.
from esp-hal.
By the way, if you enable all interrupts on Xtensa, does your board hang (presumably in the default interrupt handler for some interrupt)? I'd like to track down what these interrupts are, and if we can stop them.
from esp-hal.
Yes it hangs for me, too. I think it's the Xtensa timer interrupts which fire
from esp-hal.
I think you're right, from my testing I believe Interrupt6Timer0Priority1
, Interrupt15Timer1Priority3
& Interrupt16Timer2Priority5
are always pending. This is odd, because it should be being disabled at boot: https://github.com/esp-rs/xtensa-lx-rt/blob/455d2b77b8a5724d36db0ea66c88467a4515f376/src/lib.rs#L72
from esp-hal.
Ah! reset_timers
function needs be updated, it is only resetting the timers on the esp32...
from esp-hal.
One thing that came to my mind ... not sure if it's a good idea or a terrible one:
What if we make the user's interrupt handlers actual callbacks?
Then users could just take (mutable) reference into a closure without all the static
frills.
I played around with that in the ESP32-C3 timer example and it looks quite promising to me. But maybe I overlooked something
Unfortunately, with no-alloc
that works fine for Fn
and FnMut
but not so good for FnOnce
from esp-hal.
We could do this for sure! I think we'll get the pac interrupt version in first, then we can add a separate feature to use closure callbacks.
Then users could just take (mutable) reference into a closure without all the static frills.
Maybe I'm missing something, but wouldn't it have to be an immutable borrow? With some interior mutability via a mutex, because once the call back is set anything borrowed by the closure will be borrowed that whole time?
from esp-hal.
Maybe I'm missing something, but wouldn't it have to be an immutable borrow? With some interior mutability via a mutex, because once the call back is set anything borrowed by the closure will be borrowed that whole time?
Yes, you are right if both sides want to access it - only if no access is needed at the call-site anymore it could be mutable - like in the multicore example:
esp-hal/esp32s3-hal/examples/multicore.rs
Line 53 in 93b7be2
Moving it would be better but then it would need to be FnOnce
from esp-hal.
Related Issues (20)
- Latest release (v0.2.2) of `xtensa-lx-rt-proc-macros` not used by published `xtensa-lx-rt`
- Unable to Configure Prescaler for MCPWM Timer in esp-hal
- Implement touch support for `esp32s2` and `esp32s3`. HOT 1
- Add listen only and self-test mode support for TWAI
- I2C slave driver HOT 2
- TWAI HIL test HOT 1
- xtensa-lx feature not found in esp-hal HOT 4
- esp32s3: i2c async broken in #1900 HOT 5
- Make AnyPin accessible from `::gpio::AnyPin`? HOT 3
- Implement embassy_embedded_hal::SetConfig HOT 1
- Feature Request: Sleep and wake support for ESP32C2 HOT 3
- SD/MMC driver HOT 1
- esp_wifi does not compile with esp_ieee802154 imported at the same time HOT 1
- Support using `trouble` as a BLE stack HOT 1
- Remove all remaining `#![allow(missing_docs)]` attributes and finish documenting all public types HOT 2
- Update `embassy-executor` dependency in esp-hal-embassy crate.
- GPIO regression on esp32 after touch peripheral was merged HOT 2
- Provide a more robust solution for getting the current time HOT 2
- How to `Exclusive SPI Bus` HOT 4
- UsbSerialJtag async breaks probe-rs on C6 on latest git HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esp-hal.