Mercurial > hg > beaglert
diff examples/gpioAnalogLoopbackTest/render.cpp @ 308:1feb9c23ac57 prerelease
Renamed read/write functions to remove the Frame --> e.g. analogWriteFrameOnce -> analogWriteOnce, digitalReadFrame -> digitalRead
author | andrewm |
---|---|
date | Fri, 27 May 2016 18:21:21 +0100 |
parents | e4392164b458 |
children | 02c4ca0e3718 |
line wrap: on
line diff
--- a/examples/gpioAnalogLoopbackTest/render.cpp Fri May 27 18:12:15 2016 +0100 +++ b/examples/gpioAnalogLoopbackTest/render.cpp Fri May 27 18:21:21 2016 +0100 @@ -99,20 +99,20 @@ static int count = 0; bool doReadWrite = context->analogChannels<=4 ? true : ((context->analogChannels == 8) && (n&1)==0); if(doReadWrite){ - digitalAIn = digitalReadFrame(context, n, gDigitalInACh); + digitalAIn = digitalRead(context, n, gDigitalInACh); switch(context->analogChannels){ case 8: - analog0In = analogReadFrame(context, n/2, 0) > 0.5; - analogWriteFrame(context, n/2, analogOut, writePattern[outPointer]); + analog0In = analogRead(context, n/2, 0) > 0.5; + analogWrite(context, n/2, analogOut, writePattern[outPointer]); break; case 4: - analog0In = analogReadFrame(context, n, 0) > 0.5; - analogWriteFrame(context, n, analogOut, writePattern[outPointer]); + analog0In = analogRead(context, n, 0) > 0.5; + analogWrite(context, n, analogOut, writePattern[outPointer]); break; case 2: - analog0In = analogReadFrame(context, n * 2 + 1, 0) > 0.5; - analogWriteFrame(context, 2 * n, analogOut, writePattern[outPointer]); - analogWriteFrame(context, 2 * n + 1, analogOut, writePattern[outPointer]); + analog0In = analogRead(context, n * 2 + 1, 0) > 0.5; + analogWrite(context, 2 * n, analogOut, writePattern[outPointer]); + analogWrite(context, 2 * n + 1, analogOut, writePattern[outPointer]); break; } gAnalogOutLoopDelay--; @@ -150,24 +150,24 @@ */ bool doReadWrite = false; static bool pastAnalog1In = false; - digitalWriteFrameOnce(context, n, gDigitalOutCh, writePattern[digitalOutPointer]); + digitalWriteOnce(context, n, gDigitalOutCh, writePattern[digitalOutPointer]); if(context->analogChannels == 8){ if((n&1) == 0){ //do it every other sample - pastAnalog1In = analogReadFrame(context, n/2, 1) > 0.5; - digitalDIn = digitalReadFrame(context, n, gDigitalInDCh); + pastAnalog1In = analogRead(context, n/2, 1) > 0.5; + digitalDIn = digitalRead(context, n, gDigitalInDCh); doReadWrite = true; } } if(context->analogChannels == 4){ - pastAnalog1In = analogReadFrame(context, n, 1) > 0.5; - digitalDIn = digitalReadFrame(context, n, gDigitalInDCh); - digitalWriteFrameOnce(context, n, gDigitalOutCh, writePattern[digitalOutPointer]); + pastAnalog1In = analogRead(context, n, 1) > 0.5; + digitalDIn = digitalRead(context, n, gDigitalInDCh); + digitalWriteOnce(context, n, gDigitalOutCh, writePattern[digitalOutPointer]); doReadWrite = true; } if(context->analogChannels == 2){ - pastAnalog1In = analogReadFrame(context, n * 2, 1) > 0.5; - digitalDIn = digitalReadFrame(context, n, gDigitalInDCh); - digitalWriteFrameOnce(context, n, gDigitalOutCh, writePattern[digitalOutPointer]); + pastAnalog1In = analogRead(context, n * 2, 1) > 0.5; + digitalDIn = digitalRead(context, n, gDigitalInDCh); + digitalWriteOnce(context, n, gDigitalOutCh, writePattern[digitalOutPointer]); doReadWrite = true; } bool expectedDigitalIn = writePattern[digitalInPointer];