-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESP32: improve gpio module #1612
Comments
I studied gpio.trig to understand how to deal with interrupts in IDF. |
Hmm, it's quite possible I screwed something up when I had to change the gpio stuff to match the latest IDF when they did their gpio revamp. Do feel free to fix in whichever direction you reckon is best. We used to run from flash because that was the only option before. I don't really have an opinion either way as to whether the IRAM cost is worth the performance/responsiveness increase here. |
Hi, @jmattsson . Is it permissible to use the call writes the value to the port from trigger port the current implementation to ESP32? |
You're shadowing the global |
Thank you!!! |
@jmattsson I'm still not clear about the ISR requirements with respect to ISR code in IRAM. Missing a definite statement in some docs. |
It's actually quite a bit harder to get linker scripts going the way one might want to with the IDF, I'd recommend avoiding it when possible. The easy option in this case is to simply remove the ESP_INTR_FLAG_IRAM, at least for now. Or, if there aren't too many additional functions which would need to be marked with IRAM_ATTR, those could be so marked. |
I was thinking about linker magic because some of these functions are part of IDF's gpio driver. Guess we can't modify them and would need to re-implement them in an IRAMified copy. |
Ah, let's go with the easy option and not use the ESP_INTR_FLAG_IRAM then. |
Ok, done that. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Rationale:
I've got a first-cut of the GPIO module done, which should be functional, but it's not complete. It's currently lacking in documentation. API differences so far:
gpio.config()
, which takes one or more tables each describing one or more GPIOs to set up a particular way. More on this below.gpio.serin()/gpio.serout()
are not currently supported. I suspect they might be possible to implement much more efficiently using the I2S or RMT peripheral.gpio,level
way around seemed the cleaner.gpio.wakeup()
for configuring wake-from-sleep-on-GPIO-level functionality.The GPIO configuration approach got an overhaul because I liked the way the IDF API does it, which essentially is bulk configuration of pins. It removes the tedium of setting up GPIOs, and I extended their model further in the Lua API to support multiple bulks. At this point we have:
So, someone wanting two outputs and one input might run the single command:
Things to do:
The GPIO ISR needs to be moved to the platform layer, so that other modules/drivers can use GPIOs for interrupts.The module is now using the IDF per-pin ISR hook.gpio_xyz()
should be wrapped in the platform layer, but I suspect that might just be unnecessary pessimisation. We're not sharing a platform layer with any other chips here, so I'd be inclined to keep it mean and lean.gpio.serin()/gpio.serout()
functionality.Priority: Medium
Dependencies:
The text was updated successfully, but these errors were encountered: