comparison projects/basic_button/render.cpp @ 235:3d41a6fa1830

Merge
author Giulio Moro <giuliomoro@yahoo.it>
date Sun, 10 Apr 2016 04:08:06 +0200
parents ec9425f728bc
children db76215feb69
comparison
equal deleted inserted replaced
216:869f5e703844 235:3d41a6fa1830
18 // 18 //
19 // Return true on success; returning false halts the program. 19 // Return true on success; returning false halts the program.
20 20
21 bool setup(BeagleRTContext *context, void *userData) 21 bool setup(BeagleRTContext *context, void *userData)
22 { 22 {
23 for(unsigned int n=0; n<context->digitalFrames; n++){
24 pinModeFrame(context, 0, P8_08, INPUT);
25 pinModeFrame(context, 0, P8_07, OUTPUT);
26 }
23 return true; 27 return true;
24 } 28 }
25 29
26 // render() is called regularly at the highest priority by the audio engine. 30 // render() is called regularly at the highest priority by the audio engine.
27 // Input and output are given from the audio hardware and the other 31 // Input and output are given from the audio hardware and the other
37 */ 41 */
38 42
39 void render(BeagleRTContext *context, void *userData) 43 void render(BeagleRTContext *context, void *userData)
40 { 44 {
41 for(unsigned int n=0; n<context->digitalFrames; n++){ 45 for(unsigned int n=0; n<context->digitalFrames; n++){
42 pinModeFrame(context, 0, P8_08, INPUT); 46 int status=digitalReadFrame(context, 0, P8_08); //read the value of the button
43 int status=digitalReadFrame(context, 0, P8_08); //read the value of the button 47 digitalWriteFrame(context, n, P8_07, status); //write the status to the LED
44 pinModeFrame(context, 0, P8_07, OUTPUT); 48 }
45 digitalWriteFrame(context, n, P8_07, status); //write the status to the LED
46 }
47 } 49 }
48 50
49 // cleanup() is called once at the end, after the audio has stopped. 51 // cleanup() is called once at the end, after the audio has stopped.
50 // Release any resources that were allocated in setup(). 52 // Release any resources that were allocated in setup().
51 53