-
Notifications
You must be signed in to change notification settings - Fork 2
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
Shivam: Timers Wrapper Code Review #49
Conversation
- Updated Project Linker Settings to enable newlib support for proper compilation of new and delete operators. - Various updates and test changes
…C++' into Chris/OuroborosC++
…icsSoftware into Chris/OuroborosC++
- Confirmed working on flightboard, LED blinks correctly. - Note about code auto-gen: you MUST change the main.cpp to main.c, then change the .ioc file and save, then change this back. This should be automated in the makefile or in a script later.
…icsSoftware into Chris/OuroborosC++
- Tasks should now follow design similar to UARTTask (call into a Run() function from a RunTask() static so the task counts as part of the instance) - Various fixes to the code, like initializing static variables
Components/Core/Inc/Timer.hpp
Outdated
bool ChangePeriod(const uint32_t period); | ||
|
||
bool ChangePeriod(const uint32_t period_ms); | ||
bool StartTimer(); |
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.
Rename these to Start() and Stop()
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.
It's implied that it's a timer operation
Components/Core/Timer.cpp
Outdated
bool Timer::ChangePeriod(const uint32_t period_ms) | ||
{ | ||
if (xTimerChangePeriod(rtTimerHandle, MS_TO_TICKS(period_ms), DEFAULT_TIMER_COMMAND_WAIT_PERIOD) == pdTRUE) { | ||
StopTimer(); |
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.
Recommend making this directly call xTimerStop, and also check if that returns pdTRUE
if (xTimerStop(rtTimerHandle, DEFAULT_TIMER_COMMAND_WAIT_PERIOD) == pdPASS) { | ||
timerState = PAUSED; | ||
return true; | ||
} |
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.
add an else here to account for if we failed xTimerStop (for whatever reason)
New Pull Request: |
Leave as draft pull request please, in the future open a pull request to request for review (but we haven't gone through this yet so I've done it this way for now 😄)