56 #include <avr/pgmspace.h> 65 #define FILE_TEXT_LINE_MAX 132 67 #define LTC2977_I2C_ADDRESS_A 0x30 68 #define LTC2977_I2C_ADDRESS_B 0x32 96 uint8_t *addresses = NULL;
102 if (Serial.available())
104 while ((user_command =
read_int()) == 0);
105 if (user_command !=
'm')
106 Serial.println(user_command);
111 switch (user_command)
119 Serial.println(F(
"LTC2980 A Fault Log"));
124 faultLog2977_a->
print(&Serial);
129 Serial.println(F(
"No LTC2980 A Fault Log"));
131 if (status_b & LTC2977_SFL_EEPROM)
133 Serial.println(F(
"LTC2980 B Fault Log"));
138 faultLog2977_b->
print(&Serial);
143 Serial.println(F(
"No LTC2980 B Fault Log"));
181 addresses = smbus->
probe(0);
182 while (*addresses != 0)
184 Serial.print(F(
"ADDR 0x"));
185 Serial.println(*addresses++, HEX);
198 Serial.println(F(
"Incorrect Option"));
211 Serial.print(F(
"\n***************************************************************\n"));
212 Serial.print(F(
"* LTC2980 Fault Log Program *\n"));
213 Serial.print(F(
"* *\n"));
214 Serial.print(F(
"* This program dumps fault logs *\n"));
215 Serial.print(F(
"* *\n"));
216 Serial.print(F(
"* Set the baud rate to 115200 and select the newline terminator.*\n"));
217 Serial.print(F(
"* *\n"));
218 Serial.print(F(
"*****************************************************************\n"));
225 Serial.print(F(
"\n 1-Dump Fault Logs\n"));
226 Serial.print(F(
" 2-Clear Fault Logs\n"));
227 Serial.print(F(
" 3-Clear Faults\n"));
228 Serial.print(F(
" 4-PEC On\n"));
229 Serial.print(F(
" 5-PEC Off\n"));
230 Serial.print(F(
" 6-Bus Probe\n"));
231 Serial.print(F(
" 7-Reset\n"));
232 Serial.print(F(
" 8-Store Fault Log\n"));
233 Serial.print(F(
"\nEnter a command:"));
static void loop()
Repeats Linduino loop.
class that handles LTC2977 fault logs.
unsigned char user_command
static void print_prompt()
Prints main menu.
LTC SMBus Support: Implementation for a shared SMBus layer.
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.
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.
#define LTC2977_I2C_ADDRESS_B
void disablePec(uint8_t address)
Disable pec for all transactions.
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.
#define LTC2977_I2C_ADDRESS_A
static uint8_t ltc2977_i2c_address_a
void resetGlobal(void)
Issue reset to all devices.
static uint8_t ltc2977_i2c_address_b
#define MFR_FAULT_LOG_STORE
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.
static void print_title()
Prints the title block when program first starts.
void clearFaultLog(uint8_t address)
void release()
Frees the memory reserved for the fault log.
void restoreFromNvmGlobal(void)
Restore all devices from NVM.
static LT_2977FaultLog * faultLog2977_a
static LT_2977FaultLog * faultLog2977_b