Search the Community
Showing results for tags 'mircochip'.
Found 1 result
Hi everyone, I have been playing with a MPU6050 and an Arduino for a while now and I think it time to replace my Arduino with my new pic32mx. I d like to create a "bridge" in order to use the I2Cdev library on a pic. First of all, if I managed to miss it during my google search, I would love the link If not, well, I m willing to try and build it myself. However I could use some guidelines... I would not say I m a noob in programming but I m certainly not an expert. The way I understand it: All the Class in this library use functions coming from "I2Cdev.cpp/h" "I2Cdev" is using functions coming from "Wire.cpp/h" (I know there is other possibilities but It can work using only the Wire class correct?) Then "Wire" use "twi.cpp/h" (with the TwoWire object created outside of the class ?!? (extern TwoWire Wire;) that's where c++ starts to be a bit confusing for me...) My first (and still main) idea was to create a whole new "Wire.cpp" and to rewrite all its original functions with code appropriate to pic32. But an other option could be to keep the Wire classe from Arduino and rewrite the TWI class instead... The second option would permit to keep the twi class almost intact (with all its benefit) and change only the necessary part. Third option : Anyone ??? What I have today is a class with the following functions (working for my pic) sendStart (bool restart) send a start or a restart signal sendStop() send a stop signal transmitOneByte(char data) just put a byte in the buffer (hardware send it automatically) sendData(char *data, int quantity) // Call sendStart // transmit *data with data = slave address // Call sendStop readData(char *dataTX, int nb param, char *dataRX, int quantity) // Call sendStart // transmit *data with data = slave address, data = register1 , data = register 2 .... // sendStart restart // transmit slave address+write // read the different byte, store them in dataRX and send a Nack at the end // Call sendStop I believe they are close to the Wire class so that should be the easy option however Wire is a daughter class of Stream.h which is daughter of print.h which is daughter......... So the really easy option would be to download that library from a dark website in one of your post below ;-) ;-) ;-) Looking forward to reading you Joachim