| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

LTC4155_formats.h
Go to the documentation of this file.
1 /*!
2 LTC4155: Dual-Input Power Manager / 3.5A Li-Ion Battery Charger with I²C Control and USB OTG
3
4 @verbatim
5 The LTC®4155 is a 15 watt I²C controlled power manager with PowerPath™ instant-
6 on operation, high efficiency switching battery charging and USB compatibility.
7 The LTC4155 seamlessly manages power distribution from two 5V sources, such as a
8 USB port and a wall adapter, to a single-cell rechargeable Lithium-Ion/Polymer
9 battery and a system load.
10 @endverbatim
11
12 http://www.linear.com/product/LTC4155
13
14 http://www.linear.com/product/LTC4155#demoboards
15
16
17 Copyright 2018(c) Analog Devices, Inc.
18
19 All rights reserved.
20
21 Redistribution and use in source and binary forms, with or without
22 modification, are permitted provided that the following conditions are met:
23 - Redistributions of source code must retain the above copyright
24 notice, this list of conditions and the following disclaimer.
25 - Redistributions in binary form must reproduce the above copyright
26 notice, this list of conditions and the following disclaimer in
27 the documentation and/or other materials provided with the
28 distribution.
29 - Neither the name of Analog Devices, Inc. nor the names of its
30 contributors may be used to endorse or promote products derived
31 from this software without specific prior written permission.
32 - The use of this software may or may not infringe the patent rights
33 of one or more patent holders. This license does not release you
34 from the requirement that you obtain separate licenses from these
35 patent holders to use this software.
36 - Use of the software either in source or binary form, must be run
37 on or directly connected to an Analog Devices Inc. component.
38
39 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
40 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
41 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
42 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
43 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
44 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
45 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
46 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
47 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
48 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
49
50 Generated on: 2016-01-19
51 */
52
53
54 /*! @file
55 * @ingroup LTC4155
56 * @brief LTC4155 library file defining data conversion macros and constants used
57 * by LTC4155.c
58 *
59 *
60 * This file contains macros and constants which can be used to represent real-world
61 * values in the source code, with automatic compile-time conversion to LTC4155
62 * internal register scaling.
63 *
64 * Passing runtime variables to these macros should be avoided as it will likely result
65 * in runtime calculations accompanied by associated processor loading and memory usage.
66 */
67
68 #ifndef LTC4155_FORMATS_H_
69 #define LTC4155_FORMATS_H_
70
71 /*! @name Format Definitions
72 * Constants used by the macros below to convert from real world to LTC4155 referenced numbers.
73 */
74 /*! @name Constants used in real world conversion macros below
75 */
76 #define LTC4155_KSPAN 0.006162
77 #define LTC4155_KOFFSET 0.1127
78 #define LTC4155_RNTCBIAS 10000.0
79 #define LTC4155_RNTCSER 0.0
80 #define LTC4155_R150 302.36
81 #define LTC4155_R145 334.88
82 #define LTC4155_R140 371.77
83 #define LTC4155_R135 413.73
84 #define LTC4155_R130 461.60
85 #define LTC4155_R125 516.36
86 #define LTC4155_R120 579.17
87 #define LTC4155_R115 651.44
88 #define LTC4155_R110 734.86
89 #define LTC4155_R105 831.46
90 #define LTC4155_R100 943.67
91 #define LTC4155_R95 1074.48
92 #define LTC4155_R90 1227.51
93 #define LTC4155_R85 1407.18
94 #define LTC4155_R80 1618.94
95 #define LTC4155_R75 1869.50
96 #define LTC4155_R70 2167.17
97 #define LTC4155_R65 2522.30
98 #define LTC4155_R60 2947.82
99 #define LTC4155_R55 3459.99
100 #define LTC4155_R50 4079.35
101 #define LTC4155_R45 4831.94
102 #define LTC4155_R40 5751.02
103 #define LTC4155_R35 6879.27
104 #define LTC4155_R30 8271.77
105 #define LTC4155_R25 10000.00
106 #define LTC4155_R20 12157.35
107 #define LTC4155_R15 14866.53
108 #define LTC4155_R10 18289.86
109 #define LTC4155_R5 22643.44
110 #define LTC4155_R0 28217.00
111 #define LTC4155_Rm5 35401.63
112 #define LTC4155_Rm10 44729.13
113 #define LTC4155_Rm15 56927.91
114 #define LTC4155_Rm20 73003.30
115 #define LTC4155_Rm25 94353.48
116 #define LTC4155_Rm30 122938.33
117 #define LTC4155_Rm35 161527.01
118 #define LTC4155_Rm40 214063.67
119 /*! @name Use the macros below to convert from real world to LTC4155 referenced numbers.
120 */
121 /*! Convert from °C to the Thermistor ADC Reading. */
122 #define LTC4155_NTCS0402E3103FLT(x) (\
123 __LTC4155_BETWEEN_INCLUSIVE__((-40), (-35), x) ? __LTC4155_LINE__((-40), (-35), (((LTC4155_Rm40 + LTC4155_RNTCSER) / (LTC4155_Rm40 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_Rm35 + LTC4155_RNTCSER) / (LTC4155_Rm35 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
124 __LTC4155_BETWEEN_INCLUSIVE__((-35), (-30), x) ? __LTC4155_LINE__((-35), (-30), (((LTC4155_Rm35 + LTC4155_RNTCSER) / (LTC4155_Rm35 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_Rm30 + LTC4155_RNTCSER) / (LTC4155_Rm30 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
125 __LTC4155_BETWEEN_INCLUSIVE__((-30), (-25), x) ? __LTC4155_LINE__((-30), (-25), (((LTC4155_Rm30 + LTC4155_RNTCSER) / (LTC4155_Rm30 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_Rm25 + LTC4155_RNTCSER) / (LTC4155_Rm25 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
126 __LTC4155_BETWEEN_INCLUSIVE__((-25), (-20), x) ? __LTC4155_LINE__((-25), (-20), (((LTC4155_Rm25 + LTC4155_RNTCSER) / (LTC4155_Rm25 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_Rm20 + LTC4155_RNTCSER) / (LTC4155_Rm20 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
127 __LTC4155_BETWEEN_INCLUSIVE__((-20), (-15), x) ? __LTC4155_LINE__((-20), (-15), (((LTC4155_Rm20 + LTC4155_RNTCSER) / (LTC4155_Rm20 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_Rm15 + LTC4155_RNTCSER) / (LTC4155_Rm15 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
128 __LTC4155_BETWEEN_INCLUSIVE__((-15), (-10), x) ? __LTC4155_LINE__((-15), (-10), (((LTC4155_Rm15 + LTC4155_RNTCSER) / (LTC4155_Rm15 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_Rm10 + LTC4155_RNTCSER) / (LTC4155_Rm10 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
129 __LTC4155_BETWEEN_INCLUSIVE__((-10), (-5), x) ? __LTC4155_LINE__((-10), (-5), (((LTC4155_Rm10 + LTC4155_RNTCSER) / (LTC4155_Rm10 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_Rm5 + LTC4155_RNTCSER) / (LTC4155_Rm5 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
130 __LTC4155_BETWEEN_INCLUSIVE__((-5), (0), x) ? __LTC4155_LINE__((-5), (0), (((LTC4155_Rm5 + LTC4155_RNTCSER) / (LTC4155_Rm5 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_R0 + LTC4155_RNTCSER) / (LTC4155_R0 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
131 __LTC4155_BETWEEN_INCLUSIVE__((0), (5), x) ? __LTC4155_LINE__((0), (5), (((LTC4155_R0 + LTC4155_RNTCSER) / (LTC4155_R0 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_R5 + LTC4155_RNTCSER) / (LTC4155_R5 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
132 __LTC4155_BETWEEN_INCLUSIVE__((5), (10), x) ? __LTC4155_LINE__((5), (10), (((LTC4155_R5 + LTC4155_RNTCSER) / (LTC4155_R5 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_R10 + LTC4155_RNTCSER) / (LTC4155_R10 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
133 __LTC4155_BETWEEN_INCLUSIVE__((10), (15), x) ? __LTC4155_LINE__((10), (15), (((LTC4155_R10 + LTC4155_RNTCSER) / (LTC4155_R10 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_R15 + LTC4155_RNTCSER) / (LTC4155_R15 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
134 __LTC4155_BETWEEN_INCLUSIVE__((15), (20), x) ? __LTC4155_LINE__((15), (20), (((LTC4155_R15 + LTC4155_RNTCSER) / (LTC4155_R15 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_R20 + LTC4155_RNTCSER) / (LTC4155_R20 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
135 __LTC4155_BETWEEN_INCLUSIVE__((20), (25), x) ? __LTC4155_LINE__((20), (25), (((LTC4155_R20 + LTC4155_RNTCSER) / (LTC4155_R20 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_R25 + LTC4155_RNTCSER) / (LTC4155_R25 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
136 __LTC4155_BETWEEN_INCLUSIVE__((25), (30), x) ? __LTC4155_LINE__((25), (30), (((LTC4155_R25 + LTC4155_RNTCSER) / (LTC4155_R25 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_R30 + LTC4155_RNTCSER) / (LTC4155_R30 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
137 __LTC4155_BETWEEN_INCLUSIVE__((30), (35), x) ? __LTC4155_LINE__((30), (35), (((LTC4155_R30 + LTC4155_RNTCSER) / (LTC4155_R30 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_R35 + LTC4155_RNTCSER) / (LTC4155_R35 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
138 __LTC4155_BETWEEN_INCLUSIVE__((35), (40), x) ? __LTC4155_LINE__((35), (40), (((LTC4155_R35 + LTC4155_RNTCSER) / (LTC4155_R35 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_R40 + LTC4155_RNTCSER) / (LTC4155_R40 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
139 __LTC4155_BETWEEN_INCLUSIVE__((40), (45), x) ? __LTC4155_LINE__((40), (45), (((LTC4155_R40 + LTC4155_RNTCSER) / (LTC4155_R40 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_R45 + LTC4155_RNTCSER) / (LTC4155_R45 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
140 __LTC4155_BETWEEN_INCLUSIVE__((45), (50), x) ? __LTC4155_LINE__((45), (50), (((LTC4155_R45 + LTC4155_RNTCSER) / (LTC4155_R45 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_R50 + LTC4155_RNTCSER) / (LTC4155_R50 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
141 __LTC4155_BETWEEN_INCLUSIVE__((50), (55), x) ? __LTC4155_LINE__((50), (55), (((LTC4155_R50 + LTC4155_RNTCSER) / (LTC4155_R50 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_R55 + LTC4155_RNTCSER) / (LTC4155_R55 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
142 __LTC4155_BETWEEN_INCLUSIVE__((55), (60), x) ? __LTC4155_LINE__((55), (60), (((LTC4155_R55 + LTC4155_RNTCSER) / (LTC4155_R55 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_R60 + LTC4155_RNTCSER) / (LTC4155_R60 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
143 __LTC4155_BETWEEN_INCLUSIVE__((60), (65), x) ? __LTC4155_LINE__((60), (65), (((LTC4155_R60 + LTC4155_RNTCSER) / (LTC4155_R60 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_R65 + LTC4155_RNTCSER) / (LTC4155_R65 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
144 __LTC4155_BETWEEN_INCLUSIVE__((65), (70), x) ? __LTC4155_LINE__((65), (70), (((LTC4155_R65 + LTC4155_RNTCSER) / (LTC4155_R65 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_R70 + LTC4155_RNTCSER) / (LTC4155_R70 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
145 __LTC4155_BETWEEN_INCLUSIVE__((70), (75), x) ? __LTC4155_LINE__((70), (75), (((LTC4155_R70 + LTC4155_RNTCSER) / (LTC4155_R70 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_R75 + LTC4155_RNTCSER) / (LTC4155_R75 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
146 __LTC4155_BETWEEN_INCLUSIVE__((75), (80), x) ? __LTC4155_LINE__((75), (80), (((LTC4155_R75 + LTC4155_RNTCSER) / (LTC4155_R75 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_R80 + LTC4155_RNTCSER) / (LTC4155_R80 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
147 __LTC4155_BETWEEN_INCLUSIVE__((80), (85), x) ? __LTC4155_LINE__((80), (85), (((LTC4155_R80 + LTC4155_RNTCSER) / (LTC4155_R80 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_R85 + LTC4155_RNTCSER) / (LTC4155_R85 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
148 __LTC4155_BETWEEN_INCLUSIVE__((85), (90), x) ? __LTC4155_LINE__((85), (90), (((LTC4155_R85 + LTC4155_RNTCSER) / (LTC4155_R85 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_R90 + LTC4155_RNTCSER) / (LTC4155_R90 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
149 __LTC4155_BETWEEN_INCLUSIVE__((90), (95), x) ? __LTC4155_LINE__((90), (95), (((LTC4155_R90 + LTC4155_RNTCSER) / (LTC4155_R90 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_R95 + LTC4155_RNTCSER) / (LTC4155_R95 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
150 __LTC4155_BETWEEN_INCLUSIVE__((95), (100), x) ? __LTC4155_LINE__((95), (100), (((LTC4155_R95 + LTC4155_RNTCSER) / (LTC4155_R95 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_R100 + LTC4155_RNTCSER) / (LTC4155_R100 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
151 __LTC4155_BETWEEN_INCLUSIVE__((100), (105), x) ? __LTC4155_LINE__((100), (105), (((LTC4155_R100 + LTC4155_RNTCSER) / (LTC4155_R100 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_R105 + LTC4155_RNTCSER) / (LTC4155_R105 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
152 __LTC4155_BETWEEN_INCLUSIVE__((105), (110), x) ? __LTC4155_LINE__((105), (110), (((LTC4155_R105 + LTC4155_RNTCSER) / (LTC4155_R105 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_R110 + LTC4155_RNTCSER) / (LTC4155_R110 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
153 __LTC4155_BETWEEN_INCLUSIVE__((110), (115), x) ? __LTC4155_LINE__((110), (115), (((LTC4155_R110 + LTC4155_RNTCSER) / (LTC4155_R110 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_R115 + LTC4155_RNTCSER) / (LTC4155_R115 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
154 __LTC4155_BETWEEN_INCLUSIVE__((115), (120), x) ? __LTC4155_LINE__((115), (120), (((LTC4155_R115 + LTC4155_RNTCSER) / (LTC4155_R115 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_R120 + LTC4155_RNTCSER) / (LTC4155_R120 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
155 __LTC4155_BETWEEN_INCLUSIVE__((120), (125), x) ? __LTC4155_LINE__((120), (125), (((LTC4155_R120 + LTC4155_RNTCSER) / (LTC4155_R120 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_R125 + LTC4155_RNTCSER) / (LTC4155_R125 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
156 __LTC4155_BETWEEN_INCLUSIVE__((125), (130), x) ? __LTC4155_LINE__((125), (130), (((LTC4155_R125 + LTC4155_RNTCSER) / (LTC4155_R125 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_R130 + LTC4155_RNTCSER) / (LTC4155_R130 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
157 __LTC4155_BETWEEN_INCLUSIVE__((130), (135), x) ? __LTC4155_LINE__((130), (135), (((LTC4155_R130 + LTC4155_RNTCSER) / (LTC4155_R130 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_R135 + LTC4155_RNTCSER) / (LTC4155_R135 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
158 __LTC4155_BETWEEN_INCLUSIVE__((135), (140), x) ? __LTC4155_LINE__((135), (140), (((LTC4155_R135 + LTC4155_RNTCSER) / (LTC4155_R135 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_R140 + LTC4155_RNTCSER) / (LTC4155_R140 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
159 __LTC4155_BETWEEN_INCLUSIVE__((140), (145), x) ? __LTC4155_LINE__((140), (145), (((LTC4155_R140 + LTC4155_RNTCSER) / (LTC4155_R140 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_R145 + LTC4155_RNTCSER) / (LTC4155_R145 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : \
160 __LTC4155_BETWEEN_INCLUSIVE__((145), (150), x) ? __LTC4155_LINE__((145), (150), (((LTC4155_R145 + LTC4155_RNTCSER) / (LTC4155_R145 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), (((LTC4155_R150 + LTC4155_RNTCSER) / (LTC4155_R150 + LTC4155_RNTCSER + LTC4155_RNTCBIAS) - LTC4155_KOFFSET) / LTC4155_KSPAN), x) : -1)
161 /*! NTC ADC format. Refer to datasheet to convert to voltage/temperature. */
162 #define LTC4155_ADC(x) __LTC4155_LINE__((LTC4155_KOFFSET), (LTC4155_KOFFSET + 1/LTC4155_KSPAN), (0), (1), x)
163 /*! @name Private macros for use by formats above.
164 */
165 #define __LTC4155_LINE__(x0,x1,y0,y1,x) (uint8_t)((y0) + ((y1) - (y0))/((x1) - (x0)) * ((x) - (x0)) + 0.5)
166 #define __LTC4155_BETWEEN_INCLUSIVE__(x0,x1,x) (((x) > (x0) && (x) < (x1)) || (x) == (x0) || (x) == (x1) ? 1 : 0)
167
168
169 #endif /* LTC4155_FORMATS_H_ */