Mercurial > hg > beaglert
comparison core/PulseIn.cpp @ 308:1feb9c23ac57 prerelease
Renamed read/write functions to remove the Frame --> e.g. analogWriteFrameOnce -> analogWriteOnce, digitalReadFrame -> digitalRead
| author | andrewm |
|---|---|
| date | Fri, 27 May 2016 18:21:21 +0100 |
| parents | e4392164b458 |
| children | 02c4ca0e3718 |
comparison
equal
deleted
inserted
replaced
| 307:ff5f346a293e | 308:1feb9c23ac57 |
|---|---|
| 23 for(unsigned int n = 0; n < context->digitalFrames; n++){ | 23 for(unsigned int n = 0; n < context->digitalFrames; n++){ |
| 24 _array[n] = 0; //maybe a few of these will be overwritten below | 24 _array[n] = 0; //maybe a few of these will be overwritten below |
| 25 } | 25 } |
| 26 for(unsigned int n = 0; n < context->digitalFrames; n++){ | 26 for(unsigned int n = 0; n < context->digitalFrames; n++){ |
| 27 if(_pulseIsOn == false){ // look for start edge | 27 if(_pulseIsOn == false){ // look for start edge |
| 28 if(digitalReadFrame(context, n, _digitalInput) == _pulseOnState){ | 28 if(digitalRead(context, n, _digitalInput) == _pulseOnState){ |
| 29 _pulseStart = context->audioSampleCount + n; // store location of start edge | 29 _pulseStart = context->audioSampleCount + n; // store location of start edge |
| 30 _pulseIsOn = true; | 30 _pulseIsOn = true; |
| 31 } | 31 } |
| 32 } else { // _pulseIsOn == true; | 32 } else { // _pulseIsOn == true; |
| 33 if(digitalReadFrame(context, n, _digitalInput) == !_pulseOnState){ // look for stop edge | 33 if(digitalRead(context, n, _digitalInput) == !_pulseOnState){ // look for stop edge |
| 34 _array[n] = context->audioSampleCount + n - _pulseStart; // compute and store pulse duration | 34 _array[n] = context->audioSampleCount + n - _pulseStart; // compute and store pulse duration |
| 35 _pulseIsOn = false; | 35 _pulseIsOn = false; |
| 36 } | 36 } |
| 37 } | 37 } |
| 38 } | 38 } |
