-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Multithreading support with xTaskCreate #228
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
Comments
Check this out: https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFi/examples/WiFiClientEvents/WiFiClientEvents.ino You can manage your wifi connection without block the main Sketch see the functions: |
what do you mean by "listen on another thread"? |
I want to have a different thread where a little rest api is running and responds to get requests. This intirely separated from the main loop. |
You might be better served using the RTOS port for the ESP32 which has a clear concept of threads, rather than abstracted like Arduino. https://github.com/espressif/ESP31_RTOS_SDK |
@whatnick what makes you think that this Arduino core is bare metal? It runs on top of FreeRTOS. |
I meant as threads explicitly exposed, rather than abstracted away in Arduino land. |
What would be the concrete answer to the above ? A threaded webserver sample ? |
@whatnick so you want an example? I'm not quite sure what the issue is here? |
An example would be great or specific API docs for accessing the
threading.h related functions.
Otherwise I will read the samples above and adapt.
On 18 Mar 2017 09:35, "Me No Dev" <[email protected]> wrote:
@whatnick <https://github.com/whatnick> so you want an example? I'm not
quite sure what the issue is here?
Again, Arduino runs on top of RTOS and the specific RTOS is:
https://github.com/espressif/esp-idf
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#228 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAd_hET0uOzps78U4Ov8moy43m01R8rOks5rmxHUgaJpZM4MKFVw>
.
|
Not sure about threading.h but freertos has tasks which probably satisfy what you want to do. I'm on freertos.org all day, here is the task API call that esp-idf uses: http://www.freertos.org/a00125.html A task has to be of the form
Then you start it with
|
This is a really interesting topic. To clarify my doubts I would like to ask by showing example. Since arduino-esp32 is built on top of FreeRTOS, does it mean it is possible to call It would look somehow like this example then: Is it possible with arduino-esp32 ? |
Check out this example by @copercini |
You can use FreeRTOS APIs without include anything in the arduino sketch, but run directly in IDF is really more optimized |
As this is a thread "for reference" I wanted to ask a few questions, and add the answers to this thread for later documentation.
|
you can read more here: http://esp-idf.readthedocs.io/en/latest/api-guides/freertos-smp.html |
Hello, Thank you VERY much for this reference ... great information! Per what I have read, it appears that the following are the answers to my questions:
Thanks again! |
I have found it fairly straightforward to use task control tools as you mentioned to manage the tasks as opposed to playing with scheduling at run time. As for gathering task information, only some are available based on the FreeRTOS configuration file in IDF so be prepared for the usage pf some to result in errors. I use those for checking the task heap and whether tasks are blocked primarily. |
@PilnyTomas I think this issue can be closed as it was mainly covered by your PR above. |
I agree :) |
This Pull Request updates the Arduino TinyUSB component to support the latest upstream code. Additionally adds support for NCM and ESP32-P4
I want my wifi connection to listen in a separate thread? How can i do this?
The text was updated successfully, but these errors were encountered: