# HG changeset patch # User Giulio Moro # Date 1437163183 -3600 # Node ID 8bd351ca8b460dce80c8c8032623b62682e69d98 # Parent 0598731d3bef8c6103784f4d8c1c0a09a6419118 Fixed direction in setPinMode functions, updated and fixed basic_blink diff -r 0598731d3bef -r 8bd351ca8b46 core/Utilities.cpp --- a/core/Utilities.cpp Fri Jul 17 20:23:38 2015 +0100 +++ b/core/Utilities.cpp Fri Jul 17 20:59:43 2015 +0100 @@ -68,7 +68,7 @@ // Sets the direction of a digital pin for the current frame and all subsequent frames void pinModeFrame(BeagleRTContext *context, int frame, int channel, int mode) { for(unsigned int f = frame; f < context->digitalFrames; f++) { - if(mode == OUTPUT) + if(mode == INPUT) context->digital[f] |= (1 << channel); else context->digital[f] &= ~(1 << channel); @@ -79,7 +79,7 @@ // // Sets the direction of a digital pin for the current frame only void pinModeFrameOnce(BeagleRTContext *context, int frame, int channel, int mode) { - if(mode == OUTPUT) + if(mode == INPUT) context->digital[frame] |= (1 << channel); else context->digital[frame] &= ~(1 << channel); diff -r 0598731d3bef -r 8bd351ca8b46 projects/basic_blink/render.cpp --- a/projects/basic_blink/render.cpp Fri Jul 17 20:23:38 2015 +0100 +++ b/projects/basic_blink/render.cpp Fri Jul 17 20:59:43 2015 +0100 @@ -1,9 +1,3 @@ - /* - * - * Andrew McPherson and Victor Zappi - * Queen Mary, University of London - */ - #include #include #include @@ -28,9 +22,13 @@ // ADCs and DACs (if available). If only audio is available, numAnalogFrames // will be 0. +/* basic_blink +* Connect an LED in series with a 470ohm resistor between P8_07 and ground. +* The LED will blink every @interval seconds. +*/ + void render(BeagleRTContext *context, void *userData) { - //connect an LED in series with a 470ohm resistor between P8_07 and ground static int count=0; //counts elapsed samples float interval=0.5; //how often to toggle the LED (in seconds) static int status=GPIO_LOW; @@ -42,11 +40,9 @@ status=GPIO_HIGH; else status=GPIO_LOW; - pinModeFrame(context, 0, P8_07, OUTPUT); - digitalWriteFrame(context, n, P8_07, status); //write the status to the LED - // rt_printf("there %d\n", context->digital[n]); + pinModeFrame(context, n, P8_07, OUTPUT); + digitalWriteFrameOnce(context, n, P8_07, status); //write the status to the LED } - context->digital[n]=status*0x00010000; count++; } }