a pacemaker

Dependencies:   mbed

Committer:
kohlerba
Date:
Wed Oct 26 13:42:57 2016 +0000
Revision:
1:446bd28a1f19
Child:
3:334300ac49e5
blah;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kohlerba 1:446bd28a1f19 1 #include "v_pacing.h"
kohlerba 1:446bd28a1f19 2
kohlerba 1:446bd28a1f19 3 double v_pace = 0;
kohlerba 1:446bd28a1f19 4
kohlerba 1:446bd28a1f19 5 double get_v_pace(void){
kohlerba 1:446bd28a1f19 6 return v_pace;
kohlerba 1:446bd28a1f19 7 }
kohlerba 1:446bd28a1f19 8
kohlerba 1:446bd28a1f19 9 int set_v_pace(double amp){
kohlerba 1:446bd28a1f19 10 v_pace = amp;
kohlerba 1:446bd28a1f19 11 return 1;
kohlerba 1:446bd28a1f19 12 }
kohlerba 1:446bd28a1f19 13
kohlerba 1:446bd28a1f19 14 int v_pace_sq(double amp , double pulse_width){
kohlerba 1:446bd28a1f19 15 assert (get_time() != 0);
kohlerba 1:446bd28a1f19 16 double clock_freeze = get_time();
kohlerba 1:446bd28a1f19 17 while((get_time() - clock_freeze) < pulse_width){
kohlerba 1:446bd28a1f19 18 set_v_pace(amp);
kohlerba 1:446bd28a1f19 19 }
kohlerba 1:446bd28a1f19 20 v_pace = 0;
kohlerba 1:446bd28a1f19 21 return 1;
kohlerba 1:446bd28a1f19 22 }