What i use file for i2c in slavefifo project example?

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

cross mob
Anonymous
Not applicable

 Hi

   

I use slave fifo project example now, and i willing to insert i2c function. 

   

So i found some i2c files in "Target₩Lib₩LP₩" i2c.c and i2c_rw.c ...,.

   

I really want to know which one is need to i2c function in slave fifo. 

   

Could you please let me know what am i including files in slave project example?

0 Likes
6 Replies
Anonymous
Not applicable

Hi Dv2,

   

i2c_hw.c uses the I2C hardware block present in the FX2LP.

   

i2c_sw.c uses two GPIOs to implement the software I2C.

   

You can use any of them based on your need.

   

Thanks,

   

sai krishna.

0 Likes
Anonymous
Not applicable

do you mean by

?

i2c_rw.c uses the I2C hardware block present in the FX2LP.

  

i2c.c uses two GPIOs to implement the software I2C.

????????????????

0 Likes
Anonymous
Not applicable

 I mean function like following. 

   

   

   void EZUSB_InitI2C(void);
  BOOL EZUSB_WriteI2C_(BYTE addr, BYTE length, BYTE xdata *dat);
BOOL EZUSB_ReadI2C_(BYTE addr, BYTE length, BYTE xdata *dat);
BOOL EZUSB_WriteI2C(BYTE addr, BYTE length, BYTE xdata *dat);
BOOL EZUSB_ReadI2C(BYTE addr, BYTE length, BYTE xdata *dat);
void EZUSB_WaitForEEPROMWrite(BYTE addr);

   
        
   

   

 

   

Is there any reference document?

0 Likes
Anonymous
Not applicable

 Addinglyabove post,

   

I want to know how can i use that function in firmware and how can i call from windows application program. 

0 Likes
Anonymous
Not applicable

 Addinglyabove post,

   

I want to know how can i use that function in firmware and how can i call from windows application program. 

0 Likes
Anonymous
Not applicable

 Hi Lee

   

the function 

   

BOOL EZUSB_WriteI2C_(BYTE addr, BYTE length, BYTE xdata *dat) has three parameters. The first parameter is for the addres, second one is for length of data to be followed, third is the pointer to data. The first byte," addr" will be shifted left by one bit and the last bit will be made either zero(write) or  1 (read). You can get the definition of 

   

BOOL EZUSB_WriteI2C_ in the i2c.c file.

   

 

   

Regards

   

Vikas.

0 Likes