HeartRateAlgorithm.h
Arduino/HeartRateAlgorithm.h
#ifndef HEARTRATE_ALGORITHM_H
#define HEARTRATE_ALGORITHM_H
#include <stdint.h>
#define HR_ALGORITHM_BUFFER_SIZE 100
#define HR_ALGORITHM_MIN_PEAK_DISTANCE 30 // Minimum samples between peaks
class HeartRateAlgorithm {
public:
HeartRateAlgorithm();
void addSample(uint32_t irValue);
uint8_t getHeartRate();
bool isDataReady();
void reset();
private:
uint32_t _buffer[HR_ALGORITHM_BUFFER_SIZE];
uint8_t _bufferIndex;
bool _dataReady;
uint32_t _lastPeakTime;
uint8_t _peakCount;
uint32_t _peakIntervals[10];
uint8_t _intervalIndex;
bool detectPeak(uint32_t value, uint32_t prevValue, uint32_t nextValue);
uint32_t calculateAverage();
};
#endif
Related articles
lv_conf.h
lv_conf.h — c source code from the Arduino learning materials (Arduino/CCIT4080_CL05_PKPD_Group2/lv_conf.h).
Read article →2.4_max30102.cpp
2.4_max30102.cpp — cpp source code from the Arduino learning materials (Arduino/CCIT4080_CL05_PKPD_Group2/src/Combination/2.4_and_max30102_test/2.4_max30102.cpp).
Read article →bluetooth.cpp
bluetooth.cpp — cpp source code from the Arduino learning materials (Arduino/CCIT4080_CL05_PKPD_Group2/src/Test_components/bluetooth_test/bluetooth.cpp).
Read article →ec11.cpp
ec11.cpp — cpp source code from the Arduino learning materials (Arduino/CCIT4080_CL05_PKPD_Group2/src/Test_components/button_test/ec11.cpp).
Read article →1.69_inch_display.cpp
1.69_inch_display.cpp — cpp source code from the Arduino learning materials (Arduino/CCIT4080_CL05_PKPD_Group2/src/Test_components/display_test/1.69_inch_display/1.69_inch_display.cpp).
Read article →2.4_inch_display.cpp
2.4_inch_display.cpp — cpp source code from the Arduino learning materials (Arduino/CCIT4080_CL05_PKPD_Group2/src/Test_components/display_test/2.4_inch_display/2.4_inch_display.cpp).
Read article →