add examples

This commit is contained in:
pvvx 2016-12-14 04:21:37 +03:00
parent 265d41b6a3
commit 4128624f93
112 changed files with 158017 additions and 0 deletions

View file

@ -0,0 +1,77 @@
/*******************************************************************************
HRM.h - Definition header
*******************************************************************************/
#ifndef HRM_H
#define HRM_H
#include <stdint.h>
//------------------------------------------------------
#define HR_SAMPLE_RATE 25// Hz
#define HR_INTEG_MIN HR_INTEG_40
#define HR_INTEG_BASE HR_INTEG_250
#define HR_INTEG_MAX HR_INTEG_250
#define HR_TH_HIGH 63000
#define HR_TH_LOW 30000
//------------------------------------------------------
// HRM I2C address & register sub-addresses
#define HR_SLAVE_ADDRESS 0x82
#define HR_FILTER_1 0<<5
#define HR_FILTER_2 1<<5
#define HR_FILTER_4 2<<5
#define HR_FILTER_8 3<<5
#define HR_FILTER_16 4<<5
#define HR_FILTER_32 5<<5
#define HR_FILTER_64 6<<5
#define HR_FILTER_128 7<<5
#define HR_MODE_HR 1<<4
#define HR_MODE_HRS 9<<4
#define HR_GAIN_MID 1
#define HR_GAIN_LOW 3
#define HR_INTEG_20 5
#define HR_INTEG_25 6
#define HR_INTEG_30 7
#define HR_INTEG_40 8
#define HR_INTEG_55 9
#define HR_INTEG_70 10
#define HR_INTEG_90 11
#define HR_INTEG_110 12
#define HR_INTEG_150 13
#define HR_INTEG_200 14
#define HR_INTEG_250 15
#define HR_INTEG_350 16
#define HR_INTEG_450 17
#define HR_INTEG_550 18
#define HR_OSR_64 0<<2
#define HR_OSR_256 1<<2
#define HR_OSR_1024 2<<2
#define HR_OSR_2048 3<<2
#define HR_RESETN_RESET 0<<2
#define HR_RESETN_RUN 1<<2
#define HR_PDRIVE_70MA 0<<4
#define HR_PDRIVE_35MA 1<<4
#define HR_PDRIVE_200MA 2<<4
#define HR_PDRIVE_100MA 3<<4
#define HR_INT_FRAME 1<<2
#define HR_INT_DISABLED 2<<2
#define HR_IR_DISABLE 0<<7
#define HR_IR_ENABLE 1<<7
//------------------------------------------------------
// Declarations
void init_hrm(void);
uint16_t read_hrm(void);
#endif /* HRM_H */

View file

@ -0,0 +1,39 @@
/*
* heart_interface.h
*
* Created on: 2014/4/29
* Author: 01004
*/
#ifndef HEART_INTERFACE_H_
#define HEART_INTERFACE_H_
#define MIN_HEART_RATE 48
#define MAX_HEART_RATE 180
extern int g_heartrate;
typedef void (*hr_callback)(int);
/*
* If there is no g-sensor, fill x, y, z in 0.
*/
void add_PPG_XYZ(int ppg, short xx, short yy, short zz);
/*
* A callback to handle heartrate events.
*/
void register_callback(hr_callback callback);
/*
* Ex: report_period = 25.
* it means report a heart rate every 25 samples.
*/
void start(int report_period);
void reset(void);
void stop(void);
#endif /* HEART_INTERFACE_H_ */