From: Dave H. <dhy...@gm...> - 2010-10-29 20:38:22
|
Hi Vaibhav, > In my program I Have: > > I2cSetSlaveAddress( i2cDev, Address, I2C_NO_CRC); > SetI2CFastMode(); > > //What is the purpose of the next few lines? > // If I am switching between 2 devices that I communicate with, would the > code below need to be implemented. > // I would certainly need to call I2cSetSlave so that the ioctl can be > called telling the kernel (driver) what device I want to communicate with So you need to call I2cSetSlaveAddress if you're going to use the I2c functions from robostix/gumstix/Common. If you're going to use the I2C_RDWR ioctl calls, then you can set the address directly in that call. > I2C_IO_RESET_FLAG( i2cDev); I have no idea what that does. It's not in any of my code. > prevTime = time (NULL); > while (time (NULL) == prevTime ) > { > ; > } > endTime = prevTime + 120; These lines look like they came from i2c-adc.c which was a test program to see how many adc requests could be issued in 10 seconds. The loop just makes sure that it's starting as close as it can to the transition from one second to the next. This gives more repeatable results (for timing purposes). This isn't need for normal programs. -- Dave Hylands Shuswap, BC, Canada http://www.DaveHylands.com/ |