Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
FuncGenFSST.cpp
00001 00002 #include "FuncGenFSST.h" 00003 00004 00005 RectGen::RectGen() 00006 { 00007 val=0; 00008 SetPointsPerPeriod(20); 00009 } 00010 00011 void RectGen::SetPointsPerPeriod(int aPoints) 00012 { 00013 _inc = 2.0/aPoints; 00014 } 00015 00016 void RectGen::SetFrequ(float aFrequ) 00017 { 00018 SetPointsPerPeriod(1.0/aFrequ); 00019 } 00020 00021 void RectGen::CalcOneStep() 00022 { 00023 _phase = _phase + _inc; 00024 if( _phase>1.0 ) 00025 _phase = -1 + (_phase - 1.0); 00026 val_orginal = _phase; 00027 00028 if(_phase > 0) 00029 val = 1; 00030 else 00031 val = -1; 00032 } 00033 00034 00035 00036 SignedRampGen::SignedRampGen() 00037 { 00038 val=0; 00039 SetPointsPerPeriod(20); 00040 } 00041 00042 void SignedRampGen::SetPointsPerPeriod(float aPoints) 00043 { 00044 _inc = 2.0/aPoints; 00045 } 00046 00047 void SignedRampGen::SetFrequ(float aFrequ) 00048 { 00049 SetPointsPerPeriod(1.0/aFrequ); 00050 } 00051 00052 void SignedRampGen::CalcOneStep() 00053 { 00054 val = val + _inc; 00055 if( val>1.0 ) 00056 val = -1 + (val - 1.0); 00057 } 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073
Generated on Thu Jul 21 2022 09:23:03 by
