|
|
|
|
|
|
|
|
i2c_wait(); |
|
|
i2c_wait(); |
|
|
length--; |
|
|
length--; |
|
|
if (length == 1) I2C0_C1 = I2C_C1_IICEN | I2C_C1_MST | I2C_C1_TXAK; |
|
|
if (length == 1) I2C0_C1 = I2C_C1_IICEN | I2C_C1_MST | I2C_C1_TXAK; |
|
|
rxBuffer[count++] = I2C0_D; |
|
|
|
|
|
|
|
|
if (count < BUFFER_LENGTH) { |
|
|
|
|
|
rxBuffer[count++] = I2C0_D; |
|
|
|
|
|
} else { |
|
|
|
|
|
tmp = I2C0_D; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
i2c_wait(); |
|
|
i2c_wait(); |
|
|
I2C0_C1 = I2C_C1_IICEN | I2C_C1_MST | I2C_C1_TX; |
|
|
I2C0_C1 = I2C_C1_IICEN | I2C_C1_MST | I2C_C1_TX; |
|
|
rxBuffer[count++] = I2C0_D; |
|
|
|
|
|
|
|
|
if (count < BUFFER_LENGTH) { |
|
|
|
|
|
rxBuffer[count++] = I2C0_D; |
|
|
|
|
|
} else { |
|
|
|
|
|
tmp = I2C0_D; |
|
|
|
|
|
} |
|
|
if (sendStop) I2C0_C1 = I2C_C1_IICEN; |
|
|
if (sendStop) I2C0_C1 = I2C_C1_IICEN; |
|
|
rxBufferLength = count; |
|
|
rxBufferLength = count; |
|
|
return count; |
|
|
return count; |