Mercurial > hg > beaglert
diff projects/basic_blink/render.cpp @ 81:92145ba7aabf
Updated PRU code to allow pinModeFrame() and [untested] digitalWriteFrame() and analogWriteFrame() to be called from setup(). Updated basic_blink example accordingly.
author | andrewm |
---|---|
date | Fri, 17 Jul 2015 22:16:53 +0100 |
parents | ff0f776415e4 |
children | ac8eb07afcf5 |
line wrap: on
line diff
--- a/projects/basic_blink/render.cpp Fri Jul 17 21:39:51 2015 +0100 +++ b/projects/basic_blink/render.cpp Fri Jul 17 22:16:53 2015 +0100 @@ -14,6 +14,7 @@ bool setup(BeagleRTContext *context, void *userData) { + pinModeFrame(context, 0, P8_07, OUTPUT); return true; } @@ -36,12 +37,14 @@ if(count==context->digitalSampleRate*interval){ //if enough samples have elapsed count=0; //reset the counter // status=digitalReadFrame(context, 0, P8_07); - if(status==GPIO_LOW) //toggle the status - status=GPIO_HIGH; - else - status=GPIO_LOW; - pinModeFrame(context, n, P8_07, OUTPUT); - digitalWriteFrame(context, n, P8_07, status); //write the status to the LED + if(status==GPIO_LOW) { //toggle the status + digitalWriteFrame(context, n, P8_07, status); //write the status to the LED + status=GPIO_HIGH; + } + else { + digitalWriteFrame(context, n, P8_07, status); //write the status to the LED + status=GPIO_LOW; + } } count++; }