Mercurial > hg > beaglert
diff core/RTAudio.cpp @ 280:c55c6f6c233c prerelease
Added support for multiplexer capelet and command-line support for choosing PRU
author | andrewm |
---|---|
date | Tue, 17 May 2016 17:49:23 +0100 |
parents | 88cf310417cd |
children | e4392164b458 |
line wrap: on
line diff
--- a/core/RTAudio.cpp Tue May 17 16:07:45 2016 +0100 +++ b/core/RTAudio.cpp Tue May 17 17:49:23 2016 +0100 @@ -98,6 +98,16 @@ int BeagleRT_initAudio(BeagleRTInitSettings *settings, void *userData) { + // Sanity checks + if(settings->pruNumber < 0 || settings->pruNumber > 1) { + cout << "Invalid PRU number " << settings->pruNumber << endl; + return -1; + } + if(settings->pruNumber != 1 && settings->numMuxChannels != 0) { + cout << "Incompatible settings: multiplexer can only be run using PRU 1\n"; + return -1; + } + rt_print_auto_init(1); BeagleRT_setVerboseLevel(settings->verbose); @@ -202,9 +212,10 @@ cout << "Error: unable to prepare GPIO for PRU audio\n"; return 1; } - + // Get the PRU memory buffers ready to go - if(gPRU->initialise(0, gContext.analogFrames, gContext.analogChannels, true)) { + if(gPRU->initialise(settings->pruNumber, gContext.analogFrames, gContext.analogChannels, + settings->numMuxChannels, true)) { cout << "Error: unable to initialise PRU\n"; return 1; }