Stefan Kiegerl
/
FuncGen
Function Generator for TINF 2021
src/FuncGenFSST_21.cpp@1:dbd814e65f1d, 2021-03-18 (annotated)
- Committer:
- stkiegerl
- Date:
- Thu Mar 18 21:23:40 2021 +0100
- Revision:
- 1:dbd814e65f1d
- Parent:
- 0:464b401734fd
2nd version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
stkiegerl | 1:dbd814e65f1d | 1 | |
stkiegerl | 0:464b401734fd | 2 | #include "FuncGenFSST.h" |
stkiegerl | 1:dbd814e65f1d | 3 | |
stkiegerl | 1:dbd814e65f1d | 4 | SignedRampGen::SignedRampGen() |
stkiegerl | 1:dbd814e65f1d | 5 | { |
stkiegerl | 1:dbd814e65f1d | 6 | val=0; |
stkiegerl | 1:dbd814e65f1d | 7 | SetPointsPerPeriod(20); |
stkiegerl | 1:dbd814e65f1d | 8 | } |
stkiegerl | 1:dbd814e65f1d | 9 | |
stkiegerl | 1:dbd814e65f1d | 10 | void SignedRampGen::SetPointsPerPeriod(float aPoints) |
stkiegerl | 1:dbd814e65f1d | 11 | { |
stkiegerl | 1:dbd814e65f1d | 12 | _inc = 2.0/aPoints; |
stkiegerl | 1:dbd814e65f1d | 13 | } |
stkiegerl | 1:dbd814e65f1d | 14 | |
stkiegerl | 1:dbd814e65f1d | 15 | void SignedRampGen::SetFrequ(float aFrequ) |
stkiegerl | 1:dbd814e65f1d | 16 | { |
stkiegerl | 1:dbd814e65f1d | 17 | SetPointsPerPeriod(1.0/aFrequ); |
stkiegerl | 1:dbd814e65f1d | 18 | } |
stkiegerl | 1:dbd814e65f1d | 19 | |
stkiegerl | 1:dbd814e65f1d | 20 | void SignedRampGen::CalcOneStep() |
stkiegerl | 1:dbd814e65f1d | 21 | { |
stkiegerl | 1:dbd814e65f1d | 22 | val = val + _inc; |
stkiegerl | 1:dbd814e65f1d | 23 | if( val>1.0 ) |
stkiegerl | 1:dbd814e65f1d | 24 | val = -1 + (val - 1.0); |
stkiegerl | 1:dbd814e65f1d | 25 | } |
stkiegerl | 1:dbd814e65f1d | 26 | |
stkiegerl | 1:dbd814e65f1d | 27 | |
stkiegerl | 1:dbd814e65f1d | 28 | |
stkiegerl | 1:dbd814e65f1d | 29 | |
stkiegerl | 1:dbd814e65f1d | 30 | |
stkiegerl | 1:dbd814e65f1d | 31 | |
stkiegerl | 1:dbd814e65f1d | 32 | |
stkiegerl | 1:dbd814e65f1d | 33 | |
stkiegerl | 1:dbd814e65f1d | 34 |