I've got some basic filter code setup (but not yet tested).

Dependencies:   BLE_API Queue mbed nRF51822

Fork of BLE_HeartRate by Bluetooth Low Energy

Committer:
roysandberg
Date:
Sun Jun 28 03:06:00 2015 +0000
Revision:
62:8e2fbe131b53
Working Beat Detection and Analysis

Who changed what in which revision?

UserRevisionLine numberNew contents of line
roysandberg 62:8e2fbe131b53 1 /*****************************************************************************
roysandberg 62:8e2fbe131b53 2 FILE: qrsdet.h
roysandberg 62:8e2fbe131b53 3 AUTHOR: Patrick S. Hamilton
roysandberg 62:8e2fbe131b53 4 REVISED: 4/16/2002
roysandberg 62:8e2fbe131b53 5 ___________________________________________________________________________
roysandberg 62:8e2fbe131b53 6
roysandberg 62:8e2fbe131b53 7 qrsdet.h QRS detector parameter definitions
roysandberg 62:8e2fbe131b53 8 Copywrite (C) 2000 Patrick S. Hamilton
roysandberg 62:8e2fbe131b53 9
roysandberg 62:8e2fbe131b53 10 This file is free software; you can redistribute it and/or modify it under
roysandberg 62:8e2fbe131b53 11 the terms of the GNU Library General Public License as published by the Free
roysandberg 62:8e2fbe131b53 12 Software Foundation; either version 2 of the License, or (at your option) any
roysandberg 62:8e2fbe131b53 13 later version.
roysandberg 62:8e2fbe131b53 14
roysandberg 62:8e2fbe131b53 15 This software is distributed in the hope that it will be useful, but WITHOUT ANY
roysandberg 62:8e2fbe131b53 16 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
roysandberg 62:8e2fbe131b53 17 PARTICULAR PURPOSE. See the GNU Library General Public License for more
roysandberg 62:8e2fbe131b53 18 details.
roysandberg 62:8e2fbe131b53 19
roysandberg 62:8e2fbe131b53 20 You should have received a copy of the GNU Library General Public License along
roysandberg 62:8e2fbe131b53 21 with this library; if not, write to the Free Software Foundation, Inc., 59
roysandberg 62:8e2fbe131b53 22 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
roysandberg 62:8e2fbe131b53 23
roysandberg 62:8e2fbe131b53 24 You may contact the author by e-mail (pat@eplimited.com) or postal mail
roysandberg 62:8e2fbe131b53 25 (Patrick Hamilton, E.P. Limited, 35 Medford St., Suite 204 Somerville,
roysandberg 62:8e2fbe131b53 26 MA 02143 USA). For updates to this software, please visit our website
roysandberg 62:8e2fbe131b53 27 (http://www.eplimited.com).
roysandberg 62:8e2fbe131b53 28 __________________________________________________________________________
roysandberg 62:8e2fbe131b53 29 Revisions:
roysandberg 62:8e2fbe131b53 30 4/16: Modified to allow simplified modification of digital filters in
roysandberg 62:8e2fbe131b53 31 qrsfilt().
roysandberg 62:8e2fbe131b53 32 *****************************************************************************/
roysandberg 62:8e2fbe131b53 33
roysandberg 62:8e2fbe131b53 34
roysandberg 62:8e2fbe131b53 35 #define SAMPLE_RATE 500 /* Sample rate in Hz. - was 200 */
roysandberg 62:8e2fbe131b53 36 #define MS_PER_SAMPLE ( (double) 1000/ (double) SAMPLE_RATE)
roysandberg 62:8e2fbe131b53 37 #define MS10 ((int) (10/ MS_PER_SAMPLE + 0.5))
roysandberg 62:8e2fbe131b53 38 #define MS25 ((int) (25/MS_PER_SAMPLE + 0.5))
roysandberg 62:8e2fbe131b53 39 #define MS30 ((int) (30/MS_PER_SAMPLE + 0.5))
roysandberg 62:8e2fbe131b53 40 #define MS80 ((int) (80/MS_PER_SAMPLE + 0.5))
roysandberg 62:8e2fbe131b53 41 #define MS95 ((int) (95/MS_PER_SAMPLE + 0.5))
roysandberg 62:8e2fbe131b53 42 #define MS100 ((int) (100/MS_PER_SAMPLE + 0.5))
roysandberg 62:8e2fbe131b53 43 #define MS125 ((int) (125/MS_PER_SAMPLE + 0.5))
roysandberg 62:8e2fbe131b53 44 #define MS150 ((int) (150/MS_PER_SAMPLE + 0.5))
roysandberg 62:8e2fbe131b53 45 #define MS160 ((int) (160/MS_PER_SAMPLE + 0.5))
roysandberg 62:8e2fbe131b53 46 #define MS175 ((int) (175/MS_PER_SAMPLE + 0.5))
roysandberg 62:8e2fbe131b53 47 #define MS195 ((int) (195/MS_PER_SAMPLE + 0.5))
roysandberg 62:8e2fbe131b53 48 #define MS200 ((int) (200/MS_PER_SAMPLE + 0.5))
roysandberg 62:8e2fbe131b53 49 #define MS220 ((int) (220/MS_PER_SAMPLE + 0.5))
roysandberg 62:8e2fbe131b53 50 #define MS250 ((int) (250/MS_PER_SAMPLE + 0.5))
roysandberg 62:8e2fbe131b53 51 #define MS300 ((int) (300/MS_PER_SAMPLE + 0.5))
roysandberg 62:8e2fbe131b53 52 #define MS360 ((int) (360/MS_PER_SAMPLE + 0.5))
roysandberg 62:8e2fbe131b53 53 #define MS450 ((int) (450/MS_PER_SAMPLE + 0.5))
roysandberg 62:8e2fbe131b53 54 #define MS1000 SAMPLE_RATE
roysandberg 62:8e2fbe131b53 55 #define MS1500 ((int) (1500/MS_PER_SAMPLE))
roysandberg 62:8e2fbe131b53 56 #define DERIV_LENGTH MS10
roysandberg 62:8e2fbe131b53 57 #define LPBUFFER_LGTH ((int) (2*MS25))
roysandberg 62:8e2fbe131b53 58 #define HPBUFFER_LGTH MS125
roysandberg 62:8e2fbe131b53 59
roysandberg 62:8e2fbe131b53 60 #define WINDOW_WIDTH MS80 // Moving window integration width.
roysandberg 62:8e2fbe131b53 61 #define FILTER_DELAY (int) (((double) DERIV_LENGTH/2) + ((double) LPBUFFER_LGTH/2 - 1) + (((double) HPBUFFER_LGTH-1)/2) + PRE_BLANK) // filter delays plus 200 ms blanking delay
roysandberg 62:8e2fbe131b53 62 #define DER_DELAY WINDOW_WIDTH + FILTER_DELAY + MS100