Function Generator for TINF 2021

src/FuncGenFSST_21.cpp

Committer:
stkiegerl
Date:
2021-03-18
Revision:
2:d2e5b6c37b4b
Parent:
1:dbd814e65f1d

File content as of revision 2:d2e5b6c37b4b:


#include "FuncGenFSST.h"

SignedRampGen::SignedRampGen()
{
	val=0;
	SetPointsPerPeriod(20);
}

void SignedRampGen::SetPointsPerPeriod(float aPoints)
{
  _inc = 2.0/aPoints;
}

void SignedRampGen::SetFrequ(float aFrequ)
{
  SetPointsPerPeriod(1.0/aFrequ);
}

void SignedRampGen::CalcOneStep()
{
  val = val + _inc;
  if( val>1.0 )
    val = -1 + (val - 1.0); 
}