63 #include <avr/pgmspace.h> 75 #define FILE_TEXT_LINE_MAX 132 77 #define LTC3880_I2C_ADDRESS 0x30 78 #define LTC2974_I2C_ADDRESS 0x32 79 #define LTC2977_I2C_ADDRESS 0x33 110 uint8_t *addresses = NULL;
116 if (Serial.available())
118 while ((user_command =
read_int()) == 0);
119 if (user_command !=
'm')
120 Serial.println(user_command);
122 switch (user_command)
129 faultLog3880->
print(&Serial);
133 Serial.println(F(
"No LTC3880 Fault Log"));
139 faultLog2974->
print(&Serial);
143 Serial.println(F(
"No LTC2974 Fault Log"));
149 faultLog2977->
print(&Serial);
153 Serial.println(F(
"No LTC2977 Fault Log"));
163 while (timeout-- > 0)
182 addresses = smbus->
probe(0);
183 while (*addresses != 0)
185 Serial.print(F(
"ADDR 0x"));
186 Serial.println(*addresses++, HEX);
203 while (timeout-- > 0)
219 Serial.println(F(
"Incorrect Option"));
232 Serial.print(F(
"\n***************************************************************\n"));
233 Serial.print(F(
"* DC1962C Fault Log Program *\n"));
234 Serial.print(F(
"* *\n"));
235 Serial.print(F(
"* This program dumps fault logs *\n"));
236 Serial.print(F(
"* *\n"));
237 Serial.print(F(
"* Set the baud rate to 115200 and select the newline terminator.*\n"));
238 Serial.print(F(
"* *\n"));
239 Serial.print(F(
"*****************************************************************\n"));
246 Serial.print(F(
"\n 1-Dump Fault Logs\n"));
247 Serial.print(F(
" 2-Clear Fault Logs\n"));
248 Serial.print(F(
" 3-Clear Faults\n"));
249 Serial.print(F(
" 4-Bus Probe\n"));
250 Serial.print(F(
" 5-Reset\n"));
251 Serial.print(F(
" 6-Store Fault Log\n"));
252 Serial.print(F(
"\nEnter a command:"));
class that handles LTC2974 fault logs.
class that handles LTC2977 fault logs.
static void print_prompt()
Prints main menu.
unsigned char user_command
class that handles LTC3880 fault logs.
static LT_2977FaultLog * faultLog2977
LTC SMBus Support: Implementation for a shared SMBus layer.
void reset(uint8_t address)
Issue reset to one device.
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.
#define LTC2977_I2C_ADDRESS
void print(Print *printer=0)
Pretty prints this part's fault log to a Print inheriting object, or Serial if none specified...
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.
uint8_t waitForNotBusy(uint8_t address)
Read MFR_COMMON until not Busy.
LTC SMBus Support: Implementation for a LTC3880 Fault Log.
void startGroupProtocol(void)
starts group protocol
bool hasFaultLog(uint8_t address)
virtual uint8_t waitForAck(uint8_t address, uint8_t command)=0
Read with the address and command in loop until ack, then issue stop.
uint8_t readMfrStatusByte(uint8_t address)
Get the MFR status byte.
#define LTC3880_I2C_ADDRESS
static void setup()
Initialize Linduino.
#define MFR_FAULT_LOG_STORE
void release()
Frees the memory reserved for the fault log.
static void print_title()
Prints the title block when program first starts.
void read(uint8_t address)
Reads the fault log from the specified address, reserves memory to hold the data. ...
void release()
Frees the memory reserved for the fault log.
static LT_2974FaultLog * faultLog2974
void clearAllFaults(uint8_t address)
Clear all the faults for all pages.
virtual uint8_t * probe(uint8_t command)=0
SMBus bus probe.
static uint8_t ltc2974_i2c_address
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.
void print(Print *printer=0)
Pretty prints this part's fault log to a Print inheriting object, or Serial if none specified...
#define LTC2974_I2C_ADDRESS
static uint8_t ltc2977_i2c_address
void read(uint8_t address)
Reads the fault log from the specified address, reserves memory to hold the data. ...
void executeGroupProtocol(void)
ends group protocol
void restoreFromNvm(uint8_t address)
Restore device from NVM.
LTC SMBus Support: Implementation for a LTC2974 Fault Log.
void clearFaultLog(uint8_t address)
static LT_3880FaultLog * faultLog3880
void release()
Frees the memory reserved for the fault log.
static void loop()
Repeats Linduino loop.
static uint8_t ltc3880_i2c_address