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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers pixart_heart_rate_demo.h Source File

pixart_heart_rate_demo.h

00001 #ifndef __pixart_heart_rate_demo_h__
00002 #define __pixart_heart_rate_demo_h__
00003 
00004 
00005 #include <mbed.h>
00006 #include <stdbool.h>
00007 #include <stdint.h>
00008 
00009 
00010 namespace pixart {
00011     
00012 
00013     class heart_rate_demo {
00014     public:
00015         heart_rate_demo(I2C &i2c, InterruptIn &interrupt, Serial &serial);
00016     
00017         void run();
00018     
00019     private:
00020         static void error_handler();
00021         static void debug_print(const char *fmt, ...);
00022         static uint64_t time_to_millisec(uint64_t time);
00023         
00024     private:
00025         void pah8011_interrupt_handle(void);
00026     
00027         I2C                 &m_i2c;
00028         InterruptIn         &m_interrupt;
00029         
00030         volatile bool       m_has_pah8011_interrupt;
00031         volatile uint64_t   m_pah8011_interrupt_timestamp;
00032     
00033     };
00034     
00035 
00036 }
00037 
00038 
00039 #endif // header guard