-
Notifications
You must be signed in to change notification settings - Fork 9
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
Features/driver/iwdg #21
Open
PratyushMakkar
wants to merge
11
commits into
UWARG:main
Choose a base branch
from
PratyushMakkar:features/driver/iwdg
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
6cbb940
Added independent watchdog driver
PratyushMakkar c97c7d4
Finished testing IWDG
PratyushMakkar 0ffcc15
Small chnage to uint16_t
PratyushMakkar d034ba7
Addressed comments
PratyushMakkar 3ac89d4
Addressed comments
PratyushMakkar 1ecbb49
Removed prescaler values from constructor
PratyushMakkar ccfa777
Added files to cmake
PratyushMakkar 5fd3e30
Revert "Added files to cmake"
PratyushMakkar a1e51bd
Modified CMAKE to add IWDG driver
PratyushMakkar c305c2c
Configured IOC
PratyushMakkar d95fb73
Added base class header-file
PratyushMakkar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
#ifndef INDEPENDENT_WATCHDOG_H | ||
#define INDEPENDENT_WATCHDOG_H | ||
|
||
#include <stdint.h> | ||
#include "main.h" | ||
|
||
class IndependentWatchdog : public Watchdog { | ||
private: | ||
IWDG_HandleTypeDef* watchdog; | ||
|
||
public: | ||
IndependentWatchdog(IWDG_HandleTypeDef* watchdog); | ||
bool refreshWatchdog() override ; | ||
}; | ||
|
||
|
||
#endif /* SRC_DRIVERS_INDEPENDENTWATCHDOG_H_ */ | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#ifndef WATCHDOG_H_ | ||
#define WATCHDOG_H_ | ||
|
||
class Watchdog { | ||
public: | ||
virtual bool refreshWatchdog() = 0; | ||
}; | ||
|
||
#endif | ||
|
||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include "independent_watchdog.h" | ||
#include "main.h" | ||
|
||
/** | ||
* @brief Borrow the configuration of an already existing watchdog and set it | ||
* to the prescaler and Reload values. | ||
* | ||
*/ | ||
IndependentWatchdog::IndependentWatchdog(IWDG_HandleTypeDef *watchdog) { | ||
this->watchdog = watchdog; | ||
IWDG_InitTypeDef initDef = watchdog->Init; | ||
this->iwdg_prescaler = initDef.Prescaler; | ||
this->iwdg_reload = initDef.Reload; | ||
} | ||
|
||
|
||
/** | ||
* @brief Refreshes the watchdog that is a member variable of the class | ||
* @returns true on success, false on failure | ||
*/ | ||
|
||
bool IndependentWatchdog::refreshWatchdog() { | ||
if (this->watchdog == nullptr) { | ||
return false; | ||
} | ||
return (HAL_IWDG_Refresh(watchdog) == HAL_OK); | ||
} |
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.
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.
iwdg_prescaler and iwdf_reload dont exist anymore (and arent used) so probably remove lines 11,12 and 13 I think