Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board
LT_3882FaultLog.h
Go to the documentation of this file.
1 /*!
2 LTC SMBus Support: Implementation for a LTC3882 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_3882FaultLog
48  Library Header File for LT_3882FaultLog
49 */
50 
51 #ifndef LT_3882FaultLog_H_
52 #define LT_3882FaultLog_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 LTC3882 fault logs.
60 //! contains structs for interpreting the data read from the part.
62 {
63 
64  public:
65 #pragma pack(push, 1)
66 
67 
68  /********************************************************************
69  * LTC3882 types
70  ********************************************************************/
71 
73  {
74  public:
77 
80 
85  };
86 
88  {
89  public:
90  uint16_t lt;
91  uint16_t mfr_special_id;
92  uint8_t position_fault;
93  struct FaultLogTimeStamp shared_time;
95  };
96 
98  {
99  public:
100  struct Lin16WordReverse read_vout_p0;
101  struct Lin16WordReverse read_vout_p1;
102 
103  struct Lin5_11WordReverse read_iout_p0;
104  struct Lin5_11WordReverse read_iout_p1;
105 
106  struct Lin5_11WordReverse read_vin ;
107  struct Lin5_11WordReverse not_used;
108 
109  struct RawByte status_vout_p0;
110  struct RawByte status_vout_p1;
111 
112  struct RawWordReverse status_word_p0;
113  struct RawWordReverse status_word_p1;
114 
115  struct RawByte status_mfr_specificP0;
116  struct RawByte status_mfr_specificP1;
117  };
118 
120  {
121  public:
122  struct FaultLogPreambleLtc3882 preamble;
123  struct FaultLogReadLoopLtc3882 fault_log_loop[6];
124  };
125 
126 #pragma pack(pop)
127 
128  protected:
130 
131  public:
132  //! Constructor
133  LT_3882FaultLog(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 FaultLogLtc3882 *get()
157  {
158  return faultLog3882;
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_ */
void read(uint8_t address)
Reads the fault log from the specified address, reserves memory to hold the data. ...
void print(Print *printer=0)
Pretty prints this part&#39;s fault log to a Print inheriting object, or Serial if none specified...
class that handles LTC3882 fault logs.
LTC PMBus Support: Implementation for a LTC Controller Fault Log.
FaultLogLtc3882 * faultLog3882
static LT_PMBus * pmbus
Definition: DC2875A.ino:82
uint8_t * getBinary()
Get binary of the fault log or NULL if no log.
static uint8_t address
Definition: DC2091A.ino:83
uint16_t getBinarySize()
Get size of binary data.
void release()
Frees the memory reserved for the fault log.
LT_3882FaultLog(LT_PMBus *pmbus)
Constructor.
void dumpBinary(Print *printer=0)
Dumps binary of the fault log to a Print inheriting object, or Serial if none specified.
static int index
PMBus communication.
Definition: LT_PMBus.h:370