aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/heartrate/Ppg.h
diff options
context:
space:
mode:
authorJF002 <JF002@users.noreply.github.com>2021-01-20 20:11:56 +0000
committerGitHub <noreply@github.com>2021-01-20 20:11:56 +0000
commita0f2fa8469f3a2c0f5f2f914ad174029da321cc0 (patch)
tree4ac5f59cd088aea9af51d2d183376de279808e63 /src/components/heartrate/Ppg.h
parent35d4f6d4875b68ff8fdecb436e3bc0a6f91099f3 (diff)
parent68674cec53e2e2add1c0a0b109e5a0e7d9ed5479 (diff)
Merge pull request #169 from JF002/heartRateSensor
Heart rate sensor
Diffstat (limited to 'src/components/heartrate/Ppg.h')
-rw-r--r--src/components/heartrate/Ppg.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/components/heartrate/Ppg.h b/src/components/heartrate/Ppg.h
new file mode 100644
index 00000000..747ae019
--- /dev/null
+++ b/src/components/heartrate/Ppg.h
@@ -0,0 +1,31 @@
+#pragma once
+
+#include <array>
+#include "Biquad.h"
+#include "Ptagc.h"
+
+namespace Pinetime {
+ namespace Controllers {
+ class Ppg {
+ public:
+ explicit Ppg(float spl);
+
+ int Preprocess(float spl);
+ float HeartRate();
+
+ void SetOffset(uint16_t i);
+ void Reset();
+
+ private:
+ std::array<int, 200> data;
+ size_t dataIndex = 0;
+ float offset;
+ Biquad hpf;
+ Ptagc agc;
+ Biquad lpf;
+
+
+ float ProcessHeartRate();
+ };
+ }
+} \ No newline at end of file