示例#1
0
文件: Lab3_B1.c 项目: ozzieem/UniCpp
void* t1_function(GPIO* output)
{
	for (int i = 0; i < 1000; i++)
	{
		onOff(*output, ON);
		busy_wait(1000000);
		onOff(*output, OFF);
		busy_wait(3000000);
	}
}
示例#2
0
文件: Lab3_B1.c 项目: ozzieem/UniCpp
void* t2_function(GPIO* output)
{
	for (int i = 0; i < 1000; i++)
	{
		struct timespec ts;
		ts.tv_sec = 0;
		ts.tv_nsec = 5000000L;
		onOff(*output, ON);
		busy_wait(1000000);
		onOff(*output, OFF);
		nanosleep(&ts, NULL);
	}
}
示例#3
0
LOCAL_C void testInfo()
//
// Test the HAL info.
//
	{
	test.Next(_L("Test UserHal::MemoryInfo"));
    TInt pageSize=0;
    UserHal::PageSizeInBytes(pageSize);

    TMemoryInfoV1Buf membuf;
    UserHal::MemoryInfo(membuf);
    TMemoryInfoV1& memoryInfo=*(TMemoryInfoV1*)membuf.Ptr();

	test.Printf(_L("Allocate some memory & check RAM goes down"));
#if !defined(__WINS__)
	TInt freeMem=memoryInfo.iFreeRamInBytes;
#endif
	TInt8* someMem = new TInt8[0x4000];
	// make an access to each page in order to get pages actually allocated also on data paged systems
	someMem[0]=1;
	someMem[0x1000]=2;
	someMem[0x2000]=3;
	someMem[0x3000]=4;
 	UserHal::MemoryInfo(membuf);
	delete someMem;
#if !defined(__WINS__)
	if (!(freeMem>memoryInfo.iFreeRamInBytes))
		test.Printf(_L("Warning: free RAM value didn't go down"));
#endif

    test.Printf(_L("Total RAM size= %- 5dKBytes      : Free RAM size   = %- 5dKBytes\n"),memoryInfo.iTotalRamInBytes/1024,memoryInfo.iFreeRamInBytes/1024);
    test.Printf(_L("Max free RAM  = %- 5dKBytes      : ROM size        = %- 5dKBytes\n"),memoryInfo.iMaxFreeRamInBytes/1024,memoryInfo.iTotalRomInBytes/1024);
	test.Printf(_L("RAM disk size = %- 5dKBytes\n"),memoryInfo.iInternalDiskRamInBytes/1024);

	test.Next(_L("Test UserHal::MachineInfo"));

    TMachineInfoV2Buf mbuf;
    UserHal::MachineInfo(mbuf);
    TMachineInfoV2& machineInfo=*(TMachineInfoV2*)mbuf.Ptr();

    TName tn = machineInfo.iRomVersion.Name();
 	test.Printf(_L("Page Size     = %- 16d : Rom version     = %- 16S\n"),pageSize,&tn);
   	test.Printf(_L("ScreenOffsetX = %- 16d : ScreenOffsetY   = %- 16d\n"),machineInfo.iOffsetToDisplayInPixels.iX,machineInfo.iOffsetToDisplayInPixels.iY);
   
    TBool password=EFalse; // Password::IsEnabled(); This API was removed by __SECURE_API__
  
    TPtrC t1=onOff(password);
    TPtrC t2=yesNo(machineInfo.iBacklightPresent);

 	test.Printf(_L("Password      = %- 16S : BacklightPresent= %S\n"),&t1,&t2);
	test.Printf(_L("LanguageIndex = %- 16d : KeyboardIndex   = %d\n"),machineInfo.iLanguageIndex,machineInfo.iKeyboardIndex);

	test.Next(_L("Test deprecated UserHal::RomInfo API"));
	TRomInfoV1Buf rombuf;
	test(UserHal::RomInfo(rombuf)==KErrNotSupported); // kernel side API has been deprecated
	}
示例#4
0
文件: Lab2_A1.c 项目: ozzieem/UniCpp
int main(int argc, char *argv[])
{
	gpioSetup();
	GPIO led_4 = create(_4, OUT_PIN);
	struct timespec lightOn, lightOff;

	lightOn.tv_sec = 0;
	lightOff.tv_sec = 0;
	lightOn.tv_nsec = 20000000L;
	lightOff.tv_nsec = 20000000L;

	for (int i = 0; i < 100; i++)
	{
		onOff(led_4, ON);
		nanosleep(&lightOn, NULL);
		onOff(led_4, OFF);
		nanosleep(&lightOff, NULL);
	}
	destroy(led_4);
	return 0;
}
    bool receive(MemoryBuffer &mb)
    {
#ifdef _TRACEBROADCAST
        ActPrintLog(activity, "Broadcast node %d Receiving on tag %d",nodeindex,(int)mpTag);
#endif
        CMessageBuffer msg;
        rank_t sender;
        BooleanOnOff onOff(receiving);
        if (comm->recv(msg, RANK_ALL, mpTag, &sender))
        {
#ifdef _TRACEBROADCAST
            ActPrintLog(activity, "Broadcast node %d Received %d from %d",nodeindex, msg.length(), sender);
#endif
            try
            {
                mb.swapWith(msg);
                msg.clear(); // send empty reply
#ifdef _TRACEBROADCAST
                ActPrintLog(activity, "Broadcast node %d reply to %d",nodeindex, sender);
#endif
                comm->reply(msg);
                if (aborted) 
                    return false;
#ifdef _TRACEBROADCAST
                ActPrintLog(activity, "Broadcast node %d Received %d",nodeindex, mb.length());
#endif
            }
            catch (IException *e)
            {
                ActPrintLog(activity, e, "CBroadcaster::recv(2): exception");
                throw;
            }
        }
#ifdef _TRACEBROADCAST
        ActPrintLog(activity, "receive done");
#endif
        return (0 != mb.length());
    }
void Oh_Oh_Robot::writingRobot_runMode(){
  //readEPROM();
	int n=0;	
	for(int i=0;i<512;i+=2){
		if(EEPROM.read(i)==255){
			direction[n]=255;
			break;
		}else{
			direction[n]=EEPROM.read(i);
			timeSpan[n]=EEPROM.read(i+1)*10;
			n++;
		}
	}
	

  //startRun();
	for(int i=0;i<3;i++){
		digitalWrite(ledPin,HIGH);
		delay(1000);
		digitalWrite(ledPin,LOW);
		delay(1000);
	}



	runTimer=millis();
	arrayPoint=0;
	onOff(true);
	liftArm();
	runFlag=true;

	changeAction();
	while(runFlag){
		run();
		powerFactor;
		sizeFactor;
	}
}
示例#7
0
文件: master.cpp 项目: ogdf/ogdf
void Master::printParameters() const
{
	Logger::ilout(Logger::Level::Default) << "Branch and Cut Parameters:" << std::endl << std::endl

	 << "  Enumeration strategy                   : "
	 << ENUMSTRAT_[enumerationStrategy_]
	 << std::endl

	 << "  Branching Strategy                     : "
	 << BRANCHINGSTRAT_[branchingStrategy_]
	 << std::endl
	 << "  Tested candidates for branching var.   : "
	 << nBranchingVariableCandidates_ << std::endl
	 << "  Simplex iterations when testing" << std::endl
	 << "         candidates for branching var.   : "
	 << nStrongBranchingIterations_ << std::endl
	 << "  Guarantee                              : "
	 << requiredGuarantee_ << " %" << std::endl
	 << "  Maximal enumeration level              : "
	 << maxLevel_ << std::endl
	 << "  Maximal number of subproblems          : "
	 << maxNSub_ << std::endl
	 << "  CPU time limit                         : "
	 << maxCpuTimeAsString() << std::endl
	 << "  Wall-clock time limit                  : "
	 << maxCowTimeAsString() << std::endl
	 << "  Objective function values integer      : "
	 << onOff(objInteger_) << std::endl
	 << "  Tailing Off Parameters" << std::endl
	 << "                    Number of LPs        : "
	 << tailOffNLp_ << std::endl
	 << "                    Minimal improvement  :    "
	 << tailOffPercent_ << '%' << std::endl
	 << "  Delayed branching threshold            : "
	 << dbThreshold_ << std::endl
	 << "  Maximal number of dormant rounds       : "
	 << minDormantRounds_ << std::endl

	 << "  Primal Bound Initialization            : "
	 << PRIMALBOUNDMODE_[pbMode_]
	 << std::endl
	 << "  Frequency of additional pricing        : "
	 << pricingFreq_ << " LPs" << std::endl
	 << "  Cutting skip factor                    : "
	 << skipFactor_ << std::endl
	 << "  Skipping mode                          : "
	 << ((skippingMode_ == SkipByNode)? "by node": "by tree") << std::endl

	<< "  Fix/set by reduced costs               : "
	 << onOff(fixSetByRedCost_) << std::endl
	 << "  Output of the linear program           : "
	 << onOff(printLP_) << std::endl
	 << "  Maximal number of added constraints    : "
	 << maxConAdd_ << std::endl
	 << "  Maximal number of buffered constraints : "
	 << maxConBuffered_ << std::endl
	 << "  Maximal number of added variables      : "
	 << maxVarAdd_ << std::endl
	 << "  Maximal number of buffered variables   : "
	 << maxVarBuffered_ << std::endl
	 << "  Maximal number of iterations per" << std::endl
	 << "                     cutting plane phase : "
	 << maxIterations_ << std::endl
	 << "  Elimination of fixed and set variables : "
	 << onOff(eliminateFixedSet_) << std::endl
	 << "  Reoptimization after a root change     : "
	 << onOff(newRootReOptimize_) << std::endl
	 << "  File storing optimum solutions         : "
	 << optimumFileName_ << std::endl
	 << "  Show average distance of added cuts    : "
	 << onOff(showAverageCutDistance_) << std::endl
	 << "  Elimination of constraints             : "
	 << CONELIMMODE_[conElimMode_] << std::endl
	 << "  Elimination of variables               : "
	 << VARELIMMODE_[varElimMode_] << std::endl
	 << "  Tolerance for constraint elimination   : "
	 << conElimEps_ << std::endl
	 << "  Tolerance for variable elimination     : "
	 << varElimEps_ << std::endl
	 << "  Age for constraint elimination         : "
	 << conElimAge_ << std::endl
	 << "  Age for variable elimination           : "
	 << varElimAge_ << std::endl
	 << "  Default LP-solver                      : "
	 << OSISOLVER_[defaultLpSolver_] << std::endl
	 << "  Usage of approximate solver            : "
	 << onOff(solveApprox_) << std::endl;
	_printLpParameters();
}
示例#8
0
void StatusLed::on(uint8_t ledNum) {
	onOff(STATUSLED_MODE_ON, ledNum);											// switch led on
}
示例#9
0
void StatusLed::off(uint8_t ledNum) {
	onOff(STATUSLED_MODE_OFF, ledNum);											// switch led off
}