- bool res =
- twi_start_w(EEPROM_ID)
- && twi_send((uint8_t *)&addr, sizeof(addr))
- && twi_start_r(EEPROM_ID)
- && twi_recv(buf, count);
-#else
- #error Unknown device type
-#endif
-
- twi_stop();
-
- if (!res)
- TRACEMSG("Read error!");
- return res;
-}
-
-
-/**
- * Write a single character \a c at address \a addr.
- */
-bool eeprom_write_char(e2addr_t addr, char c)
-{
- return eeprom_write(addr, &c, 1);
-}
-
-
-/**
- * Read a single character at address \a addr.
- *
- * \return the requested character or -1 in case of failure.
- */
-int eeprom_read_char(e2addr_t addr)
-{
- char c;
-
- if (eeprom_read(addr, &c, 1))
- return c;
- else
- return -1;
-}