Mercurial > hg > beaglert
comparison examples/basic_pulseIn/render.cpp @ 301:e4392164b458 prerelease
RENAMED BeagleRT to Bela AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, scripts probably not working
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Fri, 27 May 2016 14:34:41 +0100 |
parents | dbeed520b014 |
children | 1feb9c23ac57 |
comparison
equal
deleted
inserted
replaced
300:dbeed520b014 | 301:e4392164b458 |
---|---|
3 * | 3 * |
4 * Created on: Oct 24, 2014 | 4 * Created on: Oct 24, 2014 |
5 * Author: parallels | 5 * Author: parallels |
6 */ | 6 */ |
7 | 7 |
8 #include <BeagleRT.h> | 8 #include <Bela.h> |
9 #include <PulseIn.h> | 9 #include <PulseIn.h> |
10 #include <Utilities.h> | 10 #include <Utilities.h> |
11 #include <stdlib.h> | 11 #include <stdlib.h> |
12 #include <rtdk.h> | 12 #include <rtdk.h> |
13 #include <cmath> | 13 #include <cmath> |
24 int gPulseInPin = 0; | 24 int gPulseInPin = 0; |
25 int gDigitalOutPin = 1; | 25 int gDigitalOutPin = 1; |
26 int gPulseLength = 1234; | 26 int gPulseLength = 1234; |
27 int gSamplesBetweenPulses = 10000; | 27 int gSamplesBetweenPulses = 10000; |
28 | 28 |
29 bool setup(BeagleRTContext *context, void *userData) | 29 bool setup(BelaContext *context, void *userData) |
30 { | 30 { |
31 pinModeFrame(context, 0, gDigitalOutPin, OUTPUT); | 31 pinModeFrame(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 } |
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. |
37 // Input and output are given from the audio hardware and the other | 37 // Input and output are given from the audio hardware and the other |
38 // ADCs and DACs (if available). If only audio is available, numMatrixFrames | 38 // ADCs and DACs (if available). If only audio is available, numMatrixFrames |
39 // will be 0. | 39 // will be 0. |
40 | 40 |
41 void render(BeagleRTContext *context, void *userData) | 41 void render(BelaContext *context, void *userData) |
42 { | 42 { |
43 static bool pulseOut = 0; | 43 static bool pulseOut = 0; |
44 static int count = 0; | 44 static int count = 0; |
45 for(unsigned int n = 0; n < context->digitalFrames; n++){ | 45 for(unsigned int n = 0; n < context->digitalFrames; n++){ |
46 // detect if a pulse just ended | 46 // detect if a pulse just ended |
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. |
68 // Release any resources that were allocated in setup(). | 68 // Release any resources that were allocated in setup(). |
69 | 69 |
70 void cleanup(BeagleRTContext *context, void *userData) | 70 void cleanup(BelaContext *context, void *userData) |
71 { | 71 { |
72 | 72 |
73 } | 73 } |