-
Notifications
You must be signed in to change notification settings - Fork 139
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
Make SYST::get_current take &self? #460
Comments
At least in my experience systick is mostly used as a debug tool to measure code execution performance and clock ticks. Hence, it is often used in random parts of the code and carrying I think best option would be to improve |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I'm just getting started with embedded rust, so apologies if this is a silly question!
While trying to get a tick counter, I realized
SYST::get_current()
would (almost) always return0
:I hadn't read the docs properly and was actually using the systick somewhere else:
Without reading the cortex docs and the cortex-m crate sources, I would never have figured the reason why
get_current
was almost always zero (reason as far as I understand: it will increment until the value passed toset_reload()
and then wrap).I was wondering, wouldn't it be safer to also have
get_current()
take a&SYST
? Then it would also be clearer thatget_current()
and other functions (set_reload
,enable_counter
, etc) are related.Again, apologies if this is silly! I'm just getting started with rust embedded.
The text was updated successfully, but these errors were encountered: