aswersf
Dependents: p31_SerielDirectwithBytes_Generatoren_Rampe_Sinus_usw
Diff: FuncGenFSST3.cpp
- Revision:
- 0:2e0be62147b1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FuncGenFSST3.cpp Tue Apr 25 06:52:25 2017 +0000 @@ -0,0 +1,72 @@ + +#include "FuncGenFSST3.h" + + +SingnedRampGen::SingnedRampGen() +{ + // sinnvolle frequenz/Periode setzen + SetPointsPerPeriod(50); +} + +void SingnedRampGen::SetPointsPerPeriod(float aPoints) +{ + _inc = 2.0/aPoints; +} + +void SingnedRampGen::SetFrequ(float aFrequ) +{ + SetPointsPerPeriod(1.0/aFrequ); +} + +void SingnedRampGen::CalcOneStep() +{ + val = val + _inc; + if( val>1.0 ) + val = -1 + (val - 1.0); +} + + +TriangleGen::SingnedRampGen() +{ + // sinnvolle frequenz/Periode setzen + SetPointsPerPeriod(100); +} + +void TriangleGen::SetPointsPerPeriod(float aPoints) +{ + _inc = 4.0/aPoints; +} + +void TriangleGen::SetFrequ(float aFrequ) +{ + SetPointsPerPeriod(2.0/aFrequ); +} + +void TriangleGen::CalcOneStep() +{ + phase = phase + _inc; + + if( phase>1.0 ) + { + phase = -1 + (phase - 1.0); + _state++; + } + + +} + + + + + + + + + + + + + + + +