C2000Ware Digital Power SDK
5.03.00.00
emavg.h
Go to the documentation of this file.
1
//#############################################################################
2
//
3
// FILE: emavg.h
4
//
5
// TITLE: Contains the public interface to the Exponential Moving
6
// Average (EMAVG)
7
//
8
//#############################################################################
9
// $TI Release: Utilities Library v1.02.00.00 $
10
// $Release Date: Mon Aug 12 12:17:45 CDT 2024 $
11
// $Copyright:
12
// Copyright (C) 2024 Texas Instruments Incorporated - https://www.ti.com/
13
//
14
// ALL RIGHTS RESERVED
15
// $
16
//#############################################################################
17
18
#ifndef EMAVG_H
19
#define EMAVG_H
20
21
#ifdef __cplusplus
22
extern
"C"
{
23
#endif
24
25
//*****************************************************************************
26
//
29
//
30
//*****************************************************************************
31
32
//
33
// Included Files
34
//
35
//
36
// Included Files
37
//
38
#include <stdint.h>
39
#ifndef __TMS320C28XX_CLA__
40
#include <math.h>
41
#else
42
#include <CLAmath.h>
43
#endif
44
45
//#############################################################################
46
//
47
// Macro Definitions
48
//
49
//#############################################################################
50
#ifndef C2000_IEEE754_TYPES
51
#define C2000_IEEE754_TYPES
52
#ifdef __TI_EABI__
53
typedef
float
float32_t
;
54
typedef
double
float64_t
;
55
#else // TI COFF
56
typedef
float
float32_t
;
57
typedef
long
double
float64_t
;
58
#endif // __TI_EABI__
59
#endif // C2000_IEEE754_TYPES
60
61
//
62
// Typedefs
63
//
64
70
typedef
struct
{
71
float32_t
out
;
72
float32_t
multiplier
;
73
}
EMAVG
;
74
78
static
inline
void
EMAVG_reset
(
EMAVG
*v)
79
{
80
v->
out
= 0;
81
}
82
87
static
inline
void
EMAVG_config
(
EMAVG
*v,
88
float32_t
multiplier)
89
{
90
v->
multiplier
= multiplier;
91
}
92
97
static
inline
void
EMAVG_run
(
EMAVG
*v,
float
in)
98
{
99
v->
out
= ((in - v->
out
)*v->
multiplier
) + v->
out
;
100
}
101
102
//*****************************************************************************
103
//
104
// Close the Doxygen group.
106
//
107
//*****************************************************************************
108
109
#ifdef __cplusplus
110
}
111
#endif // extern "C"
112
113
#endif // end of _EMAVG_H_ definition
114
115
//
116
// End of File
117
//
118
EMAVG_config
static void EMAVG_config(EMAVG *v, float32_t multiplier)
configures EMAVG module
Definition:
emavg.h:87
EMAVG_run
static void EMAVG_run(EMAVG *v, float in)
Run EMAVG module.
Definition:
emavg.h:97
float64_t
long double float64_t
Definition:
emavg.h:57
float32_t
float float32_t
Definition:
power_meas_sine_analyzer.h:54
EMAVG_reset
static void EMAVG_reset(EMAVG *v)
resets internal storage data
Definition:
emavg.h:78
float32_t
float float32_t
Definition:
emavg.h:56
EMAVG::multiplier
float32_t multiplier
Definition:
emavg.h:72
EMAVG
Defines the Exponential Moving Average (EMAVG) structure.
Definition:
emavg.h:70
EMAVG::out
float32_t out
Definition:
emavg.h:71
libraries
utilities
emavg
include
emavg.h
generated by
1.8.17