TauLabs/TauLabs — pull request #946 by lilvinz (2013-09-10 20:35:29+00:00)
Title: RFT: F4 I2C driver FSM fixes

Major rewrite / fix of the F4 i2c state machine.
* eliminates all special cases from the irq handlers
* removes callback api function as f1 doesn't have it and it isn't used anywhere
* disables irqs globally only in error case
* fixes some bool bitwise & usage mistakes
* splits up the f1 / f3 / f4 i2c private headers
* removes a whole bunch of debug asserts (if they are required i can add them back)
* uses PIOS_malloc
* this should work for f1 as well with minor changes (setting up pins / difference in std peripheral driver library)
* makes reading / understanding the fsm a bit easier at the cost of creating a little bit of redundancy
* adds diagnostic logging of auto state transitions

This was a lot of research figuring out how the i2c subsystem works and thus i was not able to make it a nice and clean git commit history while things were evolving.
Please test this on as much different hardware as possible.
I am confident that this fixes the hmc5883 issue (#831) as well and should replace #837.

Also see this doc where i noted my findings: https://docs.google.com/spreadsheet/ccc?key=0Au67-Wk4SPYBdFJxdkZqOVVDSm4xejU4UmtvUFJaakE&usp=sharing