Func-Gen - basic setup
Embed:
(wiki syntax)
Show/hide line numbers
FuncGenFSST.h
00001 00002 #ifndef FuncGenFSST_h 00003 #define FuncGenFSST_h 00004 00005 // Amplituden fix auf +/-1 00006 00007 class SignedRampGen { 00008 public: 00009 float val; // momentaner Ausgangswert 00010 private: 00011 float _inc; 00012 public: 00013 SignedRampGen(); // Konstruktor 00014 00015 void SetPointsPerPeriod(float aPoints); 00016 00017 // bezogen auf Fsample 0..0.5 00018 void SetFrequ(float aFrequ); 00019 00020 // Einen Abtastwert berechnen 00021 // wird bei z.B. Fsample=100Hz 100x pro sec afgerufen 00022 void CalcOneStep(); 00023 }; 00024 00025 00026 class TriangleGen { 00027 public: 00028 float val; // momentaner Ausgangswert 00029 private: 00030 float _inc; 00031 int _state; 00032 float _phase; 00033 public: 00034 TriangleGen(); 00035 00036 void SetPointsPerPeriod(float aPoints); 00037 00038 // bezogen auf Fsample 0..0.5 00039 void SetFrequ(float aFrequ); 00040 00041 // Einen Abtastwert berechnen 00042 void CalcOneStep(); 00043 }; 00044 00045 00046 class RectGen { 00047 public: 00048 float val; // momentaner Ausgangswert 00049 private: 00050 float _inc; 00051 float _phase; 00052 float _thrs; 00053 public: 00054 RectGen(); 00055 00056 void SetPointsPerPeriod(float aPoints); 00057 00058 void SetFrequ(float aFrequ); 00059 00060 // Dauer des ON-Pulses in Prozent ( 0..1 ) 00061 void SetPulsWidth(float aPercent) 00062 { 00063 _thrs=aPercent; // möglicherweise andere Formel 00064 } 00065 00066 // Einen Abtastwert berechnen 00067 void CalcOneStep(); 00068 }; 00069 00070 #endif 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089
Generated on Sun Jul 24 2022 03:06:37 by
1.7.2