Bug Report: Wrong return value type in i2c_rw.c

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hello Cypress Developers Team,

   

I found a bug in the file i2c_rw.c which contains the I2C read and write functions used by the framework users.

   

The functions

   

BOOL EZUSB_ReadI2C(BYTE addr, BYTE length, BYTE xdata *dat)

   

BOOL EZUSB_WriteI2C(BYTE addr, BYTE length, BYTE xdata *dat)

   

return an "I2C status byte" defined in lp.h which looks like "I2C_OK".

   

However, the defined return value in the function is defined as BOOL thus the "I2C status byte" is cast to BOOL and loses its information. And worst of all EVERY return value of the functions casts to TRUE!

   

The return value could simply be defined as int or similar to keep the "I2C status byte" information.

   

I know I can fix the bug locally in my repository but the framework should be fixed too in my opinion.

   

 

   

Regards,

   

Robin

0 Likes
1 Reply
Anonymous
Not applicable

 Hi,

   

 

   

Yes I understood what you are conveying. I will check on this and report this to the concerned team. Thank you for bringing this to our notice.

   

 

   

Regards,

   

Gayathri

0 Likes