comparison examples/basic_blink/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
1 #include <BeagleRT.h> 1 #include <Bela.h>
2 #include <Utilities.h> 2 #include <Utilities.h>
3 #include <cmath> 3 #include <cmath>
4 #include <rtdk.h> 4 #include <rtdk.h>
5 5
6 // setup() is called once before the audio rendering starts. 6 // setup() is called once before the audio rendering starts.
10 // userData holds an opaque pointer to a data structure that was passed 10 // userData holds an opaque pointer to a data structure that was passed
11 // in from the call to initAudio(). 11 // in from the call to initAudio().
12 // 12 //
13 // Return true on success; returning false halts the program. 13 // Return true on success; returning false halts the program.
14 14
15 bool setup(BeagleRTContext *context, void *userData) 15 bool setup(BelaContext *context, void *userData)
16 { 16 {
17 pinModeFrame(context, 0, P8_07, OUTPUT); 17 pinModeFrame(context, 0, P8_07, OUTPUT);
18 return true; 18 return true;
19 } 19 }
20 20
26 /* basic_blink 26 /* basic_blink
27 * Connect an LED in series with a 470ohm resistor between P8_07 and ground. 27 * Connect an LED in series with a 470ohm resistor between P8_07 and ground.
28 * The LED will blink every @interval seconds. 28 * The LED will blink every @interval seconds.
29 */ 29 */
30 30
31 void render(BeagleRTContext *context, void *userData) 31 void render(BelaContext *context, void *userData)
32 { 32 {
33 static int count=0; //counts elapsed samples 33 static int count=0; //counts elapsed samples
34 float interval=0.5; //how often to toggle the LED (in seconds) 34 float interval=0.5; //how often to toggle the LED (in seconds)
35 static int status=GPIO_LOW; 35 static int status=GPIO_LOW;
36 for(unsigned int n=0; n<context->digitalFrames; n++){ 36 for(unsigned int n=0; n<context->digitalFrames; n++){
51 } 51 }
52 52
53 // cleanup() is called once at the end, after the audio has stopped. 53 // cleanup() is called once at the end, after the audio has stopped.
54 // Release any resources that were allocated in setup(). 54 // Release any resources that were allocated in setup().
55 55
56 void cleanup(BeagleRTContext *context, void *userData) 56 void cleanup(BelaContext *context, void *userData)
57 { 57 {
58 // Nothing to do here 58 // Nothing to do here
59 } 59 }