AM263x Digital Power SDK
09.01.00
emavg.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2024 Texas Instruments Incorporated
3
*
4
* Redistribution and use in source and binary forms, with or without
5
* modification, are permitted provided that the following conditions
6
* are met:
7
*
8
* Redistributions of source code must retain the above copyright
9
* notice, this list of conditions and the following disclaimer.
10
*
11
* Redistributions in binary form must reproduce the above copyright
12
* notice, this list of conditions and the following disclaimer in the
13
* documentation and/or other materials provided with the
14
* distribution.
15
*
16
* Neither the name of Texas Instruments Incorporated nor the names of
17
* its contributors may be used to endorse or promote products derived
18
* from this software without specific prior written permission.
19
*
20
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
*/
32
//#############################################################################
33
//
34
// FILE: emavg.h
35
//
36
// TITLE: Contains the public interface to the Exponential Moving
37
// Average (EMAVG)
38
//
39
//#############################################################################
40
41
#ifndef EMAVG_H
42
#define EMAVG_H
43
44
#ifdef __cplusplus
45
extern
"C"
{
46
#endif
47
59
//
60
// Included Files
61
//
62
//
63
// Included Files
64
//
65
#include <stdint.h>
66
#include <math.h>
67
68
//#############################################################################
69
//
70
// Macro Definitions
71
//
72
//#############################################################################
73
#ifndef IEEE754_TYPES
74
#define IEEE754_TYPES
75
76
typedef
float
float32_t
;
77
typedef
double
float64_t
;
78
79
#endif // IEEE754_TYPES
80
//
81
// Typedefs
82
//
83
89
typedef
struct
{
90
float32_t
out
;
91
float32_t
multiplier
;
92
}
EMAVG
;
93
97
static
inline
void
EMAVG_reset
(
EMAVG
*v)
98
{
99
v->
out
= 0;
100
}
101
106
static
inline
void
EMAVG_config
(
EMAVG
*v,
107
float32_t
multiplier)
108
{
109
v->
multiplier
= multiplier;
110
}
111
116
static
inline
void
EMAVG_run
(
EMAVG
*v,
float
in)
117
{
118
v->
out
= ((in - v->
out
)*v->
multiplier
) + v->
out
;
119
}
120
121
// Close the Doxygen group.
124
#ifdef __cplusplus
125
}
126
#endif // extern "C"
127
128
#endif // end of _EMAVG_H_ definition
129
130
//
131
// End of File
132
//
133
EMAVG_reset
static void EMAVG_reset(EMAVG *v)
resets internal storage data
Definition:
emavg.h:97
EMAVG_run
static void EMAVG_run(EMAVG *v, float in)
Run EMAVG module.
Definition:
emavg.h:116
EMAVG_config
static void EMAVG_config(EMAVG *v, float32_t multiplier)
configures EMAVG module
Definition:
emavg.h:106
EMAVG::multiplier
float32_t multiplier
Definition:
emavg.h:91
EMAVG
Defines the Exponential Moving Average (EMAVG) structure.
Definition:
emavg.h:89
EMAVG::out
float32_t out
Definition:
emavg.h:90
float64_t
double float64_t
Definition:
emavg.h:77
float32_t
float float32_t
Definition:
emavg.h:76
float32_t
float float32_t
Defines single,double precision data type. Note: Assumes ABI to be TI_EABI, does not support legacy T...
Definition:
dcl_common.h:54
source
utilities
emavg.h
generated by
1.8.20