67 #define LTC2974_I2C_ADDRESS 0x5C 93 uint8_t *addresses = NULL;
95 if (Serial.available())
98 if (user_command !=
'm')
99 Serial.println(user_command);
101 switch (user_command)
127 addresses = smbus->
probe(0);
128 while (*addresses != 0)
130 Serial.print(F(
"ADDR 0x"));
131 Serial.println(*addresses++, HEX);
140 Serial.println(F(
"Incorrect Option"));
154 Serial.print(F(
"\n*****************************************************************\n"));
155 Serial.print(F(
"* DC1978A Hello World Demonstration Program *\n"));
156 Serial.print(F(
"* *\n"));
157 Serial.print(F(
"* This program demonstrates how to send and receive data from *\n"));
158 Serial.print(F(
"* the LTC2974 on the demo board. *\n"));
159 Serial.print(F(
"* *\n"));
160 Serial.print(F(
"* Set the baud rate to 115200 and select the newline terminator.*\n"));
161 Serial.print(F(
"* *\n"));
162 Serial.print(F(
"*****************************************************************\n"));
169 Serial.print(F(
"\n 1-Basic Commands\n"));
170 Serial.print(F(
" 2-VID Commands (L16)\n"));
171 Serial.print(F(
" 3-VID Commands (float) \n"));
172 Serial.print(F(
" 4-PEC On\n"));
173 Serial.print(F(
" 5-PEC Off\n"));
174 Serial.print(F(
" 6-Bus Probe\n"));
175 Serial.print(F(
" 7-Reset\n"));
176 Serial.print(F(
"\nEnter a command:"));
183 Serial.println(F(
"\nWarning: Demo board not detected. Linduino will attempt to proceed."));
193 for (page = 0; page < 4; page++)
197 Serial.print(F(
"LTC2974 VOUT "));
198 Serial.println(voltage, DEC);
209 for (page = 0; page < 4; page++)
213 Serial.print(F(
"LTC2974 IOUT "));
214 Serial.println(current, DEC);
226 for (page = 0; page < 4; page++)
228 Serial.print(F(
"PAGE "));
229 Serial.println(page, DEC);
232 Serial.print(F(
"LTC2974 STATUS BYTE 0x"));
233 Serial.println(b, HEX);
235 Serial.print(F(
"LTC2974 STATUS WORD 0x"));
236 Serial.println(w, HEX);
274 reg_page = (reg_page < 0x02) ? reg_page + 0x01 : 0x00 ;
277 Serial.print(F(
"LTC2974 PAGE SET TO : "));
278 Serial.println(reg_page, HEX);
291 Serial.print(F(
" 1-Read All Voltages\n"));
292 Serial.print(F(
" 2-Read All Currents\n"));
293 Serial.print(F(
" 3-Read All Status\n"));
294 Serial.print(F(
" 4-Sequence Off/On\n"));
295 Serial.print(F(
" 5-Margin High\n"));
296 Serial.print(F(
" 6-Margin Low\n"));
297 Serial.print(F(
" 7-Margin Off\n"));
298 Serial.print(F(
" 8-Increment Page Number\n"));
299 Serial.print(F(
" m-Main Menu\n"));
300 Serial.print(F(
"\nEnter a command: "));
303 if (user_command ==
'm')
305 Serial.print(F(
"m\n"));
308 Serial.println(user_command);
310 switch (user_command)
337 if (user_command !=
'm')
338 Serial.println(F(
"Invalid Selection"));
342 while (user_command !=
'm');
359 Serial.print(F(
" 1-VID UP 40 LSB\n"));
360 Serial.print(F(
" 2-VID DN 40 LSB\n"));
361 Serial.print(F(
" m-Main Menu\n"));
362 Serial.print(F(
"\nEnter a command: "));
365 if (user_command ==
'm')
367 Serial.print(F(
"m\n"));
370 Serial.println(user_command);
372 switch (user_command)
377 Serial.print(F(
"LTC2974 VOUT Code "));
378 Serial.println(vcode, HEX);
381 Serial.print(F(
"LTC2974 VOUT Telemetry "));
382 Serial.println(voltage, DEC);
387 Serial.print(F(
"LTC2974 VOUT Code "));
388 Serial.println(vcode, HEX);
391 Serial.print(F(
"LTC2974 VOUT Telemetry "));
392 Serial.println(voltage, DEC);
393 Serial.print(F(
"\n"));
396 if (user_command !=
'm')
397 Serial.println(F(
"Invalid Selection"));
401 while (user_command !=
'm');
416 Serial.print(F(
" 1-VID UP 4mV\n"));
417 Serial.print(F(
" 2-VID DN 4mV\n"));
418 Serial.print(F(
" m-Main Menu\n"));
419 Serial.print(F(
"\nEnter a command: "));
422 if (user_command ==
'm')
424 Serial.print(F(
"m\n"));
427 Serial.println(user_command);
429 switch (user_command)
434 Serial.print(F(
"LTC2974 VOUT "));
435 Serial.println(vid_value, DEC);
438 Serial.print(F(
"LTC2974 VOUT Telemetry "));
439 Serial.println(voltage, DEC);
444 Serial.print(F(
"LTC2974 VOUT "));
445 Serial.println(vid_value, DEC);
448 Serial.print(F(
"LTC2974 VOUT Telemetry "));
449 Serial.println(voltage, DEC);
450 Serial.print(F(
"\n"));
453 if (user_command !=
'm')
454 Serial.println(F(
"Invalid Selection"));
458 while (user_command !=
'm');
static uint8_t ltc2974_i2c_address
static void sequence_off_on()
lin16_t float_to_lin16(float xin, lin16m_t vout_mode)
static void menu_1_basic_commands()
Display menu 1.
unsigned char user_command
LTC SMBus Support: Implementation for a shared SMBus layer.
uint8_t readStatusByte(uint8_t address)
Get the status byte.
Header File for Linduino Libraries and Demo Code.
void enablePec(uint8_t address)
Enable pec for all transactions.
uint16_t readStatusWord(uint8_t address)
Get the status word.
float readIout(uint8_t address, bool polling)
Get the measured output current.
static void print_all_currents()
Prints all currents.
void disablePec(uint8_t address)
Disable pec for all transactions.
static void print_prompt()
Prints main menu.
virtual void writeWord(uint8_t address, uint8_t command, uint16_t data)=0
SMBus write word command.
#define LTC2974_I2C_ADDRESS
static void loop()
Repeats Linduino loop.
static void print_title()
Prints the title block when program first starts.
void startGroupProtocol(void)
starts group protocol
static void print_all_voltages()
Prints all voltages.
float readVout(uint8_t address, bool polling)
Get the measured output voltage.
static void print_all_status()
Prints all status bytes and words.
static void margin_high()
Margin high.
LT_I2CBus: Routines to communicate to I2C by Wire Library.
static void margin_low()
Margin low.
static void margin_off()
Go to nominal.
virtual void writeByte(uint8_t address, uint8_t command, uint8_t data)=0
SMBus write byte command.
virtual uint8_t readByte(uint8_t address, uint8_t command)=0
SMBus read byte command.
static void menu_3_vid_commands()
Display menu 3.
void setPage(uint8_t address, uint8_t page)
Set the page.
void marginLowGlobal(void)
Margin all rails low.
static void setup()
Initialize Linduino.
static void print_warning_prompt()
Prints a warning if the demo board is not detected.
void sequenceOnGlobal(void)
Sequence on all rails.
virtual uint8_t * probe(uint8_t command)=0
SMBus bus probe.
static void menu_2_vid_commands()
Display menu 2.
static LT_PMBusMath * math
LTC SMBus Support: Implementation for a shared SMBus layer.
void sequenceOffGlobal(void)
Sequence off all rails.
void setVout(uint8_t address, float voltage)
Set output voltage.
void executeGroupProtocol(void)
ends group protocol
void restoreFromNvm(uint8_t address)
Restore device from NVM.
static uint16_t current
the current measurement from the LTC3335's counter test mode.
void marginHighGlobal(void)
Margin all rails high.
static void increment_page()
LTC PMBus Support: Math conversion routines.