Add support for external clocks on gpin GPIO pins #884
+155
−21
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #879 by adding a
GpIn0
andGpIn1
struct, which implementClockSource
, such that a user can callconfigure_clocks
for these clock inputs and use the safe clock switching logic already built in.I tried keeping the gpin.rs style kind of similar to other pin related interfaces (e.g. I2C), let me know if this aligns to your code style :)
I've renamed the type from
GPin
toGpIn
, I believe it's a "General Purpose (clock) INput", hence thegpin
name in the datasheet (similarly, there's also agpout
).I've also provided an example which I ran on an RPi Pico, on an oscilloscope I could see that the pulses the example code drives are in sync with the provided clock 🎉