bool RHD2000Thread::openBoard(String pathToLibrary) { int return_code = evalBoard->open(pathToLibrary.getCharPointer()); if (return_code == 1) { deviceFound = true; } else if (return_code == -1) // dynamic library not found { bool response = AlertWindow::showOkCancelBox (AlertWindow::NoIcon, "Opal Kelly library not found.", "The Opal Kelly library file was not found in the directory of the executable. Would you like to browse for it?", "Yes", "No", 0, 0); if (response) { // browse for file FileChooser fc("Select the library file...", File::getCurrentWorkingDirectory(), okLIB_EXTENSION, true); if (fc.browseForFileToOpen()) { File currentFile = fc.getResult(); libraryFilePath = currentFile.getFullPathName(); openBoard(libraryFilePath); // call recursively } else { //sendActionMessage("No configuration selected."); deviceFound = false; } } else { deviceFound = false; } } else if (return_code == -2) // board could not be opened { bool response = AlertWindow::showOkCancelBox (AlertWindow::NoIcon, "Acquisition board not found.", "An acquisition board could not be found. Please connect one now.", "OK", "Cancel", 0, 0); if (response) { openBoard(libraryFilePath.getCharPointer()); // call recursively } else { deviceFound = false; } } return deviceFound; }
int myBoard_findIndex( const char *devicePath ) { int i; fprintf( stderr, "try to find %s\n", devicePath ); for (i = 0; i < numBoard; ++i) { if (!strcmp( myHardwareBoardList[i].devicePath, devicePath )) { fprintf( stderr, "found %s at board[%d]\n", devicePath, i ); return i; } } if (numBoard >= MAX_BOARD) { fprintf( stderr, "exceed MAX_BOARD\n" ); return -1; } /* create new one: i==numBoard */ fprintf( stderr, "create new %s at board[%d]\n", devicePath, i ); strcpy( myHardwareBoardList[i].devicePath, devicePath ); mySoftwareBoardList[i].boardLock = epicsMutexMustCreate(); scanIoInit( &mySoftwareBoardList[i].ioScanPvt ); myHardwareBoardList[i].analogReference = AREF_DIFF; mySoftwareBoardList[i].numberOfActiveAnalogInputs = MAX_CHANNEL_PER_BOARD / 2; if (openBoard( i )) { return -1; } ++numBoard; return i; }
int main() { int x,y,i,j; printf("盤面の大きさがxからyについて探します。(x<=y)\nxとyを入力してください。\nx,y = "); scanf("%d,%d",&x,&y); for(i=x;i<=y;i++){ size=i; count=1; openBoard(); initBoard(); board[2][2]=1; knighttour(2,2); free(board); } return 0; }
RHD2000Thread::RHD2000Thread(SourceNode* sn) : DataThread(sn), chipRegisters(30000.0f), numChannels(0), deviceFound(false), isTransmitting(false), dacOutputShouldChange(false), acquireAdcChannels(false), acquireAuxChannels(true), fastSettleEnabled(false), dspEnabled(true), desiredDspCutoffFreq(0.5f), desiredUpperBandwidth(7500.0f), desiredLowerBandwidth(1.0f), boardSampleRate(30000.0f), savedSampleRateIndex(16), cableLengthPortA(0.914f), cableLengthPortB(0.914f), cableLengthPortC(0.914f), cableLengthPortD(0.914f), // default is 3 feet (0.914 m), audioOutputL(-1), audioOutputR(-1) { evalBoard = new Rhd2000EvalBoard; dataBlock = new Rhd2000DataBlock(1); dataBuffer = new DataBuffer(2, 10000); // start with 2 channels and automatically resize // Open Opal Kelly XEM6010 board. // Returns 1 if successful, -1 if FrontPanel cannot be loaded, and -2 if XEM6010 can't be found. File executable = File::getSpecialLocation(File::currentExecutableFile); #if defined(__APPLE__) const String executableDirectory = executable.getParentDirectory().getParentDirectory().getParentDirectory().getParentDirectory().getFullPathName(); #else const String executableDirectory = executable.getParentDirectory().getFullPathName(); #endif std::cout << executableDirectory << std::endl; String dirName = executableDirectory; libraryFilePath = dirName; libraryFilePath += File::separatorString; libraryFilePath += okLIB_NAME; if (openBoard(libraryFilePath)) { // upload bitfile and restore default settings initializeBoard(); // automatically find connected headstages scanPorts(); // things would appear to run more smoothly if this were done after the editor has been created if (0) { evalBoard->setContinuousRunMode(true); evalBoard->run(); } } }