-
Notifications
You must be signed in to change notification settings - Fork 2k
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
periph/dac: support for DAC extension API #10512
base: master
Are you sure you want to change the base?
Conversation
38cba7f
to
c74c795
Compare
c74c795
to
34009cb
Compare
Adds low level function prototypes and redirection functions to the API. Furthermore, a new API function dac_channels was added to make it possible to iterate over all channels of a certain device.
Renames all low level function for peripheral DAC drivers of MCUs
Adds the DAC extension driver including redirection and not supported functions
34009cb
to
de3d2b3
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.
#ifndef DAC_EXT_LINE | ||
#define DAC_EXT_LINE(x, y) \ | ||
(dac_t)(~DAC_EXT_THRESH | (x << DAC_EXT_DEV_LOC) | DAC_LINE(y)) | ||
#endif |
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.
May need to be changed, but required changes are to be determined. Discussion in #10504
* @param[in] line identifies the device | ||
* @retval the number of channels on success or 0 on error | ||
*/ | ||
static inline unsigned int dac_channels(dac_t line) |
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.
tests/extend_dac/Makefile
Outdated
include ./Makefile.include | ||
include $(RIOTBASE)/Makefile.include | ||
|
||
test: |
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.
Explicitly referencing the test is no longer necessary. If ./tests/01-run.py
exists, then it will be used.
@ZetaR60 Thank you for reviewing |
Clarification on waiting for PR: This is waiting on approval of the methods outlined in #9582 via the approval by a senior maintainer of this or any of the other extension API PRs: #9860 + #9958, or #10512, #10527, #10533. They are all identical in method, and have only minor differences in implementation. As a split PR #9860 and #9958 are intended to make this easier. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions. |
Is @ZetaR60 still active? Last activities according to their landing page was in Feb 2019. Should someone else take over the review? |
This PR was part of a bundle of PRs that extend the peripheral APIs for extender drivers (#9582). For that purpose, it uses the same redirection approach for DACs as PRs #9860 and #9958 did for GPIOs. Since the redirection approach for GPIOs in PR #9860 and #9958 was finally refused, a new approach for GPIO extension API was developed and discussed in PR #12877. Once the GPIO extension API is finished and accepted, I will rework the other extension APIs. Another approach that could also be suitable for DACs is the ADC-NG API in PR #13248. So at the moment I see this PR more as a reminder than a PR that should be merged. |
Contribution description
This is an implementation of the extension API as proposed in #9582 for DAC extensions. It corresponds to the implementation of the GPIO extension API in #9860 and #9958. The PR contains the following contributions:
dac_*_ll
indrivers/include/periph.h
.dac_*
functions to redirect a function call either to the low level functionsdac_*_ll
or to thedac_ext_*
function provided by an DAC extension device driver.dac_channels
which returns the number of channels, in case of low level drivers simply theDAC_NUMOF
. This new function makes it possible to get the information from a certain device how many channels it has and allows to iterate over the all channels of all devices.dac_*_ll
for all CPUs that support DAC channels.The DAC extension API does not require feature
periph_dac
which makes it possible to extend boards that do not provide DAC capabilities by the MCU by external DAC modules.Testing procedure
A test case is provided that implements a soft-driver for the DAC extension interface. The test case uses this driver to confirm that interception and redirection of the API call are working properly. This has been tested and is working properly on esp8266-esp-12x, esp32-wroom-32 and arduino-mega2560.
To test only the DAC extension API use
To test the DAC extension API together with internal DAC channels use
In that case feature
periph_dac
is required of course.Issues/PRs references
Implements #9582
Corresponds to #9860 and #9958
The changes in the
makefiles/pseudomodules.mk
and indrivers/Makefile.include
made to get it working are the same as in #9958. These changes might be removed once #9958 is merged.PR #10518 provides a working DAC extension driver that use the DAC extension API and serves as a proof of concept.