lib
inertial-sense-sdk
hw-libs
misc
sig_gen.cpp
Go to the documentation of this file.
1
#include <math.h>
2
3
#include "
misc/sig_gen.h
"
4
5
#define PI 3.14159265358979
6
#define TWOPI 6.28318530717959
7
8
//static float g_freqHz, g_amplitude, g_periodSec, g_time;
9
10
11
//void init_sig_gen( float loopPeriodSec, float freqHz, float amplitude )
12
//{
13
//g_freqHz = freqHz;
14
//g_amplitude = amplitude;
15
//g_periodSec = loopPeriodSec;
16
//g_time = 0;
17
//}
18
19
20
float
step_sinwave
(
float
*sig_gen,
float
freqHz,
float
amplitude,
float
periodSec )
21
{
22
*sig_gen += freqHz * periodSec *
TWOPI
;
23
24
// Unwrap Angle
25
if
( *sig_gen >
PI
)
26
*sig_gen -=
TWOPI
;
27
28
return
amplitude * sinf( *sig_gen );
29
}
TWOPI
#define TWOPI
Definition:
sig_gen.cpp:6
sig_gen.h
PI
#define PI
Definition:
sig_gen.cpp:5
step_sinwave
float step_sinwave(float *sig_gen, float freqHz, float amplitude, float periodSec)
Initialize signal generator.
Definition:
sig_gen.cpp:20
inertial_sense_ros
Author(s):
autogenerated on Sat Sep 19 2020 03:19:05