55 #include <avr/pgmspace.h> 64 #define FILE_TEXT_LINE_MAX 132 66 #define LTC2974_I2C_ADDRESS 0x32 91 uint8_t *addresses = NULL;
95 if (Serial.available())
97 while ((user_command =
read_int()) == 0);
98 if (user_command !=
'm')
99 Serial.println(user_command);
103 switch (user_command)
114 faultLog2974->
print(&Serial);
119 Serial.println(F(
"No LTC2974 Fault Log"));
149 addresses = smbus->
probe(0);
150 while (*addresses != 0)
152 Serial.print(F(
"ADDR 0x"));
153 Serial.println(*addresses++, HEX);
165 Serial.println(F(
"Incorrect Option"));
178 Serial.print(F(
"\n***************************************************************\n"));
179 Serial.print(F(
"* LTC2974 Fault Log Program *\n"));
180 Serial.print(F(
"* *\n"));
181 Serial.print(F(
"* This program dumps fault logs *\n"));
182 Serial.print(F(
"* *\n"));
183 Serial.print(F(
"* Set the baud rate to 115200 and select the newline terminator.*\n"));
184 Serial.print(F(
"* *\n"));
185 Serial.print(F(
"*****************************************************************\n"));
192 Serial.print(F(
"\n 1-Dump Fault Logs\n"));
193 Serial.print(F(
" 2-Clear Fault Logs\n"));
194 Serial.print(F(
" 3-Clear Faults\n"));
195 Serial.print(F(
" 4-PEC On\n"));
196 Serial.print(F(
" 5-PEC Off\n"));
197 Serial.print(F(
" 6-Bus Probe\n"));
198 Serial.print(F(
" 7-Reset\n"));
199 Serial.print(F(
" 8-Store Fault Log\n"));
200 Serial.print(F(
"\nEnter a command:"));
#define LTC2974_SFL_EEPROM
class that handles LTC2974 fault logs.
unsigned char user_command
static uint8_t ltc2974_i2c_address
static void setup()
Initialize Linduino.
LTC SMBus Support: Implementation for a shared SMBus layer.
String status(void)
Returns a descriptive string based on status of pins.
void dumpBinary(Print *printer=0)
Dumps binary of the fault log to a Print inheriting object, or Serial if none specified.
Header File for Linduino Libraries and Demo Code.
virtual void sendByte(uint8_t address, uint8_t command)=0
SMBus send byte command.
void enablePec(uint8_t address)
Enable pec for all transactions.
void disablePec(uint8_t address)
Disable pec for all transactions.
TwoWire.h - TWI/I2C library for Arduino & Wiring Copyright (c) 2006 Nicholas Zambetti.
void resetGlobal(void)
Issue reset to all devices.
#define MFR_FAULT_LOG_STORE
static void print_title()
Prints the title block when program first starts.
void release()
Frees the memory reserved for the fault log.
void read(uint8_t address)
Reads the fault log from the specified address, reserves memory to hold the data. ...
void clearAllFaults(uint8_t address)
Clear all the faults for all pages.
virtual uint8_t * probe(uint8_t command)=0
SMBus bus probe.
static void print_prompt()
Prints main menu.
uint8_t readMfrFaultLogStatusByte(uint8_t address)
Get the fault log status byte.
void print(Print *printer=0)
Pretty prints this part's fault log to a Print inheriting object, or Serial if none specified...
LTC SMBus Support: Implementation for a shared SMBus layer.
static LT_2974FaultLog * faultLog2974
static void loop()
Repeats Linduino loop.
LTC SMBus Support: Implementation for a LTC2974 Fault Log.
void clearFaultLog(uint8_t address)
void restoreFromNvmGlobal(void)
Restore all devices from NVM.
#define LTC2974_I2C_ADDRESS
LT_2974FaultLog(LT_PMBus *pmbus)
Constructor.