comparison core/Utilities.cpp @ 75:8bd351ca8b46

Fixed direction in setPinMode functions, updated and fixed basic_blink
author Giulio Moro <giuliomoro@yahoo.it>
date Fri, 17 Jul 2015 20:59:43 +0100
parents d837fb676977
children f1012082f142
comparison
equal deleted inserted replaced
74:0598731d3bef 75:8bd351ca8b46
66 // pinModeFrame() 66 // pinModeFrame()
67 // 67 //
68 // Sets the direction of a digital pin for the current frame and all subsequent frames 68 // Sets the direction of a digital pin for the current frame and all subsequent frames
69 void pinModeFrame(BeagleRTContext *context, int frame, int channel, int mode) { 69 void pinModeFrame(BeagleRTContext *context, int frame, int channel, int mode) {
70 for(unsigned int f = frame; f < context->digitalFrames; f++) { 70 for(unsigned int f = frame; f < context->digitalFrames; f++) {
71 if(mode == OUTPUT) 71 if(mode == INPUT)
72 context->digital[f] |= (1 << channel); 72 context->digital[f] |= (1 << channel);
73 else 73 else
74 context->digital[f] &= ~(1 << channel); 74 context->digital[f] &= ~(1 << channel);
75 } 75 }
76 } 76 }
77 77
78 // pinModeFrameOnce() 78 // pinModeFrameOnce()
79 // 79 //
80 // Sets the direction of a digital pin for the current frame only 80 // Sets the direction of a digital pin for the current frame only
81 void pinModeFrameOnce(BeagleRTContext *context, int frame, int channel, int mode) { 81 void pinModeFrameOnce(BeagleRTContext *context, int frame, int channel, int mode) {
82 if(mode == OUTPUT) 82 if(mode == INPUT)
83 context->digital[frame] |= (1 << channel); 83 context->digital[frame] |= (1 << channel);
84 else 84 else
85 context->digital[frame] &= ~(1 << channel); 85 context->digital[frame] &= ~(1 << channel);
86 } 86 }
87 87