Function Generator for TINF 2021
Embed:
(wiki syntax)
Show/hide line numbers
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 } 00026 00027 00028 00029 00030 00031 00032 00033 00034
Generated on Tue Jul 19 2022 14:35:23 by
1.7.2