Skip to content
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

Closed
wants to merge 84 commits into from
Closed

Shivam: Timers Wrapper Code Review #49

wants to merge 84 commits into from

Conversation

cjchanx
Copy link
Member

@cjchanx cjchanx commented Oct 14, 2022

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 😄)

cjchanx and others added 30 commits July 30, 2022 13:49
- Updated Project  Linker Settings to enable newlib support for proper compilation of new and delete operators.
- Various updates and test changes
- 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.
- 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/Timer.cpp Outdated Show resolved Hide resolved
Components/Core/Timer.cpp Outdated Show resolved Hide resolved
Components/Core/Timer.cpp Outdated Show resolved Hide resolved
Components/Core/Timer.cpp Show resolved Hide resolved
Components/Core/Inc/Timer.hpp Outdated Show resolved Hide resolved
Components/Core/Inc/Timer.hpp Outdated Show resolved Hide resolved
bool ChangePeriod(const uint32_t period);

bool ChangePeriod(const uint32_t period_ms);
bool StartTimer();
Copy link
Member Author

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()

Copy link
Member Author

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

bool Timer::ChangePeriod(const uint32_t period_ms)
{
if (xTimerChangePeriod(rtTimerHandle, MS_TO_TICKS(period_ms), DEFAULT_TIMER_COMMAND_WAIT_PERIOD) == pdTRUE) {
StopTimer();
Copy link
Member Author

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

Components/Core/Timer.cpp Outdated Show resolved Hide resolved
if (xTimerStop(rtTimerHandle, DEFAULT_TIMER_COMMAND_WAIT_PERIOD) == pdPASS) {
timerState = PAUSED;
return true;
}
Copy link
Member Author

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)

@shivamdesai04 shivamdesai04 changed the base branch from Chris/OuroborosC++ to master January 7, 2023 19:40
@cjchanx
Copy link
Member Author

cjchanx commented Jan 15, 2023

New Pull Request:
#58

@cjchanx cjchanx closed this Jan 15, 2023
@cjchanx cjchanx linked an issue Jan 15, 2023 that may be closed by this pull request
@cjchanx cjchanx deleted the Shivam/Timers branch January 15, 2023 01:32
@cjchanx cjchanx restored the Shivam/Timers branch January 15, 2023 01:32
@cjchanx cjchanx deleted the Shivam/Timers branch January 15, 2023 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DMB] Implement RTOS Wrapper for Timer
2 participants