hal: Update functs and threads to use getter/setter - #4307
Merged
Conversation
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.
This fixes the HAL library internals to use getter/setter. Specifically threads and functions running in threads are setting some pins/params (.time, .tmax, etc).
Note that the update to (non-functional) halrmt is purely circumstantial to keep the compiler happy because it has not yet been updated to the query API. It will be changed soon enough.
This PR also adds a
<threadname>.threadbeatpin that monotonically increases whenever the thread is running and executing functions in its cycle. It is in essence a cycle counter.The threadbeat cycle counter can be used to prevent races between non-RT and RT (instead of unreliable sleep constructs). You can simply read the pin and see it change. You know that the number of thread cycles executed is equal to the numerical change. You can simply wait for the threadbeat to have advanced by N when non-RT knows that at least N cycles are required to perform the operation being waited for. You should still wait in a non-busy-loop way. Especially test-scenarios should use it, where appropriate, instead of sleep because test/CI machines may be very busy and unreliable when using calls to sleep() and you expect something to have happened after that period of time.