Func-Gen - basic setup

Dependencies:   mbed

Revision:
3:9fd12684fa88
Parent:
2:3abf5ddd9fc0
--- a/FuncGenFSST_21.cpp	Tue Mar 23 17:06:24 2021 +0000
+++ b/FuncGenFSST_21.cpp	Tue Mar 23 17:13:12 2021 +0000
@@ -1,14 +1,25 @@
 
 #include "FuncGenFSST.h"
 
-
-
+SignedRampGen::SignedRampGen()
+{
+    val=0;
+    SetPointsPerPeriod(20);
+}
 
-
-
+void SignedRampGen::SetPointsPerPeriod(float aPoints)
+{
+  _inc = 2.0/aPoints;
+}
 
-
-
+void SignedRampGen::SetFrequ(float aFrequ)
+{
+  SetPointsPerPeriod(1.0/aFrequ);
+}
 
-
-
+void SignedRampGen::CalcOneStep()
+{
+  val = val + _inc;
+  if( val>1.0 )
+    val = -1 + (val - 1.0); 
+}
\ No newline at end of file