53 #include <avr/pgmspace.h> 62 #define FILE_TEXT_LINE_MAX 132 64 #define LTC2977_I2C_ADDRESS_A 0x30 65 #define LTC2977_I2C_ADDRESS_B 0x32 93 uint8_t *addresses = NULL;
99 if (Serial.available())
101 while ((user_command =
read_int()) == 0);
102 if (user_command !=
'm')
103 Serial.println(user_command);
108 switch (user_command)
116 Serial.println(F(
"LTM2987 A Fault Log"));
121 faultLog2977_a->
print(&Serial);
126 Serial.println(F(
"No LTM2987 A Fault Log"));
128 if (status_b & LTC2977_SFL_EEPROM)
130 Serial.println(F(
"LTM2987 B Fault Log"));
135 faultLog2977_b->
print(&Serial);
140 Serial.println(F(
"No LTM2987 B Fault Log"));
178 addresses = smbus->
probe(0);
179 while (*addresses != 0)
181 Serial.print(F(
"ADDR 0x"));
182 Serial.println(*addresses++, HEX);
195 Serial.println(F(
"Incorrect Option"));
208 Serial.print(F(
"\n***************************************************************\n"));
209 Serial.print(F(
"* LTC2987 Fault Log Program *\n"));
210 Serial.print(F(
"* *\n"));
211 Serial.print(F(
"* This program dumps fault logs *\n"));
212 Serial.print(F(
"* *\n"));
213 Serial.print(F(
"* Set the baud rate to 115200 and select the newline terminator.*\n"));
214 Serial.print(F(
"* *\n"));
215 Serial.print(F(
"*****************************************************************\n"));
222 Serial.print(F(
"\n 1-Dump Fault Logs\n"));
223 Serial.print(F(
" 2-Clear Fault Logs\n"));
224 Serial.print(F(
" 3-Clear Faults\n"));
225 Serial.print(F(
" 4-PEC On\n"));
226 Serial.print(F(
" 5-PEC Off\n"));
227 Serial.print(F(
" 6-Bus Probe\n"));
228 Serial.print(F(
" 7-Reset\n"));
229 Serial.print(F(
" 8-Store Fault Log\n"));
230 Serial.print(F(
"\nEnter a command:"));
class that handles LTC2977 fault logs.
unsigned char user_command
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.
void disablePec(uint8_t address)
Disable pec for all transactions.
static void print_title()
Prints the title block when program first starts.
static LT_2977FaultLog * faultLog2977_a
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 LT_2977FaultLog * faultLog2977_b
void resetGlobal(void)
Issue reset to all devices.
static void loop()
Repeats Linduino loop.
#define MFR_FAULT_LOG_STORE
static void print_prompt()
Prints main menu.
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 setup()
Initialize Linduino.
#define LTC2977_I2C_ADDRESS_B
void clearFaultLog(uint8_t address)
void release()
Frees the memory reserved for the fault log.
void restoreFromNvmGlobal(void)
Restore all devices from NVM.
static uint8_t ltc2977_i2c_address_a
#define LTC2977_I2C_ADDRESS_A
static uint8_t ltc2977_i2c_address_b