Func-Gen - basic setup

Dependencies:   mbed

FuncGenFSST_21.cpp

Committer:
stkiegerl
Date:
2021-03-23
Revision:
3:9fd12684fa88
Parent:
2:3abf5ddd9fc0

File content as of revision 3:9fd12684fa88:


#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); 
}