Use recv instead get.
authorasterix <asterix@38d2e660-2303-0410-9eaa-f027e97ec537>
Wed, 7 Jul 2010 16:08:30 +0000 (16:08 +0000)
committerasterix <asterix@38d2e660-2303-0410-9eaa-f027e97ec537>
Wed, 7 Jul 2010 16:08:30 +0000 (16:08 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/branches/i2c@4007 38d2e660-2303-0410-9eaa-f027e97ec537

bertos/drv/eeprom.c

index 470d85cd903d24c46a0571d1c247da50d1e0b05e..52ab70c72f7ab5f1cf8232f1b66ec818212a9905 100644 (file)
@@ -248,20 +248,11 @@ static size_t eeprom_read(struct KFile *_fd, void *_buf, size_t size)
                return 0;
        }
 
-       while (size--)
-       {
-               /*
-                * The last byte read does not have an ACK
-                * to stop communication.
-                */
-               int c = i2c_get(size);
 
-               if (c == EOF)
-                       break;
-
-               *buf++ = c;
-               fd->fd.seek_pos++;
-               rd_len++;
+       if (i2c_recv(buf, size))
+       {
+               fd->fd.seek_pos += size;
+               rd_len += size;
        }
 
        i2c_stop();