Demo Heart Rate with PAH8011
Dependencies: pixart_heart_rate pixart_pah8011
Dependents: PAH8011_nRF52_Program PixArt_PAH8011_HeartRate_NUCLEO-L476RG PixArt_PAH8011_HR_NUCLEO-L476RG
Diff: pixart_heart_rate_demo.h
- Revision:
- 0:45616b53ea33
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pixart_heart_rate_demo.h Mon Oct 30 06:05:00 2017 +0000
@@ -0,0 +1,39 @@
+#ifndef __pixart_heart_rate_demo_h__
+#define __pixart_heart_rate_demo_h__
+
+
+#include <mbed.h>
+#include <stdbool.h>
+#include <stdint.h>
+
+
+namespace pixart {
+
+
+ class heart_rate_demo {
+ public:
+ heart_rate_demo(I2C &i2c, InterruptIn &interrupt, Serial &serial);
+
+ void run();
+
+ private:
+ static void error_handler();
+ static void debug_print(const char *fmt, ...);
+ static uint64_t time_to_millisec(uint64_t time);
+
+ private:
+ void pah8011_interrupt_handle(void);
+
+ I2C &m_i2c;
+ InterruptIn &m_interrupt;
+
+ volatile bool m_has_pah8011_interrupt;
+ volatile uint64_t m_pah8011_interrupt_timestamp;
+
+ };
+
+
+}
+
+
+#endif // header guard