Lines Matching defs:buffer
49 mraa::Result DS1307::writeBytes(uint8_t reg, uint8_t *buffer, int len)
51 if (!len || !buffer)
54 // create a buffer 1 byte larger than the supplied buffer,
60 // copy in the buffer after the reg byte
62 buf2[i] = buffer[i-1];
74 int DS1307::readBytes(uint8_t reg, uint8_t *buffer, int len)
76 if (!len || !buffer)
87 return m_i2c.read(buffer, len);
93 uint8_t buffer[7];
94 int bytesRead = readBytes(0, buffer, 7);
109 seconds = bcdToDec(buffer[0] & 0x7f);
110 minutes = bcdToDec(buffer[1]);
113 if (buffer[2] & 0x40)
116 hours = bcdToDec(buffer[2] & 0x1f);
118 pm = (buffer[2] & 0x20) ? true : false;
123 hours = bcdToDec(buffer[2] & 0x3f);
128 dayOfWeek = bcdToDec(buffer[3]);
129 dayOfMonth = bcdToDec(buffer[4]);
130 month = bcdToDec(buffer[5]);
131 year = bcdToDec(buffer[6]);
138 uint8_t buffer[7];
145 buffer[0] = decToBcd(seconds) | (tmpbuf & 0x80);
148 buffer[1] = decToBcd(minutes);
153 buffer[2] = decToBcd(hours) | 0x40;
155 buffer[2] |= 0x20;
158 buffer[2] = decToBcd(hours);
161 buffer[3] = decToBcd(dayOfWeek);
164 buffer[4] = decToBcd(dayOfMonth);
167 buffer[5] = decToBcd(month);
170 buffer[6] = decToBcd(year);
172 return writeBytes(0, buffer, 7);