예제 #1
0
파일: petest.cpp 프로젝트: JFreaker/exetoc
int ttest_main()
{
	int i1 = nop1(1);
	nop3(i1);
	int i2 = nop2(2,3);
	nop3(i2);
	int i3 = nop1(4);
	nop3(i3);
	int i4 = nop2(5,6);
	return i1+i3+7;
}
예제 #2
0
파일: petest.cpp 프로젝트: JFreaker/exetoc
int test_main1()
{
	for(int i = 0; i< 100; i++)
	{
		nop3(i);
		for(int j=0; j < 22; j++)
		{
			nop3(nop2(i,j));
		}
	}
	return 5;
}
예제 #3
0
파일: main.cpp 프로젝트: nimxor/clazy
void test_missing_ref()
{
    QList<Trivial> trivials;
    QList<BigTrivial> bigTrivials;
    QList<SmallNonTrivial> smallNonTrivials;

    // Test #2: No warning
    foreach (Trivial t, trivials) {
        nop();
    }

    // Test #3: Warning
    foreach (BigTrivial t, bigTrivials) {
        nop();
    }

    // Test #4: Warning
    foreach (SmallNonTrivial t, smallNonTrivials) {
        nop();
    }

    // Test #5: Warning
    foreach (const BigTrivial t, bigTrivials) {
        t.constFoo();
    }

    // Test #6: No warning
    foreach (BigTrivial t, bigTrivials) {
        t.nonConstFoo();
    }

    // Test #7: No warning
    foreach (BigTrivial t, bigTrivials) {
        t = BigTrivial();


    }

    // Test #8: No warning
    foreach (BigTrivial t, bigTrivials) {
        nop2(t);
    }
예제 #4
0
파일: utils.c 프로젝트: Adrellias/uavp-mods
void EscI2CDelay(void)
{
	nop2();
	nop2();
	nop2();
}
예제 #5
0
파일: utils.c 프로젝트: Adrellias/uavp-mods
void OutSignals(void)
{
	bank0 uns8 MV, MH, ML, MR;	// must reside on bank0
	uns8 MT@MV;	// cam tilt servo
	uns8 ME@MH; // cam tilt servo


#ifdef NADA
SendComValH(MCamRoll);
SendComValH(MCamNick);
SendComChar(0x0d);
SendComChar(0x0a);
#endif

#ifndef DEBUG_SENSORS

#ifdef DEBUG_MOTORS
	if( _Flying && CamNickFactor.4 )
	{
		SendComValU(IGas);
		SendComChar(';');
		SendComValS(IRoll);
		SendComChar(';');
		SendComValS(INick);
		SendComChar(';');
		SendComValS(ITurn);
		SendComChar(';');
		SendComValU(MVorne);
		SendComChar(';');
		SendComValU(MHinten);
		SendComChar(';');
		SendComValU(MLinks);
		SendComChar(';');
		SendComValU(MRechts);
		SendComChar(0x0d);
		SendComChar(0x0a);
	}
#endif

	TMR0 = 0;
	T0IF = 0;

#ifdef ESC_PPM
	ALL_PULSE_ON;	// turn on all motor outputs
#endif

	MV = MVorne;
	MH = MHinten;
	ML = MLinks;
	MR = MRechts;

#ifdef DEBUG_MOTORS
// if DEBUG_MOTORS is active, CamIntFactor is a bitmap:
// bit 0 = no front motor
// bit 1 = no rear motor
// bit 2 = no left motor
// bit 3 = no right motor
// bit 4 = turns on the serial output

	if( CamNickFactor.0 )
		MV = _Minimum;
	if( CamNickFactor.1 )
		MH = _Minimum;
	if( CamNickFactor.2 )
		ML = _Minimum;
	if( CamNickFactor.3 )
		MR = _Minimum;
#else
#ifdef INTTEST
	MV = _Minimum;
	MH = _Minimum;
	ML = _Minimum;
	MR = _Minimum;
#endif
#endif

#ifdef ESC_PPM

// simply wait for nearly 1 ms
// irq service time is max 256 cycles = 64us = 16 TMR0 ticks
	while( TMR0 < 0x100-3-16 ) ;

	// now stop CCP1 interrupt
	// capture can survive 1ms without service!

	// Strictly only if the masked interrupt region below is
	// less than the minimum valid Rx pulse/gap width which
	// is 1027uS less capture time overheads

	GIE = 0;	// BLOCK ALL INTERRUPTS for NO MORE than 1mS
	while( T0IF == 0 ) ;	// wait for first overflow
	T0IF=0;		// quit TMR0 interrupt

#if !defined DEBUG && !defined DEBUG_MOTORS
	if( _OutToggle )	// driver cam servos only every 2nd pulse
	{
		CAM_PULSE_ON;	// now turn camera servo pulses on too
	}
	_OutToggle ^= 1;
#endif

// This loop is exactly 16 cycles long
// under no circumstances should the loop cycle time be changed
#asm
	BCF	RP0		// clear all bank bits
//	BCF	RP1
OS005
	MOVF	PORTB,W
	ANDLW	0x0F		// output ports 0 to 3
	BTFSC	Zero_
	GOTO	OS006		// stop if all 4 outputs are done

	DECFSZ	MV,f		// front motor
	GOTO	OS007

	BCF	PulseVorne		// stop pulse
OS007
	DECFSZ	ML,f		// left motor
	GOTO	OS008

	BCF	PulseLinks		// stop pulse
OS008
	DECFSZ	MR,f		// right motor
	GOTO	OS009

	BCF	PulseRechts		// stop pulse
OS009
	DECFSZ	MH,f		// rear motor
	GOTO	OS005
	
	BCF	PulseHinten		// stop pulse
	GOTO	OS005
OS006
#endasm
// This will be the corresponding C code:
//	while( ALL_OUTPUTS != 0 )
//	{	// remain in loop as long as any output is still high
//		if( TMR2 = MVorne  ) PulseVorne  = 0;
//		if( TMR2 = MHinten ) PulseHinten = 0;
//		if( TMR2 = MLinks  ) PulseLinks  = 0;
//		if( TMR2 = MRechts ) PulseRechts = 0;
//	}

	GIE = 1;	// Re-enable interrupt

#endif	// ESC_PPM

#if defined ESC_X3D || defined ESC_HOLGER || defined ESC_YGEI2C

#if !defined DEBUG && !defined DEBUG_MOTORS
	if( _OutToggle )	// driver cam servos only every 2nd pulse
	{
		CAM_PULSE_ON;	// now turn camera servo pulses on too
	}
	_OutToggle ^= 1;
#endif

// in X3D- and Holger-Mode, K2 (left motor) is SDA, K3 (right) is SCL
#ifdef ESC_X3D
	EscI2CStart();
	SendEscI2CByte(0x10);	// one command, 4 data bytes
	SendEscI2CByte(MV); // for all motors
	SendEscI2CByte(MH);
	SendEscI2CByte(ML);
	SendEscI2CByte(MR);
	EscI2CStop();
#endif	// ESC_X3D

#ifdef ESC_HOLGER
	EscI2CStart();
	SendEscI2CByte(0x52);	// one cmd, one data byte per motor
	SendEscI2CByte(MV); // for all motors
	EscI2CStop();

	EscI2CStart();
	SendEscI2CByte(0x54);
	SendEscI2CByte(MH);
	EscI2CStop();

	EscI2CStart();
	SendEscI2CByte(0x58);
	SendEscI2CByte(ML);
	EscI2CStop();

	EscI2CStart();
	SendEscI2CByte(0x56);
	SendEscI2CByte(MR);
	EscI2CStop();
#endif	// ESC_HOLGER

#ifdef ESC_YGEI2C
	EscI2CStart();
	SendEscI2CByte(0x62);	// one cmd, one data byte per motor
	SendEscI2CByte(MV>>1); // for all motors
	EscI2CStop();

	EscI2CStart();
	SendEscI2CByte(0x64);
	SendEscI2CByte(MH>>1);
	EscI2CStop();

	EscI2CStart();
	SendEscI2CByte(0x68);
	SendEscI2CByte(ML>>1);
	EscI2CStop();

	EscI2CStart();
	SendEscI2CByte(0x66);
	SendEscI2CByte(MR>>1);
	EscI2CStop();
#endif	// ESC_YGEI2C

#endif	// ESC_X3D or ESC_HOLGER or ESC_YGEI2C

#ifndef DEBUG_MOTORS
	while( TMR0 < 0x100-3-16 ) ; // wait for 2nd TMR0 near overflow

	GIE = 0;					// Int wieder sperren, wegen Jitter

	while( T0IF == 0 ) ;	// wait for 2nd overflow (2 ms)

	// avoid servo overrun when MCamxx == 0
	ME = MCamRoll+1;
	MT = MCamNick+1;

#if !defined DEBUG && !defined DEBUG_SENSORS
// This loop is exactly 16 cycles long
// under no circumstances should the loop cycle time be changed
#asm
	BCF	RP0		// clear all bank bits
	BCF	RP1
OS001
	MOVF	PORTB,W
	ANDLW	0x30		// output ports 4 and 5
	BTFSC	Zero_
	GOTO	OS002		// stop if all 2 outputs are 0

	DECFSZ	MT,f
	GOTO	OS003

	BCF	PulseCamRoll
OS003
	DECFSZ	ME,f
	GOTO	OS004

	BCF	PulseCamNick
OS004
#endasm
	nop2();
	nop2();
#asm
	GOTO	OS001
OS002
#endasm
#endif	// DEBUG
	GIE = 1;	// re-enable interrupt

	while( T0IF == 0 ) ;	// wait for 3rd TMR2 overflow
#endif	// DEBUG_MOTORS

#endif  // !DEBUG_SENSORS
}
예제 #6
0
파일: utils.c 프로젝트: gke/UAVP
void OutSignals(void)
{
	bank0 uns8 MV, MH, ML, MR;	// must reside on bank0
	uns8 MT@MV;	// cam tilt servo
	uns8 ME@MH; // cam tilt servo

	TMR0 = 0;
	T0IF = 0;

#ifdef ESC_PWM
	ALL_PULSE_ON;	// turn on all motor outputs

	MV = MVorne;
	MH = MHinten;
	ML = MLinks;
	MR = MRechts;

// simply wait for nearly 1 ms
// irq service time is max 256 cycles = 64us = 16 TMR0 ticks
	while( TMR0 < 0x100-3-16 ) ;

	// now stop CCP1 interrupt
	// capture can survive 1ms without service!

	GIE = 0;	// BLOCK ALL INTERRUPTS
	while( T0IF == 0 ) ;	// wait for first overflow
	T0IF=0;		// quit TMR0 interrupt

#ifndef DEBUG
	CAM_PULSE_ON;	// now turn camera servo pulses on too
#endif

// This loop is exactly 16 cycles long
// under no circumstances should the loop cycle time be changed
#asm
	BCF	RP0		// clear all bank bits
	BCF	RP1
OS005
	MOVF	PORTB,W
	ANDLW	0x0F		// output ports 0 to 3
	BTFSC	Zero_
	GOTO	OS006		// stop if all 4 outputs are done

	DECFSZ	MV,f		// front motor
	GOTO	OS007

	BCF	PulseVorne		// stop pulse
OS007
	DECFSZ	ML,f		// left motor
	GOTO	OS008

	BCF	PulseLinks		// stop pulse
OS008
	DECFSZ	MR,f		// right motor
	GOTO	OS009

	BCF	PulseRechts		// stop pulse
OS009
	DECFSZ	MH,f		// rear motor
	GOTO	OS005
	
	BCF	PulseHinten		// stop pulse
	GOTO	OS005
OS006
#endasm
// This will be the corresponding C code:
//	while( ALL_OUTPUTS != 0 )
//	{	// remain in loop as long as any output is still high
//		if( TMR2 = MVorne  ) PulseVorne  = 0;
//		if( TMR2 = MHinten ) PulseHinten = 0;
//		if( TMR2 = MLinks  ) PulseLinks  = 0;
//		if( TMR2 = MRechts ) PulseRechts = 0;
//	}

	GIE = 1;	// Re-enable interrupt
#endif	// ESC_PWM

#if defined ESC_X3D || defined ESC_HOLGER

#ifndef DEBUG
	CAM_PULSE_ON;	// now turn camera servo pulses on too
#endif

// in X3D- and Holger-Mode, K2 (left motor) is SDA, K3 (right) is SCL
#ifdef ESC_X3D
	EscI2CStart();
	SendEscI2CByte(0x10);	// one command, 4 data bytes
	SendEscI2CByte(MVorne); // for all motors
	SendEscI2CByte(MHinten);
	SendEscI2CByte(MLinks);
	SendEscI2CByte(MRechts);
	EscI2CStop();
#endif	// ESC_X3D

#ifdef ESC_HOLGER
	EscI2CStart();
	SendEscI2CByte(0x52);	// one cmd, one data byte per motor
	SendEscI2CByte(MVorne); // for all motors
	EscI2CStop();

	EscI2CStart();
	SendEscI2CByte(0x54);
	SendEscI2CByte(MHinten);
	EscI2CStop();

	EscI2CStart();
	SendEscI2CByte(0x58);
	SendEscI2CByte(MLinks);
	EscI2CStop();

	EscI2CStart();
	SendEscI2CByte(0x56);
	SendEscI2CByte(MRechts);
	EscI2CStop();
#endif	// ESC_HOLGER

 		
#endif	// ESC_X3D or ESC_HOLGER

	while( TMR0 < 0x100-3-16 ) ; // wait for 2nd TMR0 near overflow

	GIE = 0;	// Int wieder sperren, wegen Jitter

	while( T0IF == 0 ) ;	// wait for 2nd overflow (2 ms)

	ME = MCamRoll;
	MT = MCamNick;

#ifndef DEBUG
// This loop is exactly 16 cycles long
// under no circumstances should the loop cycle time be changed
#asm
	BCF	RP0		// clear all bank bits
	BCF	RP1
OS001
	MOVF	PORTB,W
	ANDLW	0x30		// output ports 4 and 5
	BTFSC	Zero_
	GOTO	OS002		// stop if all 2 outputs are 0

	DECFSZ	MT,f
	GOTO	OS003

	BCF	PulseCamRoll
OS003
	DECFSZ	ME,f
	GOTO	OS004

	BCF	PulseCamNick
OS004
#endasm
	nop2();
	nop2();
	nop2();
#asm
	GOTO	OS001
OS002
#endasm
#endif	// DEBUG

	GIE = 1;	// re-enable interrupt
	while( T0IF == 0 ) ;	// wait for 3rd TMR2 overflow
}