comparison examples/gpioAnalogLoopbackTest/render.cpp @ 301:e4392164b458 prerelease

RENAMED BeagleRT to Bela AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, scripts probably not working
author Giulio Moro <giuliomoro@yahoo.it>
date Fri, 27 May 2016 14:34:41 +0100
parents dbeed520b014
children 1feb9c23ac57
comparison
equal deleted inserted replaced
300:dbeed520b014 301:e4392164b458
1 #include <BeagleRT.h> 1 #include <Bela.h>
2 #include <Utilities.h> 2 #include <Utilities.h>
3 #include <cmath> 3 #include <cmath>
4 #include <rtdk.h> 4 #include <rtdk.h>
5 #include <sys/time.h> 5 #include <sys/time.h>
6 #include <sys/types.h> 6 #include <sys/types.h>
22 int gDigitalOutCh = 2; 22 int gDigitalOutCh = 2;
23 int gDigitalInACh = 0; 23 int gDigitalInACh = 0;
24 int gDigitalInDCh = 3; 24 int gDigitalInDCh = 3;
25 int gAnalogOutLoopDelay; 25 int gAnalogOutLoopDelay;
26 int gDigitalOutLoopDelay; 26 int gDigitalOutLoopDelay;
27 bool setup(BeagleRTContext *context, void *userData) 27 bool setup(BelaContext *context, void *userData)
28 { 28 {
29 rt_printf("For this test you need the following connections:\n" 29 rt_printf("For this test you need the following connections:\n"
30 "analog%d out->digital%d in, analog%d out->analog%d in, " 30 "analog%d out->digital%d in, analog%d out->analog%d in, "
31 "digital%d out -> digital%d in, digital%d out-> analog%d in\n", 31 "digital%d out -> digital%d in, digital%d out-> analog%d in\n",
32 gAnalogOutCh, gDigitalInACh, gAnalogOutCh, 0, gDigitalOutCh, gDigitalInDCh, gDigitalOutCh, 0); 32 gAnalogOutCh, gDigitalInACh, gAnalogOutCh, 0, gDigitalOutCh, gDigitalInDCh, gDigitalOutCh, 0);
64 // will be 0. 64 // will be 0.
65 65
66 const int patternLength = 31; 66 const int patternLength = 31;
67 static int anaErrorCount = 0; 67 static int anaErrorCount = 0;
68 static int digErrorCount = 0; 68 static int digErrorCount = 0;
69 void render(BeagleRTContext *context, void *userData) 69 void render(BelaContext *context, void *userData)
70 { 70 {
71 static bool writePattern[patternLength] = { 71 static bool writePattern[patternLength] = {
72 0,1,0,1,0,0,1,1, 72 0,1,0,1,0,0,1,1,
73 0,0,0,1,1,1,0,0, 73 0,0,0,1,1,1,0,0,
74 1,1,1,1,0,0,0,0, 74 1,1,1,1,0,0,0,0,
194 gShouldStop = true; 194 gShouldStop = true;
195 } 195 }
196 } 196 }
197 197
198 198
199 void cleanup(BeagleRTContext *context, void *userData) 199 void cleanup(BelaContext *context, void *userData)
200 { 200 {
201 if(anaErrorCount == 0 && digErrorCount == 0){ 201 if(anaErrorCount == 0 && digErrorCount == 0){
202 rt_printf("Test was succesful with %d analog channels and a buffer size of %d\n", context->analogChannels, context->audioFrames); 202 rt_printf("Test was succesful with %d analog channels and a buffer size of %d\n", context->analogChannels, context->audioFrames);
203 } else { 203 } else {
204 rt_printf("------------------------\n%danalog %ddigital errors over %dsamples while running test with ", 204 rt_printf("------------------------\n%danalog %ddigital errors over %dsamples while running test with ",