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

Feature/lowpass filter #210

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
repos:
- repo: local
hooks:
- id: clang_restage
name: Restage formatted files
entry: clang_restage
language: system
pass_filenames: false
always_run: true
repos:
- repo: local
hooks:
- id: clang_restage
name: Restage formatted files
entry: clang_restage
language: system
pass_filenames: false
always_run: true
stages: [pre-commit]
8 changes: 8 additions & 0 deletions middleware/simple_ema.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <stdio.h>
#include "simple_ema.h"

void ema_filter(float current_value, float *previous_ema, float alpha)
{
*previous_ema =
(alpha * current_value) + ((1 - alpha) * (*previous_ema));
}
7 changes: 7 additions & 0 deletions middleware/simple_ema.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef SIMPLE_EMA
#define SIMPLE_EMA

// Exponential Moving Average Lowpass Filter
ema_filter(float current_value, float *previous_ema, float alpha);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs void no?

A good way to ensure your code builds is to run it in Cerberus.
Steps to do so:

  1. Commit to ur branch in embedded base
  2. Clone Cerberus
  3. Enter the ./Drivers/Embedded-Base directory in Cerberus and run git fetch and git checkout <your-branch-name>
  4. Now update cerberus Makefile with the relevant .c file you want to test
  5. run ner build and observe any errors/warnings

Lmk if you have questions about these steps, if you need instructions to setup ner build check here


#endif /* SIMPLE_EMA */