This is a C library for generating signals :
- Sinus
- Triangle
- Ramp
- Square
- Sawtooth
| Parameters | Range | Type | Sinus | Triangle | Ramp | Square | Sawtooth |
|---|---|---|---|---|---|---|---|
| Offset | F | X | X | X | X | X | |
| Amplitude | F | X | X | X | X | ||
| Frequency | F | X | X | X | X | ||
| Sampling Frequency | Int | X | X | X | X | X | |
| Phase | 0-2π | F | X | X | X | X | |
| Damping Factor | F | X | X | X | X | ||
| Slope | F | X | |||||
| Duty Cycle | 0-100 | F | X |
Definition :
Damping Factor : It is a coefficient to raw value of each sample like Amplitude
DF in e^(-(DT*time))
Pass 1 which one you want :
#define INCLUDE_DAMPING 1
#define USE_DOUBLE 0
#define INCLUDE_AMPLITUDE 1
#define INCLUDE_OFFSET 1
#define INCLUDE_PHASE 1
#define INCLUDE_SINLOOKUPTABLE 1In this Library for calculating Sinus wave there are two ways:
- using
sinfunction inmath.h - using an array saving 100k samples of one cycle from sinus wave
In order to use second option enable #define INCLUDE_SINLOOKUPTABLE
For each Signals two functions provided : Init and OneSample
Init functions set signal's parameters and should be called at first
OneSample functions give one sample of signal and can be called consecutively
Two tests provided [both in main.c] :
- Generating the signals separately
- Generating the the signals together in order to the last sample of previous signal is the offset of next signal