-
Notifications
You must be signed in to change notification settings - Fork 1
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
Feature/highpass #206
Open
rubennoro
wants to merge
11
commits into
main
Choose a base branch
from
feature/highpass
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.
+55
−1
Open
Feature/highpass #206
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
4e9db2f
changes finalized
e5441af
finalized 2
824f3ef
struct fix
dbf5358
final final
c526b7c
removing the i2c_handler, preping for cerb changes
bab8efe
high pass filter implementation
25814f7
new additions
389d3d1
added doxygen comments, added proper syntax
d86aea2
removed pca commits from this branch
a21e9db
added doxygen comments
ba74657
Merge branch 'main' of https://github.com/Northeastern-Electric-Racin…
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
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,33 @@ | ||
#ifndef HIGH_PASS_H | ||
#define HIGH_PASS_H | ||
|
||
#include <stdio.h> | ||
|
||
typedef struct { | ||
//Function Parameters | ||
float alpha; | ||
float scale; | ||
|
||
float prev_output; | ||
|
||
} high_pass_t; | ||
|
||
/** | ||
* @brief | ||
* | ||
* @param alpha | ||
* @param scale | ||
* @param filter | ||
*/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to fill in doc comments |
||
void high_pass_init(float alpha, float scale, high_pass_t *filter); | ||
|
||
/** | ||
* @brief | ||
* | ||
* @param filter | ||
* @param input | ||
* @return float | ||
*/ | ||
float high_pass(high_pass_t *filter, float input); | ||
|
||
#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,21 @@ | ||
#include "high_pass.h" | ||
|
||
void high_pass_init(float alpha, float scale, high_pass_t *filter) | ||
{ | ||
filter->alpha = alpha; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is incorrect syntax and will not compile |
||
filter->scale = scale; | ||
|
||
filter->prev_output = 0.0; | ||
} | ||
|
||
float high_pass(high_pass_t *filter, float input) | ||
{ | ||
float output = | ||
filter->scale(input - (filter->alpha * input + | ||
(1 - filter->alpha) * prev_output)); | ||
|
||
filter->prev_output = | ||
filter->alpha * input + (1 - filter->alpha) * prev_output; | ||
|
||
return output; | ||
} |
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.
Doxygen comments go above the function, and explain the parameters and what the function returns (if it returns anything)