Mercurial > hg > beaglert
comparison examples/basic_pulseIn/render.cpp @ 314:611306d840b3 prerelease
Merge
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Fri, 27 May 2016 19:00:43 +0100 |
parents | 02c4ca0e3718 |
children | 9dc5a0ccad25 |
comparison
equal
deleted
inserted
replaced
313:c770cdf3d8b2 | 314:611306d840b3 |
---|---|
26 int gPulseLength = 1234; | 26 int gPulseLength = 1234; |
27 int gSamplesBetweenPulses = 10000; | 27 int gSamplesBetweenPulses = 10000; |
28 | 28 |
29 bool setup(BelaContext *context, void *userData) | 29 bool setup(BelaContext *context, void *userData) |
30 { | 30 { |
31 pinModeFrame(context, 0, gDigitalOutPin, OUTPUT); | 31 pinMode(context, 0, gDigitalOutPin, OUTPUT); |
32 pulseIn.init(context, gPulseInPin, 1); //third parameter is direction | 32 pulseIn.init(context, gPulseInPin, 1); //third parameter is direction |
33 return true; | 33 return true; |
34 } | 34 } |
35 | 35 |
36 // render() is called regularly at the highest priority by the audio engine. | 36 // render() is called regularly at the highest priority by the audio engine. |
57 } | 57 } |
58 if(count == (gPulseLength + gSamplesBetweenPulses)){ | 58 if(count == (gPulseLength + gSamplesBetweenPulses)){ |
59 pulseOut = true; | 59 pulseOut = true; |
60 count = 0; | 60 count = 0; |
61 } | 61 } |
62 digitalWriteFrame(context, n, gDigitalOutPin, pulseOut); | 62 digitalWrite(context, n, gDigitalOutPin, pulseOut); |
63 count++; | 63 count++; |
64 } | 64 } |
65 } | 65 } |
66 | 66 |
67 // cleanup() is called once at the end, after the audio has stopped. | 67 // cleanup() is called once at the end, after the audio has stopped. |