1 Reply Latest reply on Feb 27, 2013 8:47 AM by gaya

    Bug Report: Wrong return value type in i2c_rw.c

    robin.dubois

      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