I2C Memory Address suggestion
Posted: Mon Mar 28, 2011 7:05 pm
Hi,
I'm currently using SUB-20 as my USB to I2C interface.
There's 1 point I've found out when using SUB-20 DLL:
In sub_i2c_read and sub_i2c_write functions, the memory address variable is an integer (int ma). I find this quite strange, as in the implementation of the function, you would have to do bit shifting to get the actual memory address bytes. Additionally, with an integer, you can enter maximum of 4 bytes memory address with 32-bit system (this normally is not a problem, but probably there are users who want more address bytes). The same applies for bit bang I2C read and write.
Thus I think it would be better to change the memory address variable as an array of bytes just like the buffer to store I2C read and write data (char* ma). Then it would also be more clear for the user to know how to address the memory byte by byte.
Just a suggestion, please give me your opinion about it.
Kaz
I'm currently using SUB-20 as my USB to I2C interface.
There's 1 point I've found out when using SUB-20 DLL:
In sub_i2c_read and sub_i2c_write functions, the memory address variable is an integer (int ma). I find this quite strange, as in the implementation of the function, you would have to do bit shifting to get the actual memory address bytes. Additionally, with an integer, you can enter maximum of 4 bytes memory address with 32-bit system (this normally is not a problem, but probably there are users who want more address bytes). The same applies for bit bang I2C read and write.
Thus I think it would be better to change the memory address variable as an array of bytes just like the buffer to store I2C read and write data (char* ma). Then it would also be more clear for the user to know how to address the memory byte by byte.
Just a suggestion, please give me your opinion about it.
Kaz