-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
stm32 comparator #85022
base: main
Are you sure you want to change the base?
stm32 comparator #85022
Conversation
drivers/comparator/CMakeLists.txt
Outdated
@@ -9,5 +9,6 @@ zephyr_library_sources_ifdef(CONFIG_USERSPACE comparator_handlers.c) | |||
zephyr_library_sources_ifdef(CONFIG_COMPARATOR_FAKE_COMP comparator_fake_comp.c) | |||
zephyr_library_sources_ifdef(CONFIG_COMPARATOR_MCUX_ACMP comparator_mcux_acmp.c) | |||
zephyr_library_sources_ifdef(CONFIG_COMPARATOR_NRF_COMP comparator_nrf_comp.c) | |||
zephyr_library_sources_ifdef(CONFIG_COMPARATOR_STM32_COMP comparator_stm32_comp.c) |
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.
sort alphabetically
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.
done
drivers/comparator/Kconfig
Outdated
@@ -21,6 +21,7 @@ config COMPARATOR_INIT_PRIORITY | |||
rsource "Kconfig.fake_comp" | |||
rsource "Kconfig.mcux_acmp" | |||
rsource "Kconfig.nrf_comp" | |||
rsource "Kconfig.stm32_comp" |
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.
here as well
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.
done
7cc8784
to
455e0ec
Compare
Add comparator sample with simple triggering behaviour Signed-off-by: Alexander Kozhinov <[email protected]>
Add comparator driver for ST's stm32 series. Signed-off-by: Alexander Kozhinov <[email protected]>
455e0ec
to
8dd5b55
Compare
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.
The driver looks good :) The sample is not needed I believe. The test suite in tests/drivers/comparator/gpio_loopback
validates the API behavior with a GPIO connected to the comp input. The build all test suite allows you to build varoius dt configurations tests/drivers/build_all/comparator
, and lastly, given the nature of a comparator, just enabling the comparator shell in a blank application is sample enough :)
Please add the comp to the two test suites to validate and build the driver in CI
Add stm32 comparator driver and simple comparator sample.
I've used to test it on nucleo_h745zi_q (m7 core only).
Build command with newly added sample:
My build result output:
The resulting output in the console could look like:
NOTE: To see the output value changing and
comp_trigger_cb
called the pins PB0 and PB2 shall be connected physically on the nucleo_h745zi_q board. Please consider the overlay file in the sample to find more about pinouts used.I've not tested the driver with any other stm32, but I am planning to add support for stm32g4 soon.
Any testers with appropriate board (any stm32h7 would be fine as a good first choice) are very welcome.