Func-Gen - basic setup

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers FuncGenFSST_21.cpp Source File

FuncGenFSST_21.cpp

00001 
00002 #include "FuncGenFSST.h"
00003 
00004 SignedRampGen::SignedRampGen()
00005 {
00006     val=0;
00007     SetPointsPerPeriod(20);
00008 }
00009 
00010 void SignedRampGen::SetPointsPerPeriod(float aPoints)
00011 {
00012   _inc = 2.0/aPoints;
00013 }
00014 
00015 void SignedRampGen::SetFrequ(float aFrequ)
00016 {
00017   SetPointsPerPeriod(1.0/aFrequ);
00018 }
00019 
00020 void SignedRampGen::CalcOneStep()
00021 {
00022   val = val + _inc;
00023   if( val>1.0 )
00024     val = -1 + (val - 1.0); 
00025 }