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