i2c.c
Go to the documentation of this file.00001
00039 #include "i2c.h"
00040
00047 bool i2c_send(const void *_buf, size_t count)
00048 {
00049 const uint8_t *buf = (const uint8_t *)_buf;
00050
00051 while (count--)
00052 {
00053 if (!i2c_put(*buf++))
00054 return false;
00055 }
00056 return true;
00057 }
00058
00071 bool i2c_recv(void *_buf, size_t count)
00072 {
00073 uint8_t *buf = (uint8_t *)_buf;
00074
00075 while (count--)
00076 {
00077
00078
00079
00080
00081 int c = i2c_get(count);
00082
00083 if (c == EOF)
00084 return false;
00085 else
00086 *buf++ = c;
00087 }
00088
00089 return true;
00090 }
00091