break;
case 0x50: /* Data byte has been received and ACK sent */
- i2c->in_buff[i2c->read_index++] = i2c->regs->data;
+ if (i2c->in_buff != NULL) {
+ i2c->in_buff[i2c->read_index] = i2c->regs->data;
+ }
+ i2c->read_index++;
if ((i2c->read_index + 1) < i2c->read_length) {
/* assert ACK after data is received, requesting next Data from slave */
i2c->regs->ctrl_set = I2C_ASSERT_ACK;
case 0x58: /* Data byte has been received and NACK "sent" */
/* This tells the slave it was the last byte. We should be done. */
- i2c->in_buff[i2c->read_index++] = i2c->regs->data;
+ if (i2c->in_buff != NULL) {
+ i2c->in_buff[i2c->read_index] = i2c->regs->data;
+ }
+ i2c->read_index++;
/* FIXME : We have two other options : Repeated START or STOP + START,
* but what for ? periodic reads ? */
i2c->regs->ctrl_set = I2C_STOP_FLAG;