Skip to content
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 enable/disable EOC interrupt functions for ADCs #526

Merged
merged 3 commits into from
Jan 21, 2025

Conversation

Tnze
Copy link
Contributor

@Tnze Tnze commented Jan 21, 2025

This patch allow user enable End of Convert interrupt for ADCs by calling adc1.enable_eoc_interrupt().

Tested on STM32F103CBT6, after enabling the eocie register. The interrupt ADC1_2 is triggered every time ADC convert is finished. This allows more efficient waiting for ADC result.

@Tnze Tnze changed the title Add enable/disable EOC interrupt functions for ADC Add enable/disable EOC interrupt functions for ADCs Jan 21, 2025
Add enable/disable EOC interrupt functions for ADC
@burrbull burrbull added this pull request to the merge queue Jan 21, 2025
Merged via the queue into stm32-rs:master with commit e90577f Jan 21, 2025
11 checks passed
@Tnze
Copy link
Contributor Author

Tnze commented Jan 21, 2025

@burrbull To make this useful. Addition changes are required.

We need a way taking apart convert() logic, and this is my temporary solution:
Tnze@6da9c4f

There is obvious problem of this and it will be good to have someone to design a better API.

@Tnze
Copy link
Contributor Author

Tnze commented Jan 21, 2025

I just realized that read() function returns nb::Result which is the API needed here. Make it returns WouldBlock when the ADC convert not finished. But it will changes the behavior and all previous users need to wrap read() calls with nb::block!() to match the previous behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants