Introduce more peripheral free methods for consistency#1000
Open
rnd-ash wants to merge 4 commits into
Open
Conversation
Contributor
|
Regarding Regarding swrst: I think the ideal approach would be to software reset both when taking ownership of the pac struct, and when releasing it (unless some peripherals would break somehow if reset?). That way the user isn't surprised by the behaviour. In any case it's important to document what the method is doing of course. Regarding disabling mclk: Wouldn't that be something explicitly handled by the user under clock v2? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR adds free methods for TC,TCC,NVM and TRNG peripherals. The DSU peripheral free implementation is covered in #998 , so I decided to not add it here as well.
I do have a couple observations @jbeaurivage before a potential merge regarding the other peripherals (Maybe worthy of a new issue created).
Essentially, looking at all the peripherals, there is inconsistency with how we handle free/new methods.
I noticed that some new/free methods are marked as
#[inline]and some are not, even when there are bigger constructors (Look at the ADC), we mark it with#[inline]whilst some small constructors are not marked as#[inline]Some free methods trigger a swrst on the peripheral being freed, and others do not. Which approach is better? - And, if swrst is the better option, why also not disable mclk on the chip too when the peripheral is freed?