| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

LT_PMBusMath.h
Go to the documentation of this file.
1 /*!
2 LTC PMBus Support: Math conversion routines
3
4 @verbatim
5
6 This API is shared with Linduino and RTOS code.
7
8 @endverbatim
9
10
11 Copyright 2018(c) Analog Devices, Inc.
12
13 All rights reserved.
14
15 Redistribution and use in source and binary forms, with or without
16 modification, are permitted provided that the following conditions are met:
17 - Redistributions of source code must retain the above copyright
18 notice, this list of conditions and the following disclaimer.
19 - Redistributions in binary form must reproduce the above copyright
20 notice, this list of conditions and the following disclaimer in
21 the documentation and/or other materials provided with the
22 distribution.
23 - Neither the name of Analog Devices, Inc. nor the names of its
24 contributors may be used to endorse or promote products derived
25 from this software without specific prior written permission.
26 - The use of this software may or may not infringe the patent rights
27 of one or more patent holders. This license does not release you
28 from the requirement that you obtain separate licenses from these
29 patent holders to use this software.
30 - Use of the software either in source or binary form, must be run
31 on or directly connected to an Analog Devices Inc. component.
32
33 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
34 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
35 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
36 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
37 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
38 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
39 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
40 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
41 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
42 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43 */
44
45 /*! @file
46 @ingroup LT_PMBUS_MATH
47 Library Header File for LT_PMBusMath
48 */
49
50 #ifndef LT_PMBusMath_H_
51 #define LT_PMBusMath_H_
52
53 class LT_PMBusMath
54 {
55
56 public:
57
58 typedef unsigned long fl32_t; // Type for the bit representation of "float"
59 typedef unsigned int lin11_t; // Type for PMBus Linear11 mantissa
60 typedef unsigned int lin16_t; // Type for PMBus Linear16 mantissa
61 typedef unsigned int lin16m_t; // Type for PMBus Linear16 VOUT_MODE
62 typedef int slin11_t; // A signed type for PMBus Linear11 exponent
63 typedef unsigned char uchar_t; // Type for bit shifts
64
65 fl32_t lin11_to_fl32 (lin11_t xin);
66 fl32_t lin16_to_fl32 (lin16_t lin16_mant, lin16_t lin16_exp);
67 lin16_t fl32_to_lin16 (fl32_t xin, lin16_t lin16_exp);
68 lin11_t fl32_to_lin11 (fl32_t xin);
69
70 float lin11_to_float (lin11_t xin);
71 float lin16_to_float (lin16_t lin16_mant, lin16m_t vout_mode);
72 lin11_t float_to_lin11 (float xin);
73 lin16_t float_to_lin16 (float xin, lin16m_t vout_mode);
74
75 };
76
77 extern LT_PMBusMath math_;
78
79 #endif /* LT_PMBusMath_H_ */
LT_PMBusMath::float_to_lin16
lin16_t float_to_lin16(float xin, lin16m_t vout_mode)
Definition: LT_PMBusMath.cpp:451
LT_PMBusMath::lin16_to_float
float lin16_to_float(lin16_t lin16_mant, lin16m_t vout_mode)
Definition: LT_PMBusMath.cpp:435
LT_PMBusMath::lin11_t
unsigned int lin11_t
Definition: LT_PMBusMath.h:59
math_
LT_PMBusMath math_
Definition: LT_PMBusMath.cpp:460
LT_PMBusMath::fl32_to_lin16
lin16_t fl32_to_lin16(fl32_t xin, lin16_t lin16_exp)
Definition: LT_PMBusMath.cpp:257
LT_PMBusMath::lin11_to_float
float lin11_to_float(lin11_t xin)
Definition: LT_PMBusMath.cpp:427
LT_PMBusMath::uchar_t
unsigned char uchar_t
Definition: LT_PMBusMath.h:63
LT_PMBusMath::fl32_to_lin11
lin11_t fl32_to_lin11(fl32_t xin)
Definition: LT_PMBusMath.cpp:327
LT_PMBusMath::lin16_to_fl32
fl32_t lin16_to_fl32(lin16_t lin16_mant, lin16_t lin16_exp)
Definition: LT_PMBusMath.cpp:205
LT_PMBusMath::lin16m_t
unsigned int lin16m_t
Definition: LT_PMBusMath.h:61
LT_PMBusMath::slin11_t
int slin11_t
Definition: LT_PMBusMath.h:62
LT_PMBusMath::lin11_to_fl32
fl32_t lin11_to_fl32(lin11_t xin)
Definition: LT_PMBusMath.cpp:134
LT_PMBusMath
Definition: LT_PMBusMath.h:53
LT_PMBusMath::lin16_t
unsigned int lin16_t
Definition: LT_PMBusMath.h:60
LT_PMBusMath::float_to_lin11
lin11_t float_to_lin11(float xin)
Definition: LT_PMBusMath.cpp:443
LT_PMBusMath::fl32_t
unsigned long fl32_t
Definition: LT_PMBusMath.h:58