I am attempting to use an MPU-6050 connected to a TMS320F28035 Experimenter kit. I loaded the I2C_eeprom example into CCS5, and the first thing I noticed is that it is far more complex (>400 loc) than the relatively easy SPI (139 loc), Serial (150 loc), and CAN (250 loc) examples. I'm a hardware guy, and not much of a programmer, so I usually have to modify the functions from the examples to get my designs to work. This example is far too complex for me for figure out or use.
So before I spend too much more time on this, I would appreciate some advice from people who are more experienced with this sort of thing:
Is I2C a bad design choice? It looks so complicated that it could only have originated in the 1980's. Is no one using it anymore in favor of SPI? Should I redesign using a sensor that has a SPI port exposed (the sparkfun MPU6050 breakout does not).
Is this problem already 'solved'? Linux has really easy ways to read I2C sensors like ioctl or i2cget. Has someone written a simple function that a "hardware guy" could use? It would like this:
uint16 ReadI2C(uint16 address, uint16 register){
//returns whatever is in the register in the device at the address
...400 loc goes here.
magic statemachine, timing, rules, flags, interrupts and stuff
}