Stefan Kiegerl
/
FuncGen17
Func-Gen - basic setup
FuncGenFSST_21.cpp@3:9fd12684fa88, 2021-03-23 (annotated)
- Committer:
- stkiegerl
- Date:
- Tue Mar 23 17:13:12 2021 +0000
- Revision:
- 3:9fd12684fa88
- Parent:
- 2:3abf5ddd9fc0
-
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hollegha3 | 2:3abf5ddd9fc0 | 1 | |
hollegha3 | 2:3abf5ddd9fc0 | 2 | #include "FuncGenFSST.h" |
hollegha3 | 2:3abf5ddd9fc0 | 3 | |
stkiegerl | 3:9fd12684fa88 | 4 | SignedRampGen::SignedRampGen() |
stkiegerl | 3:9fd12684fa88 | 5 | { |
stkiegerl | 3:9fd12684fa88 | 6 | val=0; |
stkiegerl | 3:9fd12684fa88 | 7 | SetPointsPerPeriod(20); |
stkiegerl | 3:9fd12684fa88 | 8 | } |
hollegha3 | 2:3abf5ddd9fc0 | 9 | |
stkiegerl | 3:9fd12684fa88 | 10 | void SignedRampGen::SetPointsPerPeriod(float aPoints) |
stkiegerl | 3:9fd12684fa88 | 11 | { |
stkiegerl | 3:9fd12684fa88 | 12 | _inc = 2.0/aPoints; |
stkiegerl | 3:9fd12684fa88 | 13 | } |
hollegha3 | 2:3abf5ddd9fc0 | 14 | |
stkiegerl | 3:9fd12684fa88 | 15 | void SignedRampGen::SetFrequ(float aFrequ) |
stkiegerl | 3:9fd12684fa88 | 16 | { |
stkiegerl | 3:9fd12684fa88 | 17 | SetPointsPerPeriod(1.0/aFrequ); |
stkiegerl | 3:9fd12684fa88 | 18 | } |
hollegha3 | 2:3abf5ddd9fc0 | 19 | |
stkiegerl | 3:9fd12684fa88 | 20 | void SignedRampGen::CalcOneStep() |
stkiegerl | 3:9fd12684fa88 | 21 | { |
stkiegerl | 3:9fd12684fa88 | 22 | val = val + _inc; |
stkiegerl | 3:9fd12684fa88 | 23 | if( val>1.0 ) |
stkiegerl | 3:9fd12684fa88 | 24 | val = -1 + (val - 1.0); |
stkiegerl | 3:9fd12684fa88 | 25 | } |