-
Notifications
You must be signed in to change notification settings - Fork 4
Allow setting list of pins to sample after construction #38
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
Allow setting list of pins to sample after construction #38
Conversation
Arguably, in user code, the list of pins to sample will typically be known and fixed at compile-time. However, when wrapping this into a library (Mozzi; for the purpose of providing a cross-platform analog read mechanism), it will be very helpful to have a way to adjust the pins to sample after construction.
Memory usage change @ 04f1275
Click for full report table
Click for full report CSV
|
I shall test my PR before submitting...
Memory usage change @ 82ae24a
Click for full report table
Click for full report CSV
|
Hi @tfry-git ☕ 👋 Can you please provide an example show-casing how you'd use this feature? |
For clarification: Do you want an example of how I would actually use this (in order to judge, whether the proposed change makes sense), or do you want me to provide a user visible example for inclusion in examples-dir? I'll happily provide the second, if that's what you mean. As for the first: My actual use-case is a library for audio synthesis (Mozzi). Note that Mozzi is cross platform, and the user-facing API already exists, so from the Mozzi point of view this PR is about enabling an implementation on the Giga. More specifically, we have a function Regarding the API, none of the other existing platform ports require prior specification of the pins that will be used in mozziAnalogRead() -> update list of pins to sample -> trigger hardware-specific non-blocking readings of these pins -> cache the resulting values -> to be returned in a subsequent call of mozziAnalogRead() Regarding possible way to accomplish this, I see the following options:
|
Hi @tfry-git ☕ 👋 Judging by the current state of your PR I consider it non-invasive, hence would be happy to merge.
Yes, this would be about the second option. If you could add such an example to this PR I'll be happy to merge 🙇 . |
Example added. |
Memory usage change @ 4c36569
Click for full report table
Click for full report CSV
|
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 👍 Thank you @tfry-git 🚀
Arguably, in user code, the list of pins to sample will typically be known and fixed at compile-time.
However, when wrapping this into a library (Mozzi; for the purpose of providing a cross-platform analog read mechanism), it will be very helpful to have a way to adjust the pins to sample after construction.