comparison projects/basic_button/render.cpp @ 223:ec9425f728bc mergingClockSync

Removed redundant calls to pinModeFrame. Closes #1623.
author Giulio Moro <giuliomoro@yahoo.it>
date Mon, 22 Feb 2016 11:28:21 +0000
parents ad130ecb2def
children db76215feb69
comparison
equal deleted inserted replaced
222:6a23c07d0fbb 223:ec9425f728bc
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