Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board
LTC6115.h
Go to the documentation of this file.
1 /*!
2 LTC6115 High Voltage High Side Current and Voltage Sense
3 
4 @verbatim
5 
6 The LTC6115 is a versatile combination of a high voltage, high side current
7 sense amplifier and a voltage sense amplifier.
8 
9 @endverbatim
10 
11 https://www.analog.com/en/products/ltc6115.html
12 
13 
14 Copyright 2018(c) Analog Devices, Inc.
15 
16 All rights reserved.
17 
18 Redistribution and use in source and binary forms, with or without
19 modification, are permitted provided that the following conditions are met:
20  - Redistributions of source code must retain the above copyright
21  notice, this list of conditions and the following disclaimer.
22  - Redistributions in binary form must reproduce the above copyright
23  notice, this list of conditions and the following disclaimer in
24  the documentation and/or other materials provided with the
25  distribution.
26  - Neither the name of Analog Devices, Inc. nor the names of its
27  contributors may be used to endorse or promote products derived
28  from this software without specific prior written permission.
29  - The use of this software may or may not infringe the patent rights
30  of one or more patent holders. This license does not release you
31  from the requirement that you obtain separate licenses from these
32  patent holders to use this software.
33  - Use of the software either in source or binary form, must be run
34  on or directly connected to an Analog Devices Inc. component.
35 
36 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
37 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
38 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
39 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
40 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
42 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
43 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
44 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
45 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46 
47 The views and conclusions contained in the software and documentation are those
48 of the authors and should not be interpreted as representing official policies,
49 either expressed or implied, of Analog Devices Inc.
50 
51 The Analog Devices Linduino is not affiliated with the official Arduino team.
52 However, the Linduino is only possible because of the Arduino team's commitment
53 to the open-source community. Please, visit http://www.arduino.cc and
54 http://store.arduino.cc , and consider a purchase that will help fund their
55 ongoing work.
56 
57 Copyright 2018 Analog Devices Inc. (ADI)
58 
59 */
60 
61 /*! @file
62  @ingroup LTC6115
63  Header for LTC6115: High-V High Side Current and Voltage Sense.
64 */
65 
66 #ifndef LTC6115_H
67 #define LTC6115_H
68 
69 #define NUMBITS 10 // Default of Linduino AtMega
70 #define MAXADCVAL 1023 // ((2^NUMBITS) - 1)
71 #define AREF float(5) // ADC reference voltage, default to +5V on Linduino
72 
73 /*!
74  Pin Mapping
75 */
76 #define LTC6115_VIN 3 //!< Maps to DC2026 J7.4, ADC channel 4
77 #define LTC6115_IIN 0 //!< Maps to DC2026 J7.1, ADC channel 1
78 
79 /*!
80  |Function Declarations|
81 */
82 
83 //! This function will initialize 6115 variables.
84 //! @return void
85 void LTC6115_initialize();
86 
87 //! This function converts ADC code to Voltage.
88 //! @return float
89 float LTC6115ConvertToVolts(uint32_t val //!< The ADC code value to convert to Voltage
90  );
91 
92 //! This function converts ADC code to Current.
93 //! @return float
94 float LTC6115ConvertToAmps(uint32_t val //!< The ADC code value to convert to Current
95  );
96 
97 //! This function changes the Voltage gain.
98 //! @return void
99 void LTC6115ChangeVGain(float val //!< The value to change the Voltage gain to
100  );
101 
102 //! This function changes the Current gain.
103 //! @return float
104 void LTC6115ChangeIGain(float val //!< The value to change the Current gain to
105  );
106 //! This function converts ADC code to Voltage without the converted voltage print statement.
107 //! @return float
108 float LTC6115ToVolts(uint32_t val);
109 
110 //! This function converts ADC code to Current without the converted current print statement.
111 //! @return float
112 float LTC6115ToAmps(uint32_t val);
113 
114 //! This function converts milliseconds to frequency (Hz).
115 //! @return uint32_t
116 uint32_t millsToHz(uint32_t val //!< The milliseconds to convert to Hz
117  );
118 
119 //! This function returns the voltage gain (V/V).
120 //! @return float
121 float getVGain();
122 
123 //! This function returns the current gain (V/A).
124 //! @return float
125 float getIGain();
126 
127 
128 #endif
float LTC6115ToVolts(uint32_t val)
This function converts ADC code to Voltage without the converted voltage print statement.
Definition: LTC6115.cpp:128
float LTC6115ConvertToVolts(uint32_t val)
This function converts ADC code to Voltage.
Definition: LTC6115.cpp:118
float getVGain()
This function returns the voltage gain (V/V).
Definition: LTC6115.cpp:100
float LTC6115ToAmps(uint32_t val)
This function converts ADC code to Current without the converted current print statement.
Definition: LTC6115.cpp:146
void LTC6115ChangeVGain(float val)
This function changes the Voltage gain.
Definition: LTC6115.cpp:155
void LTC6115_initialize()
|Function Declarations|
Definition: LTC6115.cpp:92
float getIGain()
This function returns the current gain (V/A).
Definition: LTC6115.cpp:109
void LTC6115ChangeIGain(float val)
This function changes the Current gain.
Definition: LTC6115.cpp:162
float LTC6115ConvertToAmps(uint32_t val)
This function converts ADC code to Current.
Definition: LTC6115.cpp:137
uint32_t millsToHz(uint32_t val)
This function converts milliseconds to frequency (Hz).
Definition: LTC6115.cpp:169