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