Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board
QuikEval_EEPROM.cpp
Go to the documentation of this file.
1 /*!
2 QuikEval EEPROM Library
3 
4 Routines to read and parse the ID string from the EEPROM
5 on a QuikEval-compatible demo board.
6 
7 The QuikEval ID string has the following 50 byte format :
8 @verbatim
9 LTCxxxx,cls,Dxxxx,xx,yy,DC,DCxxxx--------------,\n\0
10 Example: LTC2309,Cls,D1859,01,01,DC,DC1337A-A,------------\n\0
11 @endverbatim
12 
13 Also included are the routines to communicate with an external serial I2C EEPROM
14 such as the 24LC025 found on all LTC QuikEval compatible demo boards. The routines
15 use the ATMega328 hardware I2C port. The routines require the use of the hardware I2C
16 routines found in LT_I2C.h
17 
18 
19 Copyright 2018(c) Analog Devices, Inc.
20 
21 All rights reserved.
22 
23 Redistribution and use in source and binary forms, with or without
24 modification, are permitted provided that the following conditions are met:
25  - Redistributions of source code must retain the above copyright
26  notice, this list of conditions and the following disclaimer.
27  - Redistributions in binary form must reproduce the above copyright
28  notice, this list of conditions and the following disclaimer in
29  the documentation and/or other materials provided with the
30  distribution.
31  - Neither the name of Analog Devices, Inc. nor the names of its
32  contributors may be used to endorse or promote products derived
33  from this software without specific prior written permission.
34  - The use of this software may or may not infringe the patent rights
35  of one or more patent holders. This license does not release you
36  from the requirement that you obtain separate licenses from these
37  patent holders to use this software.
38  - Use of the software either in source or binary form, must be run
39  on or directly connected to an Analog Devices Inc. component.
40 
41 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
42 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
43 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
44 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
45 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
46 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
47 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
48 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
49 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
50 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51 */
52 
53 //! @ingroup Linduino
54 //! @{
55 //! @defgroup QuikEval QuikEval EEPROM library
56 //! @}
57 
58 /*! @file
59  @ingroup QuikEval
60  Library for reading from and writing to the EEPROM on QuikEval-compatible demo boards.
61 */
62 
63 #include <Arduino.h>
64 #include <stdint.h>
65 #include <util/delay.h>
66 #include "Linduino.h"
67 #include "LT_I2C.h"
68 #include "UserInterface.h"
69 #include "QuikEval_EEPROM.h"
70 
72 
73 // Read the id string from the EEPROM, then parse the
74 // product name, demo board name, and demo board option
75 // from the id string into the global demo_board variable.
76 // Returns the number of characters read from the information string.
77 uint8_t read_quikeval_id_string(char *buffer)
78 {
79  uint8_t i, j; // Iteration variables
80  uint8_t comma_position[8] = {0}; // Contains the position of the commas in the buffer
81  uint8_t comma_count = 0; // The number of commas found in the buffer
82  uint8_t buffer_count; // The number of characters read
83  int8_t option; // Temporary demo board option
84  // read the id string from the demo board EEPROM
85  // starting EEPROM address=0, terminator=0x0a, max buffer length=52 bytes
86  // Enable I2C
87  pinMode(QUIKEVAL_MUX_MODE_PIN, OUTPUT); // Configure MUX to disconnect I2C pins on QuikEval connector. Remember EEPROM has its own I2C pins on the the connector.
88  int8_t QUIKEVAL_MUX_MODE_PIN_state;
89  QUIKEVAL_MUX_MODE_PIN_state = digitalRead(QUIKEVAL_MUX_MODE_PIN);
90  digitalWrite(QUIKEVAL_MUX_MODE_PIN, LOW);
92  digitalWrite(QUIKEVAL_MUX_MODE_PIN, QUIKEVAL_MUX_MODE_PIN_state); // Restore the QUIKEVAL_MUX_MODE_PIN (8) to its previous state. (But, it will be left as output.)
93  if (buffer_count == 0) return(0); // quit if no data read
94  // find comma positions
95  for (i = 0; i < buffer_count; i++)
96  {
97  if (buffer[i] == ',') comma_position[comma_count++]=i;
98  }
99 
100  if (comma_position[6] < comma_position[5])// comma_position[6]=strlen(buffer); // some demo boards are missing the last comma
101  {
102  for (i = buffer_count - 2; i > comma_position[5]; i--)
103  {
104  if (buffer[i] != '-')
105  {
106  comma_position[6] = i+1;
107  break;
108  }
109  }
110  }
111 
112 
113 
114  // get product name. All characters before the 1st comma.
115  for (i = 0; i < comma_position[0]; i++)
116  {
117  demo_board.product_name[i]=buffer[i];
118  }
119  demo_board.product_name[i]='\0'; // add terminator
120  // Get demo board name between the 5th and 6th comma
121  j = 0;
122 
123  for (i = comma_position[5]+1; i < comma_position[6]; i++)
124  {
125  demo_board.name[j++]=buffer[i];
126  }
127  demo_board.name[j]='\0'; // add terminator
128  // get demo board option from the demo board name
129  for (i = 0; i < strlen(demo_board.name); i++)
130  {
131  if (demo_board.name[i] == '-') option = demo_board.name[i+1];
132  }
133  if ((option >= 0x41) && (option <= 0x5A)) demo_board.option = option;
134  // final demo board name is 6 characters without the option
135  demo_board.name[6]='\0';
136  return(buffer_count);
137 }
138 
139 // Read the ID string from the EEPROM and determine if the correct board is connected.
140 // Returns 1 if successful, 0 if not successful
142 {
143  int8_t connected;
144  connected = 1;
145  // read the ID from the serial EEPROM on the board
146  // reuse the buffer declared in UserInterface
147  if (read_quikeval_id_string(&ui_buffer[0]) == 0) connected = 0;
148  // make sure it is the correct demo board
149  if (strcmp(demo_board.name, demo_name) != 0) connected = 0;
150  if (connected != 0)
151  {
152  Serial.print("Demo Board Name: ");
153  Serial.println(demo_board.name);
154  Serial.print("Product Name: ");
155  Serial.println(demo_board.product_name);
156  if (demo_board.option)
157  {
158  Serial.print("Demo Board Option: ");
159  Serial.println(demo_board.option);
160  }
161  }
162  else
163  {
164  Serial.print("Demo board ");
165  Serial.print(demo_name);
166  Serial.print(" not found, \nfound ");
167  Serial.print(demo_board.name);
168  Serial.println(" instead. \nConnect the correct demo board, then press the reset button.");
169  }
170  return(connected);
171 }
172 
173 
174 
175 // Determine if the EEPROM is ready for communication by writing
176 // the address+!write byte and looking for an acknowledge. This is
177 // repeated every 1ms until an acknowledge occurs, or a timeout occurs.
178 // If a timeout occurs, an I2C stop is generated.
179 // Returns 0 if an acknowledge is generated and 1 if not.
180 int8_t eeprom_poll(uint8_t i2c_address)
181 {
182  uint8_t timer_count;
183  int8_t ack;
184  i2c_start(); // I2C start
185  ack = i2c_write(i2c_address | I2C_WRITE_BIT); // I2C address + !write
186  if (ack != 0)
187  {
188  // acknowledge not received, enter timer loop
189  for (timer_count = 0; timer_count < EEPROM_TIMEOUT; timer_count++)
190  {
191  i2c_repeated_start(); // I2C repeated start
192  ack = i2c_write(i2c_address | I2C_WRITE_BIT); // I2C address + !write
193  if (ack == 0)
194  break; // If the EEPROM acknowledges, jump out of delay loop
195  else
196  delay(1);
197  }
198  if (ack) i2c_stop(); // Generate a stop if no acknowledge
199  }
200  return(ack);
201 }
202 
203 // Wait for the EEPROM write cycle to complete by executing
204 // the acknowledge polling loop.
205 // Returns 0 if an acknowledge is generated and 1 if not.
207 {
208  _delay_us(10);
209  return(eeprom_poll(i2c_address));
210 }
211 
212 // Write the data byte to the EEPROM with i2c_address starting at EEPROM address.
213 // Returns the total number of bytes written
214 uint8_t eeprom_write_byte(uint8_t i2c_address, char data, uint16_t address)
215 {
216  uint8_t byte_count = 0;
217  if (address < EEPROM_DATA_SIZE) // Make sure the address is in bounds
218  {
219  if (!eeprom_poll(i2c_address)) // Check if EEPROM is ready
220  {
221  if (EEPROM_DATA_SIZE > 0x100)
222  i2c_write(address>>8); // Send upper byte of address if size > 256 bytes
223  i2c_write(address); // Send lower byte of address
224  i2c_write(data); // Send byte to EEPROM
225  i2c_stop(); // I2C stop
226  byte_count = 1;
227  }
228  }
229  return(byte_count);
230 }
231 
232 // Write the data byte array to the EEPROM with i2c_address starting at EEPROM address.
233 // Returns the total number of bytes written
234 uint8_t eeprom_write_byte_array(uint8_t i2c_address, char data[], uint16_t address, uint8_t num_bytes)
235 {
236  uint8_t i;
237  for (i = 0; i < num_bytes; i++)
238  {
239  if (eeprom_write_byte(i2c_address, data[i], address+i) != 1) break;
240  }
241  return (i);
242 }
243 
244 // Write the buffer to the EEPROM with i2c_address starting at EEPROM address in blocks of EEPROM_PAGE_SIZE bytes.
245 // Returns the total number of byte written
246 uint8_t eeprom_write_buffer(uint8_t i2c_address, char *buffer, uint16_t address)
247 {
248  uint8_t i, j;
249  uint8_t index = 0;
250  uint8_t page_count;
251  uint8_t byte_count;
252  page_count=((strlen(buffer)-1)/EEPROM_PAGE_SIZE)+1; // Calculate page count
253  if (address < EEPROM_DATA_SIZE) // Make sure the address is in bounds
254  {
255  for (i = 0; i < page_count; i++)
256  {
257  if (!eeprom_poll(i2c_address)) // Check if EEPROM is ready
258  {
259  if (EEPROM_DATA_SIZE > 0x100)
260  i2c_write(address>>8); // Send upper byte of address if size > 256 bytes
261  i2c_write(address); // Send lower byte of address
262  byte_count = strlen(buffer)-index; // Calculate the remaining byte count
263  if (byte_count > EEPROM_PAGE_SIZE) // Limit to EEPROM_PAGE_SIZE
264  byte_count = EEPROM_PAGE_SIZE;
265  for (j = 0; j < byte_count; j++)
266  {
267  if (address >= EEPROM_DATA_SIZE) break; // Quit if the address is at the end
268  i2c_write(buffer[index++]); // Write byte to EEPROM
269  address++; // Increment the EEPROM address
270  }
271  i2c_stop(); // The stop bit starts the write process
272  }
273  else
274  break;
275  }
276  }
277  return(index); // Return the number of bytes written
278 }
279 
280 // Read a data byte at address from the EEPROM with i2c_address.
281 // Returns the number of bytes read.
282 uint8_t eeprom_read_byte(uint8_t i2c_address, char *data, uint16_t address)
283 {
284  uint8_t byte_count = 0;
285  if (address < EEPROM_DATA_SIZE) // Make sure the address is in bounds
286  {
287  if (!eeprom_poll(i2c_address)) // Check if EEPROM is ready
288  {
289  if (EEPROM_DATA_SIZE > 0x100)
290  i2c_write(address>>8); // Send upper byte of address if size > 256 bytes
291  i2c_write(address); // Send lower byte of address
292  i2c_repeated_start(); // Repeated start
293  i2c_write(i2c_address | I2C_READ_BIT); // I2C address + read
294  *data = i2c_read(WITH_NACK); // Read last byte from EEPROM with NACK
295  i2c_stop(); // I2C stop
296  byte_count = 1;
297  }
298  }
299  return(byte_count);
300 }
301 
302 // Read a data byte at address from the EEPROM with i2c_address.
303 // Returns the number of bytes read.
304 uint8_t eeprom_read_byte_array(uint8_t i2c_address, char *data, uint16_t address, uint8_t num_bytes)
305 {
306  uint8_t i;
307  for (i = 0; i < num_bytes; i++)
308  {
309  if (eeprom_read_byte(i2c_address, data+i, address+i) != 1) break;
310  }
311  return (i);
312 }
313 
314 // Read data bytes from the EEPROM starting at address until number bytes read equals count. A null terminator is
315 // added to the end of the buffer.
316 // Returns the number of bytes read.
317 uint8_t eeprom_read_buffer(uint8_t i2c_address, char *buffer, uint16_t address, uint8_t count)
318 {
319  uint8_t i = 0;
320  uint8_t data;
321  *buffer='\0'; // Initialize buffer with null
322  if (!eeprom_poll(i2c_address)) // Check if the EEPROM is ready
323  {
324  if (EEPROM_DATA_SIZE > 0x100)
325  i2c_write(address>>8); // Send upper byte of address if size > 256 bytes
326  i2c_write(address); // Send lower byte of address
327  i2c_repeated_start(); // I2C repeated start
328  i2c_write(i2c_address | I2C_READ_BIT); // I2C address + read
329  for (i = 0; i < count-1; i++) // Read count-1 bytes with ACK
330  {
331  data = i2c_read(WITH_ACK); // Receive 1 EEPROM data byte with ACK
332  *buffer++=data; // Place data byte in buffer and increment pointer
333  }
334  data = i2c_read(WITH_NACK); // Read last byte from EEPROM with NACK
335  *buffer++=data;
336  i2c_stop(); // I2C stop
337  *buffer='\0'; // Place null terminator at end of buffer
338  return(i+1);
339  }
340  else
341  return(0);
342 }
343 
344 // Read data bytes from the EEPROM starting at address until the terminator is read
345 // or the number bytes read equals count. A null terminator is placed at the end of the buffer.
346 // Returns the number of bytes read.
347 uint8_t eeprom_read_buffer_with_terminator(uint8_t i2c_address, char *buffer, uint16_t address, char terminator, uint8_t count)
348 {
349  uint8_t i = 0;
350  uint8_t data;
351  *buffer='\0'; // Initialize buffer with null
352  if (eeprom_poll(i2c_address) == 0) // Check if the EEPROM is ready
353  {
354  if (EEPROM_DATA_SIZE > 0x100)
355  i2c_write(address>>8); // Send upper byte of address if size > 256 bytes
356  i2c_write(address); // Send lower byte of address
357  i2c_repeated_start(); // I2C repeated start
358  i2c_write(i2c_address | I2C_READ_BIT); // I2C address + read
359  for (i = 0; i < count-1; i++) // Read count-1 bytes with ACK
360  {
361  data = i2c_read(WITH_ACK); // Receive 1 EEPROM data byte with ACK
362  *buffer++=data; // Place data byte in buffer and increment pointer
363  if (data == terminator) break;
364  }
365  data = i2c_read(WITH_NACK); // Read one more byte from EEPROM with NACK
366  i2c_stop(); // I2C stop
367  *buffer = 0; // Place null terminator at end of buffer
368  return(i+1);
369  }
370  else
371  return(0);
372 }
373 
374 // Write the 2 byte integer data to the EEPROM starting at address. Use the eeprom_write_byte
375 // routine to avoid keeping track of page boundaries with the eeprom_write_buffer routine.
376 // Returns the total number of bytes written.
377 uint8_t eeprom_write_int16(uint8_t i2c_address, int16_t write_data, uint16_t address)
378 {
379  union
380  {
381  int16_t a;
382  int8_t b[2];
383  } data;
384  uint8_t byte_count;
385  data.a = write_data; // get the data
386  byte_count = eeprom_write_byte(i2c_address, data.b[0], address++); // write the LSB to EEPROM
387  if (eeprom_write_poll(i2c_address)) return(0); // poll EEPROM until complete
388  byte_count+=eeprom_write_byte(i2c_address, data.b[1], address); // write the MSB to EEPROM
389  if (eeprom_write_poll(i2c_address)) return(1); // poll EEPROM until complete
390  return(byte_count);
391 }
392 
393 // Read the two byte integer data from the EEPROM starting at address.
394 // Returns the total number of bytes read.
395 uint8_t eeprom_read_int16(uint8_t i2c_address, int16_t *read_data, uint16_t address)
396 {
397  union
398  {
399  int16_t a;
400  char b[2];
401  } data;
402  uint8_t byte_count = 0;
403  byte_count = eeprom_read_byte(i2c_address, &data.b[0], address++); // read the LSB from EEPROM
404  byte_count+=eeprom_read_byte(i2c_address, &data.b[1], address++); // read the MSB from EEPROM
405  *read_data = data.a;
406  return(byte_count);
407 }
408 
409 // Write the 4 byte float data to the EEPROM starting at address. Use the eeprom_write_byte
410 // routine to avoid keeping track of page boundaries with the eeprom_write_buffer routine.
411 // Returns the total number of bytes written.
412 uint8_t eeprom_write_float(uint8_t i2c_address, float write_data, uint16_t address)
413 {
414  union
415  {
416  float a;
417  char b[4];
418  } data;
419  uint8_t byte_count;
420 
421  data.a = write_data;
422  byte_count = eeprom_write_byte(i2c_address, data.b[0], address++);
423  if (eeprom_write_poll(i2c_address)) return(0);
424  byte_count+=eeprom_write_byte(i2c_address, data.b[1], address++);
425  if (eeprom_write_poll(i2c_address)) return(1);
426  byte_count+=eeprom_write_byte(i2c_address, data.b[2], address++);
427  if (eeprom_write_poll(i2c_address)) return(2);
428  byte_count+=eeprom_write_byte(i2c_address, data.b[3], address);
429  if (eeprom_write_poll(i2c_address)) return(3);
430  return(byte_count);
431 }
432 
433 // Read the four byte float data from the EEPROM starting at address.
434 // Returns the total number of bytes written
435 uint8_t eeprom_read_float(uint8_t i2c_address, float *read_data, uint16_t address)
436 {
437  union
438  {
439  float a;
440  char b[4];
441  } data;
442  uint8_t byte_count = 0;
443 
444  byte_count = eeprom_read_byte(i2c_address, &data.b[0], address++);
445  byte_count+=eeprom_read_byte(i2c_address, &data.b[1], address++);
446  byte_count+=eeprom_read_byte(i2c_address, &data.b[2], address++);
447  byte_count+=eeprom_read_byte(i2c_address, &data.b[3], address++);
448  *read_data = data.a;
449  return(byte_count);
450 }
451 
452 // Write the 4 byte int32 data to the EEPROM starting at address. Use the eeprom_write_byte
453 // routine to avoid keeping track of page boundaries with the eeprom_write_buffer routine.
454 // Returns the total number of bytes written.
455 uint8_t eeprom_write_int32(uint8_t i2c_address, int32_t write_data, uint16_t address)
456 {
457  union
458  {
459  int32_t a;
460  char b[4];
461  } data;
462  uint8_t byte_count;
463 
464  data.a = write_data;
465  byte_count = eeprom_write_byte(i2c_address, data.b[0], address++);
466  if (eeprom_write_poll(i2c_address)) return(0);
467  byte_count+=eeprom_write_byte(i2c_address, data.b[1], address++);
468  if (eeprom_write_poll(i2c_address)) return(1);
469  byte_count+=eeprom_write_byte(i2c_address, data.b[2], address++);
470  if (eeprom_write_poll(i2c_address)) return(2);
471  byte_count+=eeprom_write_byte(i2c_address, data.b[3], address);
472  if (eeprom_write_poll(i2c_address)) return(3);
473  return(byte_count);
474 }
475 
476 // Read the four byte int32 data from the EEPROM starting at address.
477 // Returns the total number of bytes written
478 uint8_t eeprom_read_int32(uint8_t i2c_address, int32_t *read_data, uint16_t address)
479 {
480  union
481  {
482  int32_t a;
483  char b[4];
484  } data;
485  uint8_t byte_count = 0;
486 
487  byte_count = eeprom_read_byte(i2c_address, &data.b[0], address++);
488  byte_count+=eeprom_read_byte(i2c_address, &data.b[1], address++);
489  byte_count+=eeprom_read_byte(i2c_address, &data.b[2], address++);
490  byte_count+=eeprom_read_byte(i2c_address, &data.b[3], address++);
491  *read_data = data.a;
492  return(byte_count);
493 }
494 
495 // Write Cal Key back
497 {
499 }
500 
501 // Reset key to default value
503 {
504  return(eeprom_write_int16(EEPROM_I2C_ADDRESS, 0xFFFF, EEPROM_CAL_STATUS_ADDRESS)); // Wipe Cal key
505 }
struct demo_board_type demo_board
Instantiate demo board structure.
uint8_t eeprom_read_byte_array(uint8_t i2c_address, char *data, uint16_t address, uint8_t num_bytes)
Read a data byte at address from the EEPROM with i2c_address.
#define I2C_WRITE_BIT
Definition: LT_I2C.h:64
char option
Demo Circuit option (A)
uint8_t enable_calibration()
Functions to set and clear the calibration key.
int8_t eeprom_poll(uint8_t i2c_address)
Determine if the EEPROM is ready for communication by writing the address+!write byte and looking for...
uint8_t eeprom_read_int16(uint8_t i2c_address, int16_t *read_data, uint16_t address)
Read the two byte integer data from the EEPROM starting at address.
uint8_t i2c_address
uint8_t read_data()
#define EEPROM_I2C_ADDRESS
uint8_t eeprom_write_byte(uint8_t i2c_address, char data, uint16_t address)
Write the data byte to the EEPROM with i2c_address starting at EEPROM address.
char name[15]
Demo Circuit number (DC1678)
Structure to hold parsed information from ID string - example: LTC2654-L16,Cls,D2636,01,01,DC,DC1678A-A,----—.
#define EEPROM_DATA_SIZE
Header File for Linduino Libraries and Demo Code.
int8_t eeprom_write_poll(uint8_t i2c_address)
Wait for the eeprom write cycle to complete by executing the acknowledge polling loop.
uint8_t eeprom_read_float(uint8_t i2c_address, float *read_data, uint16_t address)
Read the four byte float data from the EEPROM starting at address.
uint8_t eeprom_write_byte_array(uint8_t i2c_address, char data[], uint16_t address, uint8_t num_bytes)
Write the data byte array to the EEPROM with i2c_address starting at EEPROM address.
#define QUIKEVAL_MUX_MODE_PIN
QUIKEVAL_MUX_MODE_PIN defines the control pin for the QuikEval MUX.
Definition: Linduino.h:58
uint8_t eeprom_write_int32(uint8_t i2c_address, int32_t write_data, uint16_t address)
Write the 4 byte long data to the EEPROM starting at address.
static int32_t connected
Definition: CN-0413.ino:69
void i2c_stop()
Write stop bit to the hardware I2C port.
Definition: LT_I2C.cpp:462
int8_t i2c_start()
Write start bit to the hardware I2C port.
Definition: LT_I2C.cpp:425
static uint8_t address
Definition: DC2091A.ino:83
union LT_union_int32_4bytes data
Definition: DC2094A.ino:138
uint8_t eeprom_write_buffer(uint8_t i2c_address, char *buffer, uint16_t address)
Write the buffer to the EEPROM with i2c_address starting at EEPROM address in blocks of EEPROM_PAGE_S...
#define WITH_NACK
Use with i2c_read(WITH_NACK) to read without an acknowledge.
Definition: LT_I2C.h:91
#define EEPROM_TIMEOUT
uint8_t disable_calibration()
Disable calibration key.
#define _delay_us
uint8_t eeprom_write_float(uint8_t i2c_address, float write_data, uint16_t address)
Write the 4 byte float data to the EEPROM starting at address.
uint8_t eeprom_write_int16(uint8_t i2c_address, int16_t write_data, uint16_t address)
Write the 2 byte integer data to the EEPROM starting at address.
int8_t i2c_write(uint8_t data)
Send a data byte to hardware I2C port.
Definition: LT_I2C.cpp:470
uint8_t eeprom_read_byte(uint8_t i2c_address, char *data, uint16_t address)
Read a data byte at address from the EEPROM with i2c_address.
QuikEval EEPROM Library.
#define EEPROM_CAL_STATUS_ADDRESS
int8_t discover_demo_board(char *demo_name)
Read the ID string from the EEPROM and determine if the correct board is connected.
#define EEPROM_PAGE_SIZE
uint8_t eeprom_read_buffer_with_terminator(uint8_t i2c_address, char *buffer, uint16_t address, char terminator, uint8_t count)
Read data bytes from the EEPROM starting at address until the terminator is read or the number bytes ...
#define I2C_READ_BIT
Definition: LT_I2C.h:63
#define QUIKEVAL_ID_TERMINATOR
0x0A terminates the ID String
#define QUIKEVAL_ID_SIZE
Historical length of the ID string.
LT_I2C: Routines to communicate with ATmega328P&#39;s hardware I2C port.
char demo_name[]
Demo Board Name stored in QuikEval EEPROM.
Definition: DC1880A.ino:97
int8_t i2c_repeated_start()
Write a repeat start bit to the hardware I2C port.
Definition: LT_I2C.cpp:444
uint8_t eeprom_read_int32(uint8_t i2c_address, int32_t *read_data, uint16_t address)
Read the four byte long data from the EEPROM starting at address.
static int index
char product_name[15]
LTC Product (LTC2654-L16)
byte terminator
uint8_t i2c_read(int8_t ack)
Read a data byte from the hardware I2C port.
Definition: LT_I2C.cpp:491
static int i
Definition: DC2430A.ino:184
#define WITH_ACK
Use with i2c_read(WITH_ACK) to read with an acknowledge.
Definition: LT_I2C.h:90
#define EEPROM_CAL_KEY
uint8_t eeprom_read_buffer(uint8_t i2c_address, char *buffer, uint16_t address, uint8_t count)
Read data bytes from the EEPROM starting at address until number bytes read equals count...
uint8_t read_quikeval_id_string(char *buffer)
Read the id string from the EEPROM, then parse the product name, demo board name, and demo board opti...
char ui_buffer[UI_BUFFER_SIZE]