Measuring plethysmogram with BH1792GLC (Rohm Semiconductor) and calculating pulse rate

Dependencies:   USBDevice mbed

Committer:
t_tatsuoka
Date:
Mon Feb 05 21:28:19 2018 +0000
Revision:
1:90f70c146a26
Parent:
0:18d735a66926
Ver. 1.0.1 ???beep?????????????????????????

Who changed what in which revision?

UserRevisionLine numberNew contents of line
t_tatsuoka 0:18d735a66926 1 /**
t_tatsuoka 0:18d735a66926 2 * @file Bh1792glcCtrl.h
t_tatsuoka 0:18d735a66926 3 * @brief Header file for Bh1792glcCtrl.cpp
t_tatsuoka 1:90f70c146a26 4 * @date 2018.02.06
t_tatsuoka 1:90f70c146a26 5 * @version 1.0.1
t_tatsuoka 0:18d735a66926 6 */
t_tatsuoka 0:18d735a66926 7 #ifndef _INC_Bh1792glcCtrl
t_tatsuoka 0:18d735a66926 8 #define _INC_Bh1792glcCtrl
t_tatsuoka 0:18d735a66926 9
t_tatsuoka 0:18d735a66926 10 #include "mbed.h"
t_tatsuoka 0:18d735a66926 11 #include "Bh1792glcReg.h"
t_tatsuoka 0:18d735a66926 12
t_tatsuoka 0:18d735a66926 13 /** Constants
t_tatsuoka 0:18d735a66926 14 */
t_tatsuoka 0:18d735a66926 15 #define I2C_FREQENCY (400000) /* I2C SCL freqency */
t_tatsuoka 0:18d735a66926 16
t_tatsuoka 0:18d735a66926 17 #define DEFAULT_PARAM_SIZE (6) /* Bytes through MEAS_CONTROL 1 - 5 */
t_tatsuoka 0:18d735a66926 18 #define DEFAULT_LED_CURRENT1 (1) /* LED 1 current intensity */
t_tatsuoka 0:18d735a66926 19 #define DEFAULT_LED_CURRENT2 (0) /* LED 2 current intensity */
t_tatsuoka 0:18d735a66926 20 #define DEFAULT_MEAS_CTRL4_LSB (0xFC) /* Threshold IR interrupt (LSB) */
t_tatsuoka 0:18d735a66926 21 #define DEFAULT_MEAS_CTRL4_MSB (0xFF) /* Threshold IR interrupt (MSB) */
t_tatsuoka 0:18d735a66926 22
t_tatsuoka 0:18d735a66926 23 #define INT_CHECK_INTERVAL_US (10) /* Int terminal check interval [us] */
t_tatsuoka 0:18d735a66926 24 #define INT_CHECK_COUNT_LIMIT (100) /* Int terminal check count limit */
t_tatsuoka 0:18d735a66926 25
t_tatsuoka 0:18d735a66926 26 /** Calculate pulse waveform and pulse rate
t_tatsuoka 0:18d735a66926 27 */
t_tatsuoka 0:18d735a66926 28 class Bh1792glcCtrl
t_tatsuoka 0:18d735a66926 29 {
t_tatsuoka 0:18d735a66926 30
t_tatsuoka 0:18d735a66926 31 public:
t_tatsuoka 0:18d735a66926 32 Bh1792glcCtrl(PinName bh_sda, PinName bh_scl, PinName bh_int);
t_tatsuoka 0:18d735a66926 33 int get_val(int32_t &val);
t_tatsuoka 0:18d735a66926 34
t_tatsuoka 0:18d735a66926 35 private:
t_tatsuoka 0:18d735a66926 36 I2C _i2c;
t_tatsuoka 0:18d735a66926 37 DigitalIn _bh_int; /* Interrupt from BH1792GLC */
t_tatsuoka 0:18d735a66926 38
t_tatsuoka 0:18d735a66926 39 int _sad;
t_tatsuoka 0:18d735a66926 40
t_tatsuoka 0:18d735a66926 41 int init();
t_tatsuoka 0:18d735a66926 42 int send_default_params();
t_tatsuoka 0:18d735a66926 43 int start_measure();
t_tatsuoka 0:18d735a66926 44
t_tatsuoka 0:18d735a66926 45 };
t_tatsuoka 0:18d735a66926 46 #endif /* INC_Bh1792glcCtrl */