acually this code is the i2c master rx mode ,i am using lm3s600 ,keiluv4,
but i get the warning for this,somthing is wrong in return statement so plz help meeee to solv this problem
U8 I2c_Master_Receive(void) //Master Read/Receive operation
{
I2C0_MASTER_MSA_R = SLAVEA; // I2C Slave Address,transmit slave address with write bit
I2C0_MASTER_MCS_R = START; // The generation of a START
// I2C0_MASTER_MCS_R = 0x0; // clear the START bit to avoid retransmit of STAR
I2C0_MASTER_MIMR_R = 0x1; // enable i2c master interrupt.
while( I2C0_MASTER_MCS_R == I2C_BUSY) // wait until I2C is no longer busy
if (I2C0_MASTER_MCS_R == I2C_OK)
return I2C0_MASTER_MDR_R; // if operation was successful then return read value
else
return 0xFF; // return a constant value if there was an error
}
ther is an warning:
i2c.c(81): warning: #940-D: missing return statement at end of non-void function "I2c_Master_Receive"
but i get the warning for this,somthing is wrong in return statement so plz help meeee to solv this problem
U8 I2c_Master_Receive(void) //Master Read/Receive operation
{
I2C0_MASTER_MSA_R = SLAVEA; // I2C Slave Address,transmit slave address with write bit
I2C0_MASTER_MCS_R = START; // The generation of a START
// I2C0_MASTER_MCS_R = 0x0; // clear the START bit to avoid retransmit of STAR
I2C0_MASTER_MIMR_R = 0x1; // enable i2c master interrupt.
while( I2C0_MASTER_MCS_R == I2C_BUSY) // wait until I2C is no longer busy
if (I2C0_MASTER_MCS_R == I2C_OK)
return I2C0_MASTER_MDR_R; // if operation was successful then return read value
else
return 0xFF; // return a constant value if there was an error
}
ther is an warning:
i2c.c(81): warning: #940-D: missing return statement at end of non-void function "I2c_Master_Receive"