| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

LT_3883FaultLog.h
Go to the documentation of this file.
1 /*!
2 LTC SMBus Support: Implementation for a LTC3883 Fault Log
3
4 @verbatim
5
6 This API is shared with Linduino and RTOS code. End users should code to this
7 API to enable use of the PMBus code without modifications.
8
9 @endverbatim
10
11
12 Copyright 2018(c) Analog Devices, Inc.
13
14 All rights reserved.
15
16 Redistribution and use in source and binary forms, with or without
17 modification, are permitted provided that the following conditions are met:
18 - Redistributions of source code must retain the above copyright
19 notice, this list of conditions and the following disclaimer.
20 - Redistributions in binary form must reproduce the above copyright
21 notice, this list of conditions and the following disclaimer in
22 the documentation and/or other materials provided with the
23 distribution.
24 - Neither the name of Analog Devices, Inc. nor the names of its
25 contributors may be used to endorse or promote products derived
26 from this software without specific prior written permission.
27 - The use of this software may or may not infringe the patent rights
28 of one or more patent holders. This license does not release you
29 from the requirement that you obtain separate licenses from these
30 patent holders to use this software.
31 - Use of the software either in source or binary form, must be run
32 on or directly connected to an Analog Devices Inc. component.
33
34 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
35 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
36 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
37 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
38 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
39 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
40 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
41 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
42 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
43 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44 */
45
46 /*! @file
47 @ingroup LT_3883FaultLog
48 Library Header File for LT_3883FaultLog
49 */
50
51 #ifndef LT_3883FaultLog_H_
52 #define LT_3883FaultLog_H_
53
54 #include "../LT_PMBUS/LT_PMBus.h"
55 #include "../LT_PMBUS/LT_PMBusMath.h"
56 #include "LT_EEDataFaultLog.h"
57
58
59 //! class that handles LTC3883 fault logs.
60 //! contains structs for interpreting the data read from the part.
61 class LT_3883FaultLog : public LT_EEDataFaultLog
62 {
63
64 public:
65 #pragma pack(push, 1)
66
67
68 /********************************************************************
69 * LTC3883 types
70 ********************************************************************/
71
72 struct FaultLogTelemetrySummaryLtc3883
73 {
74 public:
75 struct Lin16WordReverse mfr_vout_peak_p0;
76 struct Lin16WordReverse not_used0;
77
78 struct Lin5_11WordReverse mfr_iout_peak_p0;
79 struct Lin5_11WordReverse mfr_iin_peak_p0;
80
81 struct Lin5_11WordReverse mfr_vin_peak;
82 struct Lin5_11WordReverse read_temperature_1_p0;
83 struct Lin5_11WordReverse not_used1;
84 struct Lin5_11WordReverse read_temperature_2;
85 struct Lin5_11WordReverse read_temperature_1_peak_p0;
86 struct Lin5_11WordReverse not_used2;
87 };
88
89 struct FaultLogPreambleLtc3883
90 {
91 public:
92 uint8_t position_fault;
93 struct FaultLogTimeStamp shared_time;
94 struct FaultLogTelemetrySummaryLtc3883 peaks;
95 };
96
97 struct FaultLogReadLoopLtc3883
98 {
99 public:
100 struct Lin16WordReverse read_vout_p0;
101 struct Lin16WordReverse not_used0;
102
103 struct Lin5_11WordReverse read_iout_p0;
104 struct Lin5_11WordReverse read_iin_chan_p1;
105
106 struct Lin5_11WordReverse read_vin ;
107 struct Lin5_11WordReverse read_iin;
108
109 struct RawByte status_vout_p0;
110 struct RawByte not_used1;
111
112 struct RawWordReverse status_word_p0;
113 struct RawWordReverse not_used2;
114
115 struct RawByte status_mfr_specificP0;
116 struct RawByte not_used3;
117 };
118
119 struct FaultLogLtc3883
120 {
121 public:
122 struct FaultLogPreambleLtc3883 preamble;
123 struct FaultLogReadLoopLtc3883 fault_log_loop[6];
124 };
125
126 #pragma pack(pop)
127
128 protected:
129 FaultLogLtc3883 *faultLog3883;
130
131 public:
132 //! Constructor
133 LT_3883FaultLog(LT_PMBus *pmbus //!< pmbus object reference for this fault log handler to use.
134 );
135
136 //! Pretty prints this part's fault log to a Print inheriting object, or Serial if none specified.
137 void print(Print *printer = 0 //!< Print inheriting object to print the fault log to.
138 );
139
140 //! Get binary of the fault log or NULL if no log
141 uint8_t *getBinary();
142
143 //! Get size of binary data
144 uint16_t getBinarySize();
145
146 //! Dumps binary of the fault log to a Print inheriting object, or Serial if none specified.
147 void dumpBinary(Print *printer = 0 //!< Print inheriting object to print the binary to.
148 );
149
150 //! Reads the fault log from the specified address, reserves memory to hold the data.
151 //! @return a reference to the data read from the part.
152 void read(uint8_t address //!< the address to read the fault log from.
153 );
154
155 // ! Get the fault log data
156 struct FaultLogLtc3883 *get()
157 {
158 return faultLog3883;
159 }
160
161 //! Frees the memory reserved for the fault log.
162 void release();
163
164 private:
165 char *buffer;
166
167 void printTitle(Print *);
168 void printTime(Print *);
169 void printPeaks(Print *);
170 void printAllLoops(Print *);
171 void printLoop(uint8_t index, Print *);
172
173 };
174
175 #endif /* LT_FaultLog_H_ */
LT_FaultLog::RawByte
Definition: LT_FaultLog.h:95
LT_FaultLog::Lin5_11WordReverse
Definition: LT_FaultLog.h:88
LT_3883FaultLog::FaultLogPreambleLtc3883
Definition: LT_3883FaultLog.h:89
LT_3883FaultLog::FaultLogTelemetrySummaryLtc3883::mfr_vout_peak_p0
struct Lin16WordReverse mfr_vout_peak_p0
Definition: LT_3883FaultLog.h:75
LT_3883FaultLog
class that handles LTC3883 fault logs.
Definition: LT_3883FaultLog.h:61
LT_EEDataFaultLog.h
LTC PMBus Support: Implementation for a LTC Controller Fault Log.
LT_3883FaultLog::FaultLogTelemetrySummaryLtc3883
Definition: LT_3883FaultLog.h:72
LT_3883FaultLog::FaultLogReadLoopLtc3883
Definition: LT_3883FaultLog.h:97
LT_3883FaultLog::read
void read(uint8_t address)
Reads the fault log from the specified address, reserves memory to hold the data. ...
Definition: LT_3883FaultLog.cpp:75
LT_3883FaultLog::getBinarySize
uint16_t getBinarySize()
Get size of binary data.
Definition: LT_3883FaultLog.cpp:102
LT_3883FaultLog::getBinary
uint8_t * getBinary()
Get binary of the fault log or NULL if no log.
Definition: LT_3883FaultLog.cpp:97
LT_3883FaultLog::FaultLogTelemetrySummaryLtc3883::not_used0
struct Lin16WordReverse not_used0
Definition: LT_3883FaultLog.h:76
LT_3883FaultLog::FaultLogTelemetrySummaryLtc3883::mfr_vin_peak
struct Lin5_11WordReverse mfr_vin_peak
Definition: LT_3883FaultLog.h:81
pmbus
static LT_PMBus * pmbus
Definition: DC2875A.ino:82
address
static uint8_t address
Definition: DC2091A.ino:83
LT_3883FaultLog::FaultLogTelemetrySummaryLtc3883::not_used2
struct Lin5_11WordReverse not_used2
Definition: LT_3883FaultLog.h:86
LT_3883FaultLog::print
void print(Print *printer=0)
Pretty prints this part&#39;s fault log to a Print inheriting object, or Serial if none specified...
Definition: LT_3883FaultLog.cpp:112
LT_3883FaultLog::FaultLogTelemetrySummaryLtc3883::mfr_iout_peak_p0
struct Lin5_11WordReverse mfr_iout_peak_p0
Definition: LT_3883FaultLog.h:78
LT_FaultLog::Lin16WordReverse
Definition: LT_FaultLog.h:74
LT_3883FaultLog::dumpBinary
void dumpBinary(Print *printer=0)
Dumps binary of the fault log to a Print inheriting object, or Serial if none specified.
Definition: LT_3883FaultLog.cpp:107
LT_3883FaultLog::FaultLogTelemetrySummaryLtc3883::read_temperature_2
struct Lin5_11WordReverse read_temperature_2
Definition: LT_3883FaultLog.h:84
LT_3883FaultLog::FaultLogPreambleLtc3883::position_fault
uint8_t position_fault
Definition: LT_3883FaultLog.h:92
LT_EEDataFaultLog
Definition: LT_EEDataFaultLog.h:56
LT_3883FaultLog::faultLog3883
FaultLogLtc3883 * faultLog3883
Definition: LT_3883FaultLog.h:129
LT_3883FaultLog::FaultLogTelemetrySummaryLtc3883::read_temperature_1_p0
struct Lin5_11WordReverse read_temperature_1_p0
Definition: LT_3883FaultLog.h:82
index
static int index
Definition: device_logger.ino:91
LT_FaultLog::RawWordReverse
Definition: LT_FaultLog.h:108
LT_3883FaultLog::release
void release()
Frees the memory reserved for the fault log.
Definition: LT_3883FaultLog.cpp:91
LT_3883FaultLog::FaultLogTelemetrySummaryLtc3883::not_used1
struct Lin5_11WordReverse not_used1
Definition: LT_3883FaultLog.h:83
LT_3883FaultLog::FaultLogTelemetrySummaryLtc3883::read_temperature_1_peak_p0
struct Lin5_11WordReverse read_temperature_1_peak_p0
Definition: LT_3883FaultLog.h:85
LT_3883FaultLog::FaultLogTelemetrySummaryLtc3883::mfr_iin_peak_p0
struct Lin5_11WordReverse mfr_iin_peak_p0
Definition: LT_3883FaultLog.h:79
LT_3883FaultLog::LT_3883FaultLog
LT_3883FaultLog(LT_PMBus *pmbus)
Constructor.
Definition: LT_3883FaultLog.cpp:61
LT_PMBus
PMBus communication.
Definition: LT_PMBus.h:370
LT_3883FaultLog::FaultLogLtc3883
Definition: LT_3883FaultLog.h:119