summaryrefslogtreecommitdiff
path: root/src/components/heartrate/Ppg.h
diff options
context:
space:
mode:
authorJean-François Milants <jf@codingfield.com>2021-01-10 16:57:26 (GMT)
committerJean-François Milants <jf@codingfield.com>2021-01-10 16:57:26 (GMT)
commit1a582815ba218d2a9047abae92b9f33a3301ffd5 (patch)
tree18aa0aeba146d990a0302f4840e870cad1c4ad6f /src/components/heartrate/Ppg.h
parent50ae0ae5e073ac48652e6c26549f9b19655e8da3 (diff)
First implementation of the HR sensor using 100% foss code (ported from waspos)
Diffstat (limited to 'src/components/heartrate/Ppg.h')
-rw-r--r--src/components/heartrate/Ppg.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/components/heartrate/Ppg.h b/src/components/heartrate/Ppg.h
new file mode 100644
index 0000000..846ade0
--- /dev/null
+++ b/src/components/heartrate/Ppg.h
@@ -0,0 +1,30 @@
+#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);
+
+ 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