Esempio n. 1
0
File: servo.c Progetto: Ant1r/Fraise
void Servo_Service(void)
{
	unsigned int val;
	
	if(Elapsed(servoSOF)>Micros(18000UL)) {
		Servo_Rewind();
		servoSOF=GetTime();
	}

	if(Count>7) return;
	if(TIMER_ON) return;
	
	if(Val[Count]==0) { 
		Count++;
		return;
	}
	
	NextPort=Port[Count];
	NextMask=Mask[Count];
	val=~Val[Count];
	TIMER_H=val>>8;
	TIMER_L=val&255;
	TIMER_IF=0;
	__critical {
		//*NextPort=(*NextPort)|NextMask;
		FSR0L=(unsigned char)NextPort;
		FSR0H=(unsigned int)NextPort>>8;
	
		INDF0|=NextMask;

		TIMER_ON=1;
	}
	Count++;	
}
Esempio n. 2
0
		float Timer::ElapsedMillis() {
			#ifdef AURORA_TARGET_PLATFORM_WINDOWS
			return Elapsed() * 1000.0f;
			#elif defined(AURORA_TARGET_ENVIRONMENT_POSIX)
			return std::chrono::duration_cast<milliseconds_type>(HighResolutionClock::now() - start).count();
			#endif
		}
Esempio n. 3
0
void cUIControlAnim::Update() {
	cUIDragable::Update();

	if ( NULL != mMoveAnim && mMoveAnim->Enabled() ) {
		mMoveAnim->Update( Elapsed() );
		Pos( (eeInt)mMoveAnim->GetPos().x, (eeInt)mMoveAnim->GetPos().y );

		if ( mMoveAnim->Ended() )
			eeSAFE_DELETE( mMoveAnim );
	}

	if ( NULL != mAlphaAnim && mAlphaAnim->Enabled() ) {
		mAlphaAnim->Update( Elapsed() );
		Alpha( mAlphaAnim->GetRealPos() );

		if ( mAlphaAnim->Ended() ) {
			if ( ( mControlFlags & UI_CTRL_FLAG_CLOSE_FO )  )
				Close();

			if ( ( mControlFlags & UI_CTRL_FLAG_DISABLE_FADE_OUT ) ) {
				mControlFlags &= ~UI_CTRL_FLAG_DISABLE_FADE_OUT;

				Visible( false );
			}

			eeSAFE_DELETE( mAlphaAnim );
		}
	}

	if ( NULL != mScaleAnim && mScaleAnim->Enabled() ) {
		mScaleAnim->Update( Elapsed() );
		Scale( mScaleAnim->GetPos() );

		if ( mScaleAnim->Ended() )
			eeSAFE_DELETE( mScaleAnim );
	}

	if ( NULL != mAngleAnim && mAngleAnim->Enabled() ) {
		mAngleAnim->Update( Elapsed() );
		Angle( mAngleAnim->GetRealPos() );

		if ( mAngleAnim->Ended() )
			eeSAFE_DELETE( mAngleAnim );
	}
}
Esempio n. 4
0
bool ColorTimeline::OnUpdate(float prevElapsed,float dt, float blend /*= 1.f*/)
{
	ColorTimelineModel* model = (ColorTimelineModel*)mModel;
	Color4F color= model->GetColor(Elapsed())*blend;
	INode* node = (INode*)mTarget;
	node->SetColor(color);

	return true;
}
Esempio n. 5
0
bool TextureFileIdTimeline::OnUpdate(float prevElapsed,float dt, float blend /*= 1.f*/)
{
	TextureFileIdTimelineModel* model = (TextureFileIdTimelineModel*)mModel;
	FileIdRef fileId = model->GetFileId(Elapsed());

	auto renderingObject = RenderingObjectFactory::Instance().CreateFromTexture(fileId);
	INode* node = (INode*)mTarget;
	node->SetRenderingObject(renderingObject);
	return true;
}
Esempio n. 6
0
String TTimeLapse::AsStr(TDateTime dt)
{
	if ((int)dt == 0) dt = Elapsed();

	dt.DecodeTime(&FHour, &FMin, &FSec, &FMSec);

	String str;
	if (FHour != 0)
		str = dt.FormatString("h':'nn':'ss");
	else
		str = dt.FormatString("n':'ss");
	return str;
}
Esempio n. 7
0
BOOL MonotonicTime::Elapsed(UINT32 interval, BOOL update)
{
	if ( Elapsed( interval ) )
	{
//#if defined(__WXGTK__)
//		interval = interval * CLOCKS_PER_SEC / 1000;
//#endif		

		if ( update )
			SampleTime += interval;

		return TRUE;
	}
	return FALSE;
}
Esempio n. 8
0
void cxTimeLine::OnStep(cxFloat dt)
{
    cxFloat elapsed = Elapsed();
    for(cxInt i = idx;i<Length();i++){
        if(elapsed < times.at(i)){
            break;
        }
        if(prev == i){
            continue;
        }
        idx = i;
        prev = i;
        OnTime(At(idx));
    }
    cxAction::OnStep(dt);
}
Esempio n. 9
0
void Logger::WriteItem(const char* item)
{
#ifdef LOGTOSOCKET
	char buf[MAX_BUF];
	snprintf(buf,sizeof(buf), "%f%s\n",Elapsed(),item);

	if(status == 0){
		write(sockd, buf, strlen(buf));
	} else {
        //printf(&buf[0)]);
    }
#else
	/* Use current native logger port */
	LOGITIMETOPIC(item);
#endif
}
Esempio n. 10
0
String TTimeLapse::AsString(const bool ms, TDateTime dt)
{
	if ((int)dt == 0)
        dt = Elapsed();

	dt.DecodeTime(&FHour, &FMin, &FSec, &FMSec);

	String str;
	if (FHour != 0)
		str = IntToStr(FHour) + " Hours, ";
	str += dt.FormatString("n' Minutes, 's");
	if (ms)
		str +=  dt.FormatString("'.'z");
	str += " Seconds";
	return str;
}
Esempio n. 11
0
std::string ProgressTimer::GetProgressMessage(double progress,
                                              bool bIncludeElapsed,
                                              bool bIncludeRemaining) const {

  const double miliSecs = Elapsed();
  std::string result;

  if (bIncludeElapsed) {
    if (!result.empty()) result += " "; 
    result += "Elapsed: " + TimeToString(miliSecs);
  }
  if (bIncludeRemaining && progress > 0.0) {
    if (!result.empty()) result += " "; 
    result += "Remaining: " + TimeToString(miliSecs * (1.0-progress)/progress);
  }

  return result;
}
Esempio n. 12
0
double Timer::ElapsedSecond() const
{
	return Elapsed() / (double) GetFrequency();
}
Esempio n. 13
0
 /**
  * Combines a call to Elapsed() and Update().
  */
 int ElapsedUpdate() {
   const auto now = GetNow();
   int result = Elapsed(now);
   Update(now);
   return result;
 }
Esempio n. 14
0
 /**
  * Returns the number of milliseconds elapsed since the last
  * update().  Returns -1 if update() was never called.
  */
 int Elapsed() const {
   return Elapsed(GetNow());
 }
Esempio n. 15
0
TimeStamp::TimeDiff TimeStamp::ElapsedMillisecond()const
{
		return (Elapsed() / 1000);
}
Esempio n. 16
0
 gcc_pure
 bool HasExpired() const {
   return Elapsed() > 0;
 }
Esempio n. 17
0
	float Timer::ElapsedMillis()
	{
		return Elapsed() * 1000.0f;
	}
Esempio n. 18
0
 /** difference. for elapsed from current usage */
 Elapsed operator-(Elapsed const& start) const {
   return Elapsed(sec-start.sec, wallSec-start.wallSec, peakBytes, peakBytes-start.peakBytes);
 }
Esempio n. 19
0
 Elapsed now() const { return Elapsed(timer, kMeasureProcessMemory); }
Esempio n. 20
0
 /**
  * Returns the number of milliseconds remaining until the timeout
  * expires.  The time has already expired if the return value is
  * negative.
  */
 gcc_pure
 int GetRemainingSigned() const {
   return -Elapsed();
 }
Esempio n. 21
0
int StopWatch::ElapsedSeconds() const
{
		return int(Elapsed()/Resolution());
}