-
Notifications
You must be signed in to change notification settings - Fork 226
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
Add ETM support for general purpose timers #1287
Conversation
I will explore using macros to generate code for each timer instead of introducing this |
Thanks for working on this! I'd say introducing the const generic is something we'd like to avoid. One solution might be to add a function like Not sure if that's expected (since it's a draft PR) but the example doesn't work for me, yet. |
I actually started with doing that and ditching it because I was aiming to introduce no extra runtime cost. But seems it’s fine so I’ll definitely give it a go. Thanks for the suggestion !
I will double check as I tested late last night on my dev board, might very well be that I missed to push something. |
I can confirm that the implementation is working on my esp32-c6 board with the example The output is as below : counter in interrupt: 10 # Alarm triggered the interrupt after 100ms and reset the counter (default behaviour)
counter in main: 10 # Counter got stopped by ETM (new feature)
counter in main: 10
counter in main: 10
counter in main: 10
counter in main: 10
counter in main: 10 I couldn't test on esp32-h2 as I don't own one. However looking at the technical reference document the ETM tasks and events IDs are the same so in theory it should work. Now 2 checks are failing apparently because of the use of I can successfully build all the examples locally and I'm using Thanks. |
I tested on ESP32-H2 and it works For the delay: there were some changes lately - probably easiest would be to use Otherwise looks good to me |
Thanks that fixed the issue. I moved the PR to ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution, this LGTM!
@bjoernQ is more familiar with this particular peripheral, so I will wait for him to give this his stamp of approval as well.
Thanks ! I had a blast making this contribution. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - Thanks for your contribution!
* Implement ETM for general purpose timers * Revert changes to timer_interrupt example * Add an example for ETM for general purpose timers * Add newly introduced generic const param for Timer0 * Use id function on TimerGroupInstance instead of const parameter * Revert const parameter on Timer1 * Specify supported chips * Update CHANGELOG.md * Update CHANGELOG.md * Fix example * Assign configured ETM channel to a variable to prevent drop * Fix comments * Move declaration of delay after critical section * Use delay_millis instead of delay_ms * Remove mut from delay * Add documentation
Implement Event Task Matrix functions for general purpose timers. ETM is only available for
esp32-c6
andesp32-h2
chips.Closes #1274
Must
errors
orwarnings
.cargo fmt
was run.CHANGELOG.md
in the proper section.Nice to have