Difference between the bWriteBytes functions in I2CHW and I2Cm user modules

Question: How does the implementation of bWriteBytes function in I2CHW user module differ from the same API implementation in I2Cm user module?

 

Answer:

In I2Cm, the function is a blocking function which executes in the foreground and returns only after completing the write operation. When the function is executing, the processor is loaded 100% and cannot perform other foreground operations.

Whereas in I2CHW, the bWriteBytes function initializes the buffer, sets the write count and exits. The actual write is performed by and completed in the I2C ISR. The status of the write should be checked in the foreground by reading the I2CHW_bReadI2CStatus function. Since it is a hardware block, when the write is being performed, the CPU is free to do other foreground operations.