Function generator

Dependencies:   Serial_HL mbed

Committer:
Lenschinki
Date:
Tue May 14 12:16:55 2019 +0000
Revision:
3:c8c3b755ef54
Parent:
2:100244cef3d6
vomit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hollegha2 2:100244cef3d6 1 #ifndef FuncGenFSST_h
hollegha2 2:100244cef3d6 2 #define FuncGenFSST_h
hollegha2 2:100244cef3d6 3
hollegha2 2:100244cef3d6 4 // Amplituden fix auf +/-1
hollegha2 2:100244cef3d6 5
hollegha2 2:100244cef3d6 6 class SignedRampGen
hollegha2 2:100244cef3d6 7 {
hollegha2 2:100244cef3d6 8 public:
hollegha2 2:100244cef3d6 9 float val; // momentaner Ausgangswert
hollegha2 2:100244cef3d6 10 private:
hollegha2 2:100244cef3d6 11 float _inc;
hollegha2 2:100244cef3d6 12 public:
hollegha2 2:100244cef3d6 13 SignedRampGen(); // Konstruktor
hollegha2 2:100244cef3d6 14
hollegha2 2:100244cef3d6 15 void SetPointsPerPeriod(int aPoints);
hollegha2 2:100244cef3d6 16
hollegha2 2:100244cef3d6 17 // bezogen auf Fsample 0..0.5
hollegha2 2:100244cef3d6 18 void SetFrequ(float aFrequ);
hollegha2 2:100244cef3d6 19
hollegha2 2:100244cef3d6 20 // Einen Abtastwert berechnen
hollegha2 2:100244cef3d6 21 // wird bei z.B. Fsample=100Hz 100x pro sec afgerufen
hollegha2 2:100244cef3d6 22 void CalcOneStep();
hollegha2 2:100244cef3d6 23 };
hollegha2 2:100244cef3d6 24
hollegha2 2:100244cef3d6 25
hollegha2 2:100244cef3d6 26 class TriangleGen
hollegha2 2:100244cef3d6 27 {
hollegha2 2:100244cef3d6 28 public:
hollegha2 2:100244cef3d6 29 float val; // momentaner Ausgangswert
hollegha2 2:100244cef3d6 30 private:
hollegha2 2:100244cef3d6 31 float _inc;
hollegha2 2:100244cef3d6 32 int _state;
hollegha2 2:100244cef3d6 33 public:
hollegha2 2:100244cef3d6 34 TriangleGen();
hollegha2 2:100244cef3d6 35
hollegha2 2:100244cef3d6 36 void SetPointsPerPeriod(int aPoints);
hollegha2 2:100244cef3d6 37
hollegha2 2:100244cef3d6 38 // bezogen auf Fsample 0..0.5
hollegha2 2:100244cef3d6 39 void SetFrequ(float aFrequ);
hollegha2 2:100244cef3d6 40
hollegha2 2:100244cef3d6 41 // Einen Abtastwert berechnen
hollegha2 2:100244cef3d6 42 void CalcOneStep();
hollegha2 2:100244cef3d6 43 };
hollegha2 2:100244cef3d6 44
Lenschinki 3:c8c3b755ef54 45 class SinusGen
Lenschinki 3:c8c3b755ef54 46 {
Lenschinki 3:c8c3b755ef54 47 public:
Lenschinki 3:c8c3b755ef54 48 float val; // momentaner Ausgangswert
Lenschinki 3:c8c3b755ef54 49 private:
Lenschinki 3:c8c3b755ef54 50 float sinWave[1000];
Lenschinki 3:c8c3b755ef54 51 float _inc;
Lenschinki 3:c8c3b755ef54 52 float entry;
Lenschinki 3:c8c3b755ef54 53 public:
Lenschinki 3:c8c3b755ef54 54 SinusGen();
Lenschinki 3:c8c3b755ef54 55
Lenschinki 3:c8c3b755ef54 56 void SetFrequ(float aFrequ);
Lenschinki 3:c8c3b755ef54 57
Lenschinki 3:c8c3b755ef54 58 void CalcOneStep();
Lenschinki 3:c8c3b755ef54 59 };
Lenschinki 3:c8c3b755ef54 60
hollegha2 2:100244cef3d6 61
hollegha2 2:100244cef3d6 62 class RectGen
hollegha2 2:100244cef3d6 63 {
hollegha2 2:100244cef3d6 64 public:
hollegha2 2:100244cef3d6 65 float val; // momentaner Ausgangswert
hollegha2 2:100244cef3d6 66 private:
hollegha2 2:100244cef3d6 67 float _inc;
hollegha2 2:100244cef3d6 68 float _phase;
Lenschinki 3:c8c3b755ef54 69 float _thres;
hollegha2 2:100244cef3d6 70 public:
hollegha2 2:100244cef3d6 71 RectGen();
hollegha2 2:100244cef3d6 72
hollegha2 2:100244cef3d6 73 void SetPointsPerPeriod(int aPoints);
hollegha2 2:100244cef3d6 74
hollegha2 2:100244cef3d6 75 void SetFrequ(float aFrequ);
hollegha2 2:100244cef3d6 76
hollegha2 2:100244cef3d6 77 // Dauer des ON-Pulses in Prozent ( 0..1 )
hollegha2 2:100244cef3d6 78 void SetPulsWidth(float aPercent);
hollegha2 2:100244cef3d6 79
hollegha2 2:100244cef3d6 80 // Einen Abtastwert berechnen
hollegha2 2:100244cef3d6 81 void CalcOneStep();
hollegha2 2:100244cef3d6 82 };
hollegha2 2:100244cef3d6 83
hollegha2 2:100244cef3d6 84 #endif
hollegha2 2:100244cef3d6 85
hollegha2 2:100244cef3d6 86
hollegha2 2:100244cef3d6 87